|
|
@ -46,15 +46,25 @@ func (t *GoodCtl) ListGood() { |
|
|
|
activityId := t.MustGetInt("activity_id") |
|
|
|
areaId := t.MustGetInt("area_id") |
|
|
|
|
|
|
|
area := &models.AreaStore{} |
|
|
|
exist, err := models.Get(area, areaId) |
|
|
|
t.CheckErr(err) |
|
|
|
t.Assert(exist, code.MSG_AREASTORE_NOT_EXIST, "地区不存在") |
|
|
|
if area.IsMainArea != 1 && area.AreaGoodsRuleSwitch == 1 { |
|
|
|
exist, err = area.GetMainAreaById(activityId) |
|
|
|
t.CheckErr(err) |
|
|
|
t.Assert(exist, code.MSG_AREASTORE_NOT_EXIST, "地区不存在") |
|
|
|
} |
|
|
|
|
|
|
|
option := new(models.CustomerOrderOption) |
|
|
|
exist, err := option.GetByActivityId(activityId) |
|
|
|
exist, err = option.GetByActivityId(activityId) |
|
|
|
t.CheckErr(err) |
|
|
|
if !exist { |
|
|
|
t.JSON([]interface{}{}) |
|
|
|
return |
|
|
|
} |
|
|
|
|
|
|
|
goods, err := models.GetGoodsByActivityId(activityId, areaId) |
|
|
|
goods, err := models.GetGoodsByActivityId(activityId, area.Id) |
|
|
|
t.CheckErr(err) |
|
|
|
|
|
|
|
for index := range goods { |
|
|
|