|
|
@ -244,10 +244,9 @@ func (t *OrderDrawCtl) Users() { |
|
|
|
defer s.Close() |
|
|
|
if customer.IsSpecial == 2 { |
|
|
|
s = s.Table(&models.CustomerOrder{}).Alias("o").Select("o.buyer_id as user_id, "+ |
|
|
|
" o.phone, o.order_entry_person_name as entry_person_name, u.nickname as username, u.avatar"). |
|
|
|
Distinct("o.buyer_id").Join("LEFT", (&models.User{}).Alias("u"), |
|
|
|
"o.buyer_id=u.id and u.is_delete=0").Where("o.activity_id=? and o.is_delete=0 "+ |
|
|
|
" and o.rehearsal_id=? and o.arch_id=?", activityId, activity.RehearsalId, activity.ArchId) |
|
|
|
" o.phone, o.order_entry_person_name as entry_person_name, o.receiver as username"). |
|
|
|
Where("o.is_delete=0 and o.activity_id=? and o.rehearsal_id=? and o.arch_id=?", |
|
|
|
activityId, activity.RehearsalId, activity.ArchId) |
|
|
|
|
|
|
|
if moduleService.BesideRepeat == define.MODULE_BESIDE_REPEAT { |
|
|
|
recordIds := make([]int, 0) |
|
|
@ -516,10 +515,9 @@ func (t *OrderDrawCtl) Orders() { |
|
|
|
t.CheckErr(err) |
|
|
|
t.Assert(exist, code.MSG_CUSTOMER_NOT_EXIST, "客户不存在") |
|
|
|
|
|
|
|
// 下订单人数
|
|
|
|
buyerCount, err := (&models.CustomerOrder{}).CountCustomerOrder(activity.Id, activity.RehearsalId, activity.ArchId) |
|
|
|
t.CheckErr(err) |
|
|
|
if customer.IsSpecial == 2 { |
|
|
|
count, err := (&models.CustomerOrder{}).CountCustomerOrder(activity.Id, activity.RehearsalId, activity.ArchId, 0) |
|
|
|
orders := make([]*SpecialOrdersResult, 0) |
|
|
|
err = core.GetXormAuto().Table(&models.CustomerOrder{}).Alias("o").Select("o.id as id, "+ |
|
|
|
" o.area_name as area_name, o.order_entry_person_name as entry_person_name, o.buyer_id as user_id, "+ |
|
|
@ -544,10 +542,11 @@ func (t *OrderDrawCtl) Orders() { |
|
|
|
t.JSON(map[string]interface{}{ |
|
|
|
"orders": orders, |
|
|
|
"total": len(orders), |
|
|
|
"buyer_count": buyerCount, |
|
|
|
"buyer_count": count, |
|
|
|
}) |
|
|
|
return |
|
|
|
} else { |
|
|
|
count, err := (&models.CustomerOrder{}).CountCustomerOrder(activity.Id, activity.RehearsalId, activity.ArchId, 1) |
|
|
|
orders := make([]*OrdersResult, 0) |
|
|
|
err = core.GetXormAuto().Table(&models.CustomerOrder{}).Alias("o"). |
|
|
|
Select("o.area_name, o.goods_name, o.buyer_id as user_id, u.nickname, l.extra_data as extra_data, o.created_at"). |
|
|
@ -569,7 +568,7 @@ func (t *OrderDrawCtl) Orders() { |
|
|
|
t.JSON(map[string]interface{}{ |
|
|
|
"orders": orders, |
|
|
|
"total": len(orders), |
|
|
|
"buyer_count": buyerCount, |
|
|
|
"buyer_count": count, |
|
|
|
}) |
|
|
|
return |
|
|
|
} |
|
|
|