From d03ff894213bc96233512c227fa1f5cd6cb80087 Mon Sep 17 00:00:00 2001 From: meixiongfeng <766881921@qq.com> Date: Tue, 26 Dec 2023 19:14:36 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B6=88=E6=81=AF=E8=BF=94=E5=9B=9Ebug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- modules/integral/api_challengeover.go | 2 ++ modules/integral/api_rank.go | 2 +- modules/integral/model_rank.go | 5 ++--- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/modules/integral/api_challengeover.go b/modules/integral/api_challengeover.go index aca953a90..85add7cc0 100644 --- a/modules/integral/api_challengeover.go +++ b/modules/integral/api_challengeover.go @@ -30,6 +30,7 @@ func (this *apiComp) ChallengeOver(session comm.IUserSession, req *pb.IntegralCh atno []*pb.UserAtno // atno 类型 curAddExp []int32 ) + changExp = make(map[string]int32) harm = req.Report.Harm update = make(map[string]interface{}, 0) if errdata = this.ChallengeOverCheck(session, req); errdata != nil { @@ -153,6 +154,7 @@ func (this *apiComp) ChallengeOver(session comm.IUserSession, req *pb.IntegralCh err = this.module.modelIntegral.modifyIntegralData(session.GetUserId(), update) + this.module.modelRank.updateRank(harm, session.GetUserId(), int(req.Nandu)) session.SendMsg(string(this.module.GetType()), "challengeover", &pb.IntegralChallengeOverResp{ Data: list, Atno: atno, diff --git a/modules/integral/api_rank.go b/modules/integral/api_rank.go index 6d556e306..626f5f158 100644 --- a/modules/integral/api_rank.go +++ b/modules/integral/api_rank.go @@ -73,7 +73,7 @@ func (this *apiComp) RankList(session comm.IUserSession, req *pb.IntegralRankLis Line: v.Line[req.Nandu], } } - session.SendMsg(string(this.module.GetType()), "rank", &pb.IntegralRankListResp{ + session.SendMsg(string(this.module.GetType()), "ranklist", &pb.IntegralRankListResp{ Ranks: players, Friends: friends, }) diff --git a/modules/integral/model_rank.go b/modules/integral/model_rank.go index 6db6a80ee..275dc0514 100644 --- a/modules/integral/model_rank.go +++ b/modules/integral/model_rank.go @@ -6,7 +6,6 @@ import ( "go_dreamfactory/lego/core" "go_dreamfactory/lego/sys/redis/pipe" "go_dreamfactory/modules" - "go_dreamfactory/pb" "strconv" "github.com/go-redis/redis/v8" @@ -27,14 +26,14 @@ func (this *modelRank) Init(service core.IService, module core.IModule, comp cor } // 更新排名 -func (this *modelRank) updateRank(data *pb.DBIntegralRank, nandu int) (err error) { +func (this *modelRank) updateRank(Score int32, uid string, nandu int) (err error) { var ( pipe *pipe.RedisPipe = this.DBModel.Redis.RedisPipe(context.TODO()) menbers *redis.Z cmd *redis.IntCmd ) - menbers = &redis.Z{Score: float64(data.Score), Member: data.Uinfo.Uid} + menbers = &redis.Z{Score: float64(Score), Member: uid} if cmd = pipe.ZAdd(this.TableName+strconv.Itoa(nandu), menbers); err != nil { this.module.Errorln(err)