diff --git a/controllers/pc/tug_war.go b/controllers/pc/tug_war.go index aafac14..76ea767 100644 --- a/controllers/pc/tug_war.go +++ b/controllers/pc/tug_war.go @@ -104,10 +104,19 @@ func (t *TugOfWarCtl) Team() { baheId := t.MustGetInt64("bahe_activity_id") customerId := t.MustGetUID() + customer := new(models.Customer) + exist, err := models.Get(customer, customerId) + t.CheckErr(err) + t.Assert(exist, code.MSG_CUSTOMER_NOT_EXIST, "客户不存在") + bahe := new(models.TugOfWar) - exist, err := models.Get(bahe, baheId) + exist, err = models.Get(bahe, baheId) t.CheckErr(err) t.Assert(exist, code.MSG_TUGWAR_NOT_EXIST, "拔河不存在") + if bahe.Status == define.StatusNotBegin { + t.ERROR("拔河尚未开始", code.MSG_TUGWAR_NOT_EXIST) + return + } activity := new(models.Activity) exist, err = models.Get(activity, bahe.ActivityId) @@ -127,10 +136,14 @@ func (t *TugOfWarCtl) Team() { // 队伍颜色 qrcode := "" // 二维码 + link := define.H5TugOfWar + if customer.IsSpecial == 1 { + link = define.H5TugOfWar2020 + } if bahe.Model != "随机分配模式" { // 非随机模式,自选队伍 for index := range teams { - qrcode, err = utils.GenH5Qrcode(define.H5TugOfWar, map[string]interface{}{ + qrcode, err = utils.GenH5Qrcode(link, map[string]interface{}{ "area_id": area.Id, "activity_id": bahe.ActivityId, "customer_id": customerId, @@ -142,7 +155,7 @@ func (t *TugOfWarCtl) Team() { teams[index].Qrcode = qrcode } } else { - qrcode, err = utils.GenH5Qrcode(define.H5TugOfWar, map[string]interface{}{ + qrcode, err = utils.GenH5Qrcode(link, map[string]interface{}{ "area_id": area.Id, "activity_id": bahe.ActivityId, "customer_id": customerId, diff --git a/main.go b/main.go index b06cbaf..d731077 100644 --- a/main.go +++ b/main.go @@ -6,12 +6,11 @@ import ( "hudongzhuanjia/controllers/client" "hudongzhuanjia/controllers/common" "hudongzhuanjia/controllers/pc" - "hudongzhuanjia/utils/define" //_ "net/http/pprof" ) func main() { - define.SetDebug(false) + //define.SetDebug(true) // pc core.GetInstanceRouterManage().Registered(new(pc.WsCtl)) // 用户 diff --git a/services/bahe/tug_war.go b/services/bahe/tug_war.go index ea14965..ea5bbfd 100644 --- a/services/bahe/tug_war.go +++ b/services/bahe/tug_war.go @@ -1,7 +1,7 @@ package bahe_service import ( - "fmt" + "errors" "hudongzhuanjia/models" "hudongzhuanjia/utils/define" @@ -38,7 +38,7 @@ func GetCurrentTugWar(activityId, uid, rehearsalId interface{}, archId interface return nil, err } if !exist { - return nil, fmt.Errorf("轮次尚未开启") + return nil, errors.New("轮次尚未开启") } member := new(models.BaheTeamMember) diff --git a/utils/define/config.go b/utils/define/config.go index 843c868..f53f32d 100644 --- a/utils/define/config.go +++ b/utils/define/config.go @@ -26,18 +26,19 @@ var ( ) const ( - H5Index = "index.html" - H5SignIn = "SignIn.html" - H5ShakeRb = "shakeRb.html" - H5TugOfWar = "tugOfWar.html" - H5UpperWall = "UpperWall.html" - H5Barrage = "barrage.html" - H5Order = "order.html" - H5Reward = "reward.html" - H5BScreen = "bScreen.html" - H5Auction = "auction.html" - H5Vote = "vote.html" - H5Calorie = "calorie.html" + H5Index = "index.html" + H5SignIn = "SignIn.html" + H5ShakeRb = "shakeRb.html" + H5TugOfWar = "tugOfWar.html" + H5TugOfWar2020 = "tugOfWar2020.html" + H5UpperWall = "UpperWall.html" + H5Barrage = "barrage.html" + H5Order = "order.html" + H5Reward = "reward.html" + H5BScreen = "bScreen.html" + H5Auction = "auction.html" + H5Vote = "vote.html" + H5Calorie = "calorie.html" ) // 固定长度