上传初始段位生成

This commit is contained in:
liwei1dao 2022-10-26 10:00:14 +08:00
parent c21fd71eb1
commit 6f70a0bb9d
2 changed files with 20 additions and 6 deletions

View File

@ -53,6 +53,10 @@ func (this *apiComp) Info(session comm.IUserSession, req *pb.ArenaInfoReq) (code
Ticket: 10,
Record: make([]*pb.DBArenaBattleRecord, 0),
}
if info.Dan, err = this.module.modelArena.computedan(info.Integral); err != nil {
code = pb.ErrorCode_ConfigNoFound
return
}
if err = this.module.modelArena.Add(session.GetUserId(), info); err != nil {
this.module.Errorln(err)
}

View File

@ -85,17 +85,14 @@ func (this *modelArena) queryUserHeros(uid string, heroids []string) (results []
///保存用户竞技场信息
func (this *modelArena) updateArenaUserInfo(info *pb.DBArenaUser) (err error) {
var (
active *cfg.GameArenaActiveRewardData
dan int32
)
if active, err = this.module.configure.getActiveReward(info.Integral); err != nil {
this.module.Errorln(err)
if dan, err = this.computedan(info.Integral); err != nil {
return
}
this.Change(info.Uid, map[string]interface{}{
"integral": info.Integral,
"dan": active.LvId,
"dan": dan,
"attack": info.Attack,
"defend": info.Defend,
"streak": info.Streak,
@ -103,6 +100,19 @@ func (this *modelArena) updateArenaUserInfo(info *pb.DBArenaUser) (err error) {
return
}
func (this *modelArena) computedan(integral int32) (dan int32, err error) {
var (
active *cfg.GameArenaActiveRewardData
)
if active, err = this.module.configure.getActiveReward(integral); err != nil {
this.module.Errorln(err)
return
}
dan = active.LvId
return
}
//获取目标去陪数据
// func (this *modelArena) matchePlayer(integral int32) (results []*pb.DBArenaUser, err error) {
// var (