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 }