From b765c8d03f90046d1cdb6b4588095f0360471bb3 Mon Sep 17 00:00:00 2001 From: liwei <2211068034@qq.com> Date: Wed, 28 Jun 2023 17:35:46 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=8A=E4=BC=A0=E7=AB=9E=E6=8A=80=E5=9C=BA?= =?UTF-8?q?=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- modules/arena/modelarena.go | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/modules/arena/modelarena.go b/modules/arena/modelarena.go index 74efe79fe..c891c1956 100644 --- a/modules/arena/modelarena.go +++ b/modules/arena/modelarena.go @@ -23,13 +23,13 @@ import ( "go.mongodb.org/mongo-driver/x/bsonx" ) -///竞技场 数据组件 +// /竞技场 数据组件 type modelArena struct { modules.MCompModel module *Arena } -//组件初始化接口 +// 组件初始化接口 func (this *modelArena) Init(service core.IService, module core.IModule, comp core.IModuleComp, opt core.IModuleOptions) (err error) { this.TableName = comm.TableArena this.MCompModel.Init(service, module, comp, opt) @@ -48,7 +48,7 @@ func (this *modelArena) Init(service core.IService, module core.IModule, comp co return } -//查询用户装备数据 +// 查询用户装备数据 func (this *modelArena) queryPlayerInfo(uId string) (result *pb.DBArenaUser, err error) { result = &pb.DBArenaUser{} if err = this.Get(uId, result); err != nil && err != mgo.MongodbNil { @@ -58,7 +58,7 @@ func (this *modelArena) queryPlayerInfo(uId string) (result *pb.DBArenaUser, err return } -//查询用户装备数据 +// 查询用户装备数据 func (this *modelArena) queryPlayers(uIds []string) (result []*pb.DBArenaUser, err error) { result = make([]*pb.DBArenaUser, 0) if _, err = this.Gets(uIds, &result); err != nil && err != mgo.MongodbNil { @@ -68,7 +68,7 @@ func (this *modelArena) queryPlayers(uIds []string) (result []*pb.DBArenaUser, e return } -//查询用户装备数据 +// 查询用户装备数据 func (this *modelArena) queryArenaPlayer(uId string) (result *pb.ArenaPlayer, err error) { temp := &pb.DBArenaUser{} if err = this.Get(uId, temp); err != nil { @@ -88,7 +88,7 @@ func (this *modelArena) queryArenaPlayer(uId string) (result *pb.ArenaPlayer, er return } -//查询用户英雄数据 +// 查询用户英雄数据 func (this *modelArena) queryUserHeros(uid string, heroids []string) (results []*pb.DBHero, err error) { var ( model *db.DBModel @@ -105,7 +105,7 @@ func (this *modelArena) queryUserHeros(uid string, heroids []string) (results [] return } -///保存用户竞技场信息 +// /保存用户竞技场信息 func (this *modelArena) updateArenaUserInfo(info *pb.DBArenaUser) (err error) { var ( dan int32 @@ -131,6 +131,8 @@ func (this *modelArena) updateArenaUserInfo(info *pb.DBArenaUser) (err error) { "defendtotaluum": info.Defendtotaluum, "loc": []float64{float64(dan), float64(rand.Int31n(100)) / 1000.0}, "isdef": info.Isdef, + "name": info.Name, + "avatar": info.Avatar, "lv": info.Lv, }) return @@ -195,7 +197,7 @@ func (this *modelArena) computedan(integral int32) (dan int32, err error) { // return // } -//匹配机器人 +// 匹配机器人 func (this *modelArena) matcheAI(dan, num int32) (results []*pb.ArenaPlayer, err error) { var ( active *cfg.GameArenaActiveRewardData @@ -276,7 +278,7 @@ func (this *modelArena) matcheAI(dan, num int32) (results []*pb.ArenaPlayer, err return } -//获取目标去陪数据 +// 获取目标去陪数据 func (this *modelArena) matchePlayer(uid string, dan, num int32) (results []*pb.ArenaPlayer, err error) { var ( cursor *mongo.Cursor @@ -317,7 +319,7 @@ func (this *modelArena) matchePlayer(uid string, dan, num int32) (results []*pb. return } -//随机用户名 +// 随机用户名 func (this *modelArena) randUserName() string { var s = []byte("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890!@#$%^&*") r := rand.New(rand.NewSource(configure.Now().UnixNano() + rand.Int63n(10000))) @@ -377,7 +379,7 @@ func (this *modelArena) getAI(mformatId int32) (ai *pb.ArenaPlayer, err error) { return } -//积分计算 +// 积分计算 func (this *modelArena) integralCompute(red, bule *pb.ArenaPlayer, iswin bool) { var ( redactive *cfg.GameArenaActiveRewardData