|
@ -462,7 +462,17 @@ func (t *OrderDrawCtl) ListOfWinners() { |
|
|
t.CheckErr(err) |
|
|
t.CheckErr(err) |
|
|
t.Assert(exist, code.MSG_ACTIVITY_NOT_EXIST, "互动不存在") |
|
|
t.Assert(exist, code.MSG_ACTIVITY_NOT_EXIST, "互动不存在") |
|
|
|
|
|
|
|
|
result, err := lottery_service.GetOrderWinnersResult(rule.Id, activity.RehearsalId, activity.ArchId) |
|
|
|
|
|
|
|
|
customer := models.Customer{} |
|
|
|
|
|
exist, err = models.Get(&customer, activity.CustomerId) |
|
|
|
|
|
t.CheckErr(err) |
|
|
|
|
|
t.Assert(exist, code.MSG_CUSTOMER_NOT_EXIST, "客户不存在") |
|
|
|
|
|
|
|
|
|
|
|
var result []*lottery_service.OrderWinnersResult |
|
|
|
|
|
if customer.IsSpecial == 2 { |
|
|
|
|
|
result, err = lottery_service.GetSpecialOrderWinnersResult(rule.Id, activity.RehearsalId, activity.ArchId) |
|
|
|
|
|
} else { |
|
|
|
|
|
result, err = lottery_service.GetOrderWinnersResult(rule.Id, activity.RehearsalId, activity.ArchId) |
|
|
|
|
|
} |
|
|
t.CheckErr(err) |
|
|
t.CheckErr(err) |
|
|
t.JSON(map[string]interface{}{ |
|
|
t.JSON(map[string]interface{}{ |
|
|
"total": len(result), |
|
|
"total": len(result), |
|
@ -566,7 +576,12 @@ func (t *OrderDrawCtl) OrderRank() { |
|
|
order := &models.CustomerOrder{} |
|
|
order := &models.CustomerOrder{} |
|
|
res, err := order.SumCustomerOrder(activity.Id, activity.RehearsalId, activity.ArchId, limit) |
|
|
res, err := order.SumCustomerOrder(activity.Id, activity.RehearsalId, activity.ArchId, limit) |
|
|
t.CheckErr(err) |
|
|
t.CheckErr(err) |
|
|
total, err := order.TotalCustomerOrderGoodsNum(activity.Id, activity.RehearsalId, activity.ArchId) |
|
|
|
|
|
|
|
|
var total int64 = 0 |
|
|
|
|
|
if len(res) == 1 && res[0]["num"] == "0" { |
|
|
|
|
|
res = nil |
|
|
|
|
|
} else { |
|
|
|
|
|
total, err = order.TotalCustomerOrderGoodsNum(activity.Id, activity.RehearsalId, activity.ArchId) |
|
|
|
|
|
} |
|
|
t.CheckErr(err) |
|
|
t.CheckErr(err) |
|
|
t.JSON(map[string]interface{}{ |
|
|
t.JSON(map[string]interface{}{ |
|
|
"list": res, |
|
|
"list": res, |
|
|