Commit 1f50c8d9638b387d11c7d2c13e5c552bd544a4b8

Authored by 王家文
1 parent 46e54ae7
Exists in master

fix:房间排行最大评级修改

service/roomrank/dto-player.go
@@ -57,10 +57,10 @@ func (d *Player) Init(uid int64, topType int) { @@ -57,10 +57,10 @@ func (d *Player) Init(uid int64, topType int) {
57 d.CreateTime = lxtime.NowUninx() 57 d.CreateTime = lxtime.NowUninx()
58 } 58 }
59 59
60 -func (d *Player) AddUserScore(count int) { 60 +func (d *Player) AddUserScore(count int, userClassMax int) {
61 d.UserScore += count 61 d.UserScore += count
62 userScoreMin := UserClassMin * 10 62 userScoreMin := UserClassMin * 10
63 - userScoreMax := UserClassMax*10 + 20 63 + userScoreMax := userClassMax*10 + 20
64 if d.UserScore < userScoreMin { 64 if d.UserScore < userScoreMin {
65 d.UserScore = userScoreMin 65 d.UserScore = userScoreMin
66 } 66 }
@@ -71,8 +71,8 @@ func (d *Player) AddUserScore(count int) { @@ -71,8 +71,8 @@ func (d *Player) AddUserScore(count int) {
71 if d.UserClass < UserClassMin { 71 if d.UserClass < UserClassMin {
72 d.UserClass = UserClassMin 72 d.UserClass = UserClassMin
73 } 73 }
74 - if d.UserClass > UserClassMax {  
75 - d.UserClass = UserClassMax 74 + if d.UserClass > userClassMax {
  75 + d.UserClass = userClassMax
76 } 76 }
77 } 77 }
78 78
service/roomrank/logic.go
@@ -42,6 +42,19 @@ func GetTimeEnd(activityTime int64, releaseTime string) time.Time { @@ -42,6 +42,19 @@ func GetTimeEnd(activityTime int64, releaseTime string) time.Time {
42 return dt 42 return dt
43 } 43 }
44 44
  45 +func GetUserClassMax(config *confroomrank.ActivityConfig) int {
  46 + c := 0
  47 + for _, roomConfig := range config.Room {
  48 + if roomConfig.UserClass > c {
  49 + c = roomConfig.UserClass
  50 + }
  51 + }
  52 + if c < 1 {
  53 + c = 1
  54 + }
  55 + return c
  56 +}
  57 +
45 // TrySettle 尝试判断结算 58 // TrySettle 尝试判断结算
46 func TrySettle(gameId string, topType int, player *Player) (hasChange bool) { 59 func TrySettle(gameId string, topType int, player *Player) (hasChange bool) {
47 hasChange = false 60 hasChange = false
@@ -95,7 +108,8 @@ func TrySettle(gameId string, topType int, player *Player) (hasChange bool) { @@ -95,7 +108,8 @@ func TrySettle(gameId string, topType int, player *Player) (hasChange bool) {
95 player.SettleAward = confAward 108 player.SettleAward = confAward
96 } 109 }
97 if len(confRoom.SettleScores) > rankIndex { 110 if len(confRoom.SettleScores) > rankIndex {
98 - player.AddUserScore(confRoom.SettleScores[rankIndex]) 111 + userClassMax := GetUserClassMax(confActivity)
  112 + player.AddUserScore(confRoom.SettleScores[rankIndex], userClassMax)
99 player.SettleUserClass = player.UserClass 113 player.SettleUserClass = player.UserClass
100 } 114 }
101 if len(confRoom.SettleUserType) > rankIndex { 115 if len(confRoom.SettleUserType) > rankIndex {