狩猎只有挑战新关卡才写排行

This commit is contained in:
meixiongfeng 2022-09-09 18:13:24 +08:00
parent 96c9013e08
commit dbba6a9af9
2 changed files with 21 additions and 5 deletions

View File

@ -63,9 +63,20 @@ func (this *apiComp) ChallengeOver(session comm.IUserSession, req *pb.HuntingCha
}
hunting.Boss[req.BossType] += 1
mapData["boss"] = hunting.Boss
//hunting.BossTime[] = 0 // todo 耗时
mapData["challengeTime"] = hunting.BossTime
this.module.modulerank.updatehuntingRankList(session, req.Difficulty, req.BossType)
if req.Report != nil && len(req.Report.Info.Redflist) > 0 {
sz := make([]*pb.LineUp, 5)
for i, v := range req.Report.Info.Redflist[0].Team {
if v != nil {
sz[i] = &pb.LineUp{
Cid: v.HeroID,
Star: v.Star,
Lv: v.Lv,
}
}
}
this.module.modulerank.updatehuntingRankList(session, req.Difficulty, req.BossType, req.Report.Info.Redflist[0].Leadpos, sz)
}
}
// 耗时校验 当前战斗胜利时间消耗小于之前刷新数据
hunting.ChallengeCount++

View File

@ -60,7 +60,7 @@ func (this *ModelRank) getHuntingRankList(uid string) []*pb.DBHuntingRank {
return ranks
}
func (this *ModelRank) updatehuntingRankList(session comm.IUserSession, difficulty int32, boosType int32) {
func (this *ModelRank) updatehuntingRankList(session comm.IUserSession, difficulty int32, boosType int32, Leadpos int32, line []*pb.LineUp) {
// 查询是不是更新数据
ranks := this.getHuntingRankList(session.GetUserId())
bfind := false
@ -69,6 +69,9 @@ func (this *ModelRank) updatehuntingRankList(session comm.IUserSession, difficul
mapRankData := make(map[string]interface{}, 0)
mapRankData["difficulty"] = difficulty
mapRankData["bosstype"] = boosType
mapRankData["Leadpos"] = Leadpos
mapRankData["line"] = line
mapRankData["costTime"] = 123
this.ChangeUserRank(session.GetUserId(), v.Id, mapRankData)
bfind = true
break
@ -76,7 +79,7 @@ func (this *ModelRank) updatehuntingRankList(session comm.IUserSession, difficul
}
if !bfind {
userinfo := this.moduleHunting.ModuleUser.GetUser(session.GetUserId())
new := &pb.DBHuntingRank{
new := &pb.DBVikingRank{
Id: primitive.NewObjectID().Hex(),
Uid: session.GetUserId(),
Difficulty: difficulty,
@ -84,7 +87,9 @@ func (this *ModelRank) updatehuntingRankList(session comm.IUserSession, difficul
Nickname: userinfo.Name,
Icon: "",
Lv: userinfo.Lv,
CostTime: 111,
Leadpos: Leadpos,
Line: line,
CostTime: 12,
}
this.AddList(session.GetUserId(), new.Id, new)
}