From 8584e3a0e059aa75372997407b01afcba3cd4065 Mon Sep 17 00:00:00 2001 From: tommy <3405129587@qq.com> Date: Thu, 30 Jul 2020 16:07:22 +0800 Subject: [PATCH] fix:bug --- controllers/pc/bully_screen.go | 4 +--- controllers/pc/reward.go | 5 +---- models/lottery_draw_record.go | 12 ------------ services/bully_reward/dao.go | 6 +++--- 4 files changed, 5 insertions(+), 22 deletions(-) diff --git a/controllers/pc/bully_screen.go b/controllers/pc/bully_screen.go index 92c4efd..c62e06f 100644 --- a/controllers/pc/bully_screen.go +++ b/controllers/pc/bully_screen.go @@ -31,7 +31,7 @@ func (t *BullyScreenCtl) WaitReview() { t.Assert(exist, code.MSG_BULLY_SCREEN_SERVER_NOT_EXIST, "霸屏不存在") //根据霸屏服务得id获取待审核得霸屏列表 - //t.CheckErr(bully_reward_service.CheckBullyScreenStatus(bullyScreenServer.Id)) + go bully_reward_service.CheckBullyScreenStatus(bullyScreenServer.Id) result, err := bully_reward_service.GetBullyScreenReview(bullyScreenServer.Id, activity.RehearsalId, activity.ArchId) t.CheckErr(err) @@ -164,8 +164,6 @@ func (t *BullyScreenCtl) Latest() { t.CheckErr(err) t.Assert(exist, code.MSG_BULLY_SCREEN_SERVER_NOT_EXIST, "霸屏不存在") - 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 { diff --git a/controllers/pc/reward.go b/controllers/pc/reward.go index 711862a..8717ae8 100644 --- a/controllers/pc/reward.go +++ b/controllers/pc/reward.go @@ -32,8 +32,6 @@ 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 { @@ -55,7 +53,6 @@ func (t *RewardCtl) Latest() { //获取待审核列表 func (t *RewardCtl) WaitReview() { activityId := t.MustGetInt64("activity_id") - //rehearsalId := t.MustGetInt64("rehearsal_id") activity := &models.Activity{} exist, err := models.Get(activity, activityId) @@ -69,7 +66,7 @@ func (t *RewardCtl) WaitReview() { t.Assert(exist, code.MSG_REWARD_NOT_EXIST, "打赏不存在") //// todo: 检查订单 - //t.CheckErr(bully_reward_service.CheckRewardStatus(server.Id)) + go bully_reward_service.CheckRewardStatus(server.Id, activity.ArchId) result, err := bully_reward_service.GetRewardReview(server.Id, activity.RehearsalId, activity.ArchId) t.CheckErr(err) diff --git a/models/lottery_draw_record.go b/models/lottery_draw_record.go index 490fddd..a7875e1 100644 --- a/models/lottery_draw_record.go +++ b/models/lottery_draw_record.go @@ -55,18 +55,6 @@ func (t *LotteryDrawRecord) GetByUserPrizeId(upId int64) (bool, error) { return core.GetXormAuto().Where("is_delete=0 and user_prize_id=?", upId).Get(t) } -func GetLotteryUsersResultByLotteryDrawRecord(obj, ladderId, rehearsalId interface{}, rollNum int) error { - session := core.GetXormAuto().Table(new(LotteryDrawRecord)).Alias("r"). - Join("LEFT", new(User).Alias("u"), "u.id=r.user_id"). - Where("r.is_delete=0 and r.lottery_draw_rule_ladder_id=? and "+ - "r.rehearsal_id=?", ladderId, rehearsalId) - defer session.Close() - if rollNum > 0 { - session = session.Where("roll_num=?", rollNum) - } - return session.Find(&obj) -} - func GetUserIdsByLotteryDrawRuleId(ruleId, rehearsalId, areaId, archId interface{}) ([]int64, error) { recordIds := make([]int64, 0) err := core.GetXormAuto().Table(new(LotteryDrawRecord)).Select("user_id"). diff --git a/services/bully_reward/dao.go b/services/bully_reward/dao.go index 3380620..461cc6b 100644 --- a/services/bully_reward/dao.go +++ b/services/bully_reward/dao.go @@ -72,13 +72,13 @@ type RewardStatus struct { Order *models.UserOrder `json:"order" xorm:"extends"` } -func CheckRewardStatus(serverId int64) error { +func CheckRewardStatus(serverId int64, archId int) error { result := make([]*RewardStatus, 0) err := core.GetXormAuto().Table(new(models.RewardHistory)).Alias("h"). Join("LEFT", new(models.UserOrder).AliasName("u"), "h.out_trade_no=u.out_trade_no and u.is_delete=0"). - Where("h.is_delete=0 and h.status=-1 and h.reward_server_id=?", - serverId).Find(&result) + Where("h.is_delete=0 and h.status=-1 and h.reward_server_id=? and h.arch_id=?", + serverId, archId).Find(&result) if err != nil { return err }