From faa8bdf698bd885a75517e20a14c1fe88ac23108 Mon Sep 17 00:00:00 2001 From: tommy <3405129587@qq.com> Date: Tue, 25 Aug 2020 15:06:25 +0800 Subject: [PATCH] fix:bug --- controllers/client/good.go | 14 ++++++++++++-- main.go | 3 ++- models/area_store.go | 2 +- utils/define/config.go | 4 ++-- 4 files changed, 17 insertions(+), 6 deletions(-) diff --git a/controllers/client/good.go b/controllers/client/good.go index 31ce5ee..65c9e67 100644 --- a/controllers/client/good.go +++ b/controllers/client/good.go @@ -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 { diff --git a/main.go b/main.go index b4d3183..09df912 100644 --- a/main.go +++ b/main.go @@ -6,11 +6,12 @@ import ( "hudongzhuanjia/controllers/client" "hudongzhuanjia/controllers/common" "hudongzhuanjia/controllers/pc" + "hudongzhuanjia/utils/define" //_ "net/http/pprof" ) func main() { - //define.SetDebug(true) + define.SetDebug(true) // pc core.GetInstanceRouterManage().Registered(new(pc.WsCtl)) // 用户 diff --git a/models/area_store.go b/models/area_store.go index 2805b0b..70c50a0 100644 --- a/models/area_store.go +++ b/models/area_store.go @@ -17,7 +17,7 @@ type AreaStore struct { Address string `json:"address" xorm:"not null default('') comment('地址') VARCHAR(255)"` ActivityId int `json:"activity_id" xorm:"not null comment('主活动id') BIGINT(20)"` CustomerId int `json:"customer_id" xorm:"not null default 0 comment('客户id') INT(11)"` - IsMainArea bool `json:"is_main_area" xorm:"not null default(0) comment('是否主地区1是') TINYINT(1)"` + IsMainArea int `json:"is_main_area" xorm:"not null default(0) comment('是否主地区1是') TINYINT(1)"` AreaServicePhone string `json:"area_service_phone" xorm:"not null default '' comment('地区客服电话') VARCHAR(128)"` AdminName string `json:"admin_name" xorm:"not null default '' comment('地区管理员名称') VARCHAR(128)"` Phone string `json:"phone" xorm:"not null default '' comment('地区管理员账号即手机号') VARCHAR(128)"` diff --git a/utils/define/config.go b/utils/define/config.go index fef9e15..f05867e 100644 --- a/utils/define/config.go +++ b/utils/define/config.go @@ -10,10 +10,10 @@ func SetDebug(modes ...bool) { } if IsDebugging { //RoomPrefix = "test_" - HOST = "https://hdzj.utools.club" + HOST = "https://ouxuanhudong.utools.club" H5Host = "http://ouxuanhudongtest.t.3pr.com.cn/web" SendUrl = "https://wsouxuanhudong.utools.club/PcClient/Ws/MessageCtl/Receive" - CallbackOrderUrl = "https://hdzj.utools.club/PcClient/common/WeChatOauthCtl/callbackOrder" + CallbackOrderUrl = "https://ouxuanhudong.utools.club/PcClient/common/WeChatOauthCtl/callbackOrder" } }