|
|
@ -23,6 +23,11 @@ func (t *OrderEntryCtl) List() { |
|
|
|
uid := t.GetAccountId() |
|
|
|
activityId := t.MustGetInt("activity_id") |
|
|
|
|
|
|
|
activity := &models.Activity{} |
|
|
|
exist, err := models.Get(activity, activityId) |
|
|
|
t.CheckErr(err) |
|
|
|
t.Assert(exist, code.MSG_ACTIVITY_NOT_EXIST, "互动不存在") |
|
|
|
|
|
|
|
areaId := 0 |
|
|
|
if _type == define.TYPE_ENTRYPEOPLE { |
|
|
|
entryPerson := models.OrderEntryPerson{} |
|
|
@ -35,7 +40,7 @@ func (t *OrderEntryCtl) List() { |
|
|
|
} |
|
|
|
|
|
|
|
area := &models.AreaStore{} |
|
|
|
exist, err := models.Get(area, areaId) |
|
|
|
exist, err = models.Get(area, areaId) |
|
|
|
t.CheckErr(err) |
|
|
|
t.Assert(exist, code.MSG_AREASTORE_NOT_EXIST, "地区不存在") |
|
|
|
if area.IsMainArea != 1 && area.AreaGoodsRuleSwitch != 1 { |
|
|
@ -51,7 +56,7 @@ func (t *OrderEntryCtl) List() { |
|
|
|
for _, g := range goods { |
|
|
|
goodIds = append(goodIds, g.Id) |
|
|
|
} |
|
|
|
res, err := models.GetSubOrderGoodNum(goodIds) |
|
|
|
res, err := models.GetSubOrderGoodNum(goodIds, activity.RehearsalId, activity.ArchId) |
|
|
|
t.CheckErr(err) |
|
|
|
|
|
|
|
for index := range goods { |
|
|
@ -60,7 +65,7 @@ func (t *OrderEntryCtl) List() { |
|
|
|
qrcode, err := utils.Qrcode2Base64(url) |
|
|
|
t.CheckErr(err) |
|
|
|
goods[index].Qrcode = qrcode |
|
|
|
if goods[index].Stock == -1 { |
|
|
|
if goods[index].Stock != -1 { |
|
|
|
for _, v := range res { |
|
|
|
if goods[index].Id == v.GoodsId { |
|
|
|
goods[index].Stock -= v.GoodsNum |
|
|
@ -134,7 +139,7 @@ func (t *OrderEntryCtl) Order() { |
|
|
|
|
|
|
|
if good.Stock > -1 { // 库存
|
|
|
|
// 找出商品库存
|
|
|
|
ms, err := models.GetSubOrderGoodNumBySession(s, good.Id) |
|
|
|
ms, err := models.GetSubOrderGoodNumBySession(s, good.Id, activity.RehearsalId, activity.ArchId) |
|
|
|
if err != nil { |
|
|
|
s.Rollback() |
|
|
|
t.CheckErr(err) |
|
|
@ -352,7 +357,7 @@ func (t *OrderEntryCtl) ManualOrder() { |
|
|
|
// Join("left", (&models.CustomerOrder{}).Alias("o"), "o.id=s.order_id").
|
|
|
|
// Where("o.activity_id=? and o.rehearsal_id=? and o.arch_id=?", activity.Id, activity.RehearsalId, activity.ArchId).
|
|
|
|
// In("s.goods_id", goodIds).GroupBy("s.goods_id").Find(&ms)
|
|
|
|
ms, err := models.GetSubOrderGoodNumBySession(s, goodIds) |
|
|
|
ms, err := models.GetSubOrderGoodNumBySession(s, goodIds, activity.RehearsalId, activity.ArchId) |
|
|
|
if err != nil { |
|
|
|
s.Rollback() |
|
|
|
t.CheckErr(err) |
|
|
|