|
|
@@ -6,8 +6,10 @@ import ( |
|
|
|
svc2 "applet/app/customer/svc" |
|
|
|
svc "applet/app/customer/svc/order" |
|
|
|
"applet/app/db" |
|
|
|
"applet/app/db/model" |
|
|
|
"applet/app/e" |
|
|
|
"applet/app/enum" |
|
|
|
"applet/app/utils" |
|
|
|
"github.com/gin-gonic/gin" |
|
|
|
) |
|
|
|
|
|
|
@@ -25,13 +27,39 @@ func SelfSupportForSchoolOrderList(c *gin.Context) { |
|
|
|
e.OutErr(c, e.ERR, err.Error()) |
|
|
|
return |
|
|
|
} |
|
|
|
|
|
|
|
tradeAmountTotal, err := svc.SupportOrderStatistic(req) |
|
|
|
if err != nil { |
|
|
|
e.OutErr(c, e.ERR, err.Error()) |
|
|
|
return |
|
|
|
} |
|
|
|
|
|
|
|
var deviceList []*model.Device |
|
|
|
err = db.Db.Where("1 = 1").Find(&deviceList) |
|
|
|
if err != nil { |
|
|
|
e.OutErr(c, e.ERR, err.Error()) |
|
|
|
return |
|
|
|
} |
|
|
|
var merchantList []*model.Merchant |
|
|
|
err = db.Db.Where("1 = 1").Find(&merchantList) |
|
|
|
if err != nil { |
|
|
|
e.OutErr(c, e.ERR, err.Error()) |
|
|
|
return |
|
|
|
} |
|
|
|
var merchantListMapping = map[int]model.Merchant{} |
|
|
|
for _, v := range merchantList { |
|
|
|
merchantListMapping[v.Id] = *v |
|
|
|
} |
|
|
|
var merchantWithDeviceListMapping = map[string]model.Merchant{} |
|
|
|
for _, v := range deviceList { |
|
|
|
merchantWithDeviceListMapping[v.DeviceSn] = merchantListMapping[v.MerchantId] |
|
|
|
} |
|
|
|
|
|
|
|
for _, v := range list { |
|
|
|
v.MerchantName = merchantWithDeviceListMapping[v.DeviceSn].Name |
|
|
|
} |
|
|
|
|
|
|
|
utils.FilePutContents("SelfSupportForSchoolOrderList", utils.SerializeStr(list)) |
|
|
|
|
|
|
|
e.OutSuc(c, map[string]interface{}{ |
|
|
|
"list": list, |
|
|
|
"total": total, |
|
|
|