|
|
@ -44,15 +44,26 @@ func (t *OrderEntryCtl) List() { |
|
|
|
t.Assert(exist, code.MSG_AREASTORE_NOT_EXIST, "地区不存在") |
|
|
|
} |
|
|
|
|
|
|
|
// 库存
|
|
|
|
goods, err := models.GetGoodsByActivityId(activityId, area.Id) |
|
|
|
t.CheckErr(err) |
|
|
|
if _type == define.TYPE_USER { |
|
|
|
for index := range goods { |
|
|
|
url := fmt.Sprintf("%s/PcClient/Client/OrderEntryCtl/order?"+ |
|
|
|
"user_id=%d&activity_id=%d&good_id=%d", define.HOST, uid, activityId, goods[index].Id) |
|
|
|
qrcode, err := utils.Qrcode2Base64(url) |
|
|
|
t.CheckErr(err) |
|
|
|
goods[index].Qrcode = qrcode |
|
|
|
goodIds := make([]int, 0) |
|
|
|
for _, g := range goods { |
|
|
|
goodIds = append(goodIds, g.Id) |
|
|
|
} |
|
|
|
res, err := models.GetSubOrderGoodNumByGoodIds(goodIds) |
|
|
|
t.CheckErr(err) |
|
|
|
|
|
|
|
for index := range goods { |
|
|
|
url := fmt.Sprintf("%s/PcClient/Client/OrderEntryCtl/order?"+ |
|
|
|
"user_id=%d&activity_id=%d&good_id=%d", define.HOST, uid, activityId, goods[index].Id) |
|
|
|
qrcode, err := utils.Qrcode2Base64(url) |
|
|
|
t.CheckErr(err) |
|
|
|
goods[index].Qrcode = qrcode |
|
|
|
for _, v := range res { |
|
|
|
if goods[index].Id == v.GoodsId { |
|
|
|
goods[index].Stock -= v.GoodsNum |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|