From 020a45e6df388ff2f0f56369945094f15757cb63 Mon Sep 17 00:00:00 2001 From: liwei1dao Date: Mon, 19 Feb 2024 16:12:33 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=8A=E4=BC=A0=E7=AB=9E=E6=8A=80=E5=9C=BAgm?= =?UTF-8?q?=20=E4=BF=AE=E6=94=B9=E7=A7=AF=E5=88=86=E5=90=8E=E5=AF=BC?= =?UTF-8?q?=E8=87=B4=E6=8E=92=E8=A1=8C=E6=A6=9C=E5=BC=82=E5=B8=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- modules/arena/module.go | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/modules/arena/module.go b/modules/arena/module.go index 6348b3e40..9975a16a8 100644 --- a/modules/arena/module.go +++ b/modules/arena/module.go @@ -100,12 +100,22 @@ func (this *Arena) Rpc_ModuleArenaRaceSettlement(ctx context.Context, args *pb.E // 修改用户积分 func (this *Arena) Rpc_ModuleArenaModifyIntegral(ctx context.Context, args *pb.RPCModifyIntegralReq, reply *pb.EmptyResp) (err error) { this.Debug("Rpc_ModuleArenaModifyIntegral", log.Field{Key: "args", Value: args.String()}) + var ( + info *pb.DBArenaUser + ) //防止数据未初始化就修改数据 - if _, err = this.modelArena.queryPlayerInfo(args.Uid); err != nil && err != mgo.MongodbNil { + if info, err = this.modelArena.queryPlayerInfo(args.Uid); err != nil && err != mgo.MongodbNil { this.Debug("Rpc_ModuleArenaModifyIntegral", log.Field{Key: "err", Value: err.Error()}) return } - err = this.modelArena.modifyIntegral(args.Uid, args.Integral) + if err = this.modelArena.modifyIntegral(args.Uid, args.Integral); err != nil { + this.Debug("Rpc_ModuleArenaModifyIntegral", log.Field{Key: "err", Value: err.Error()}) + return + } + err = this.modelRank.updateArenaRank(&pb.ArenaPlayer{ + Uinfo: info.Uinfo, + Integral: args.Integral, + }) return }