From 770af7326db6c2b225a7d1e3e940363f776d22d2 Mon Sep 17 00:00:00 2001 From: tommy <3405129587@qq.com> Date: Wed, 22 Jul 2020 14:50:01 +0800 Subject: [PATCH] fix:bug --- controllers/client/login.go | 1 + controllers/pc/bully_screen.go | 8 +++++--- controllers/pc/reward.go | 2 ++ go.mod | 2 +- go.sum | 2 ++ services/bully_reward/dao.go | 4 ++-- 6 files changed, 13 insertions(+), 6 deletions(-) diff --git a/controllers/client/login.go b/controllers/client/login.go index 21f5d67..089e36d 100644 --- a/controllers/client/login.go +++ b/controllers/client/login.go @@ -65,6 +65,7 @@ func (t *UserCtl) WxLogin() { logger.Error("微信code:", wxcode) activity, exist, err := activity_service.GetActivityById(activityId) t.CheckErr(err) + t.Assert(exist, code.MSG_ACTIVITY_NOT_EXIST, "互动不存在") customer := new(models.Customer) exist, err = models.Get(customer, activity.CustomerId) diff --git a/controllers/pc/bully_screen.go b/controllers/pc/bully_screen.go index 9dbbc10..92c4efd 100644 --- a/controllers/pc/bully_screen.go +++ b/controllers/pc/bully_screen.go @@ -159,12 +159,14 @@ func (t *BullyScreenCtl) Latest() { t.Assert(exist, code.MSG_ACTIVITY_NOT_EXIST, "互动不存在") //获取霸屏服务得id - bullyScreenServer := new(models.BullyScreenServer) - exist, err = bullyScreenServer.GetByActivityId(activityId) + server := new(models.BullyScreenServer) + exist, err = server.GetByActivityId(activityId) t.CheckErr(err) t.Assert(exist, code.MSG_BULLY_SCREEN_SERVER_NOT_EXIST, "霸屏不存在") - result, err := bully_reward_service.GetBullyScreenLatest(bullyScreenServer.Id, activity.RehearsalId, activity.ArchId) + bully_reward_service.CheckBullyScreenStatus(server.Id) + + result, err := bully_reward_service.GetBullyScreenLatest(server.Id, activity.RehearsalId, activity.ArchId) t.CheckErr(err) if result == nil || result.Id == 0 { t.JSON(result) diff --git a/controllers/pc/reward.go b/controllers/pc/reward.go index c7a3475..711862a 100644 --- a/controllers/pc/reward.go +++ b/controllers/pc/reward.go @@ -32,6 +32,8 @@ func (t *RewardCtl) Latest() { t.CheckErr(err) t.Assert(exist, code.MSG_REWARD_NOT_EXIST, "打赏不存在") + go bully_reward_service.CheckRewardStatus(server.Id) + result, err := bully_reward_service.GetRewardLatest(server.Id, activity.RehearsalId, activity.ArchId) t.CheckErr(err) if result == nil || result.Id == 0 { diff --git a/go.mod b/go.mod index 033524e..4f448e6 100644 --- a/go.mod +++ b/go.mod @@ -5,7 +5,7 @@ go 1.12 require ( github.com/360EntSecGroup-Skylar/excelize/v2 v2.0.1 github.com/CloudyKit/fastprinter v0.0.0-20200109182630-33d98a066a53 // indirect - github.com/aws/aws-sdk-go v1.33.8 // indirect + github.com/aws/aws-sdk-go v1.33.9 // indirect github.com/chanxuehong/wechat v0.0.0-20200409104612-0a1fd76d7a3a github.com/dgrijalva/jwt-go v3.2.0+incompatible github.com/elazarl/go-bindata-assetfs v1.0.0 // indirect diff --git a/go.sum b/go.sum index 0aab9fd..31e95b6 100644 --- a/go.sum +++ b/go.sum @@ -63,6 +63,8 @@ github.com/aws/aws-sdk-go v1.33.6 h1:YLoUeMSx05kHwhS+HLDSpdYYpPzJMyp6hn1cWsJ6a+U github.com/aws/aws-sdk-go v1.33.6/go.mod h1:5zCpMtNQVjRREroY7sYe8lOMRSxkhG6MZveU8YkpAk0= github.com/aws/aws-sdk-go v1.33.8 h1:2/sOfb9oPHTRZ0lxinoaTPDcYwNa1H/SpKP4nVRBwmg= github.com/aws/aws-sdk-go v1.33.8/go.mod h1:5zCpMtNQVjRREroY7sYe8lOMRSxkhG6MZveU8YkpAk0= +github.com/aws/aws-sdk-go v1.33.9 h1:nkC8YxL1nxwshIoO3UM2486Ph+zs7IZWjhRHjmXeCPw= +github.com/aws/aws-sdk-go v1.33.9/go.mod h1:5zCpMtNQVjRREroY7sYe8lOMRSxkhG6MZveU8YkpAk0= github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q= github.com/bndr/gotabulate v1.1.2 h1:yC9izuZEphojb9r+KYL4W9IJKO/ceIO8HDwxMA24U4c= github.com/bndr/gotabulate v1.1.2/go.mod h1:0+8yUgaPTtLRTjf49E8oju7ojpU11YmXyvq1LbPAb3U= diff --git a/services/bully_reward/dao.go b/services/bully_reward/dao.go index 7574ab9..3380620 100644 --- a/services/bully_reward/dao.go +++ b/services/bully_reward/dao.go @@ -140,13 +140,13 @@ type BullyScreenStatus struct { Order *models.UserOrder `json:"order" xorm:"extends"` } -func CheckBullyScreenStatus(bullyScreenServerId int64) error { +func CheckBullyScreenStatus(serverId int64) error { result := make([]*BullyScreenStatus, 0) err := core.GetXormAuto().Table(new(models.BullyScreenHistory)).Alias("h"). Join("LEFT", new(models.UserOrder).AliasName("u"), "u.out_trade_no=h.out_trade_no and u.is_delete=0"). Where("h.bully_screen_server_id=? and h.status=-1 and h.is_delete=0", - bullyScreenServerId).Find(&result) + serverId).Find(&result) if err != nil { return err }