瀏覽代碼

bug修改

wangfei 6 年之前
父節點
當前提交
ac4f6279c9
共有 3 個檔案被更改,包括 5 行新增2 行删除
  1. 1
    1
      models/card/card.go
  2. 1
    1
      models/coupon/coupon.go
  3. 3
    0
      service/flashbuy/flashbuy.go

+ 1
- 1
models/card/card.go 查看文件

@@ -481,7 +481,7 @@ func (m *CardDAO) GetCustomerCardByCustomerAndSaleCount(customerid, saleid strin
481 481
 // GetCustomerCardByCustomerAndSale 获取用户的领取记录
482 482
 func (m *CardDAO) GetCustomerCardByCustomerAndSale(customerid, saleid string, page, pageSize int) ([]model.TaCustomerCard, error) {
483 483
 	var customerCard []model.TaCustomerCard
484
-	err := m.db.Where("customer_id=?", customerid).And("sales_id=?", saleid).Desc("status").Limit(pageSize, (page-1)*pageSize).Find(&customerCard)
484
+	err := m.db.Where("customer_id=?", customerid).And("sales_id=?", saleid).OrderBy("status asc,receive_date desc").Limit(pageSize, (page-1)*pageSize).Find(&customerCard)
485 485
 	return customerCard, err
486 486
 }
487 487
 

+ 1
- 1
models/coupon/coupon.go 查看文件

@@ -542,7 +542,7 @@ func (m *CouponDAO) GetCustomerCouponByCustomerAndSaleCount(customerid, saleid s
542 542
 // GetCustomerCouponByCustomerAndSale 获取用户的领取记录
543 543
 func (m *CouponDAO) GetCustomerCouponByCustomerAndSale(customerid, saleid string, page, pageSize int) ([]model.TaCustomerCoupon, error) {
544 544
 	var customerCoupon []model.TaCustomerCoupon
545
-	err := m.db.Where("customer_id=?", customerid).And("sales_id=?", saleid).Desc("status").Limit(pageSize, (page-1)*pageSize).Find(&customerCoupon)
545
+	err := m.db.Where("customer_id=?", customerid).And("sales_id=?", saleid).OrderBy("status asc,receive_date desc").Limit(pageSize, (page-1)*pageSize).Find(&customerCoupon)
546 546
 	return customerCoupon, err
547 547
 }
548 548
 

+ 3
- 0
service/flashbuy/flashbuy.go 查看文件

@@ -206,6 +206,7 @@ func (s *FlashBuyServ) GetCustomerFlashBuyId(customerFlashBuyId string) (*flashb
206 206
 // FlashBuy 抢购
207 207
 func (s *FlashBuyServ) FlashBuy(id string) error {
208 208
 	flashbuy, err := s.dao.GetFlashBuyById(id)
209
+	utils.LogError("-----------------抢购校验开始")
209 210
 	if err != nil {
210 211
 		utils.LogError("获取抢购活动信息失败: " + err.Error())
211 212
 		return errors.New("获取抢购活动信息失败!")
@@ -231,6 +232,7 @@ func (s *FlashBuyServ) FlashBuy(id string) error {
231 232
 	if len(buys) > 0 {
232 233
 		return errors.New("您已参与过该活动!")
233 234
 	}
235
+	utils.LogError("-----------------抢购------")
234 236
 	if flashbuy.JoinNum >= flashbuy.FlashBuyMaxAttendant {
235 237
 		err = s.dao.UpdateFlashBuy(flashbuy.FlashBuyId, models.FLASH_BUY_OVER)
236 238
 		if err != nil {
@@ -279,6 +281,7 @@ func (s *FlashBuyServ) FlashBuy(id string) error {
279 281
 		utils.LogError("插入中奖二维码失败: " + err.Error())
280 282
 		return errors.New("写入中奖二维码失败")
281 283
 	}
284
+	// ---------------推送消息
282 285
 
283 286
 	// 推送微信消息
284 287
 	userMap := s.ctx.Get("userMap").(model.TaUserMapping)