Commit a28e726b641450655386c09f3d8b209b05b76f49

Authored by 王家文
1 parent df9283a3
Exists in master and in 1 other branch dev-wjw

revert⏪️:配置奖励字符格式串还原

configs/confroomrank/config.go
... ... @@ -108,15 +108,15 @@ type RobotConfig struct {
108 108  
109 109 // RoomConfig 房间配置
110 110 type RoomConfig struct {
111   - Id int `json:"id"` // id
112   - Levels []int `json:"level_range"` // 等级范围
113   - UserClass int `json:"rating"` // 评级
114   - UserScore []int `json:"score_range"` // 分数范围
115   - TotalPlayer int `json:"room_user_number"` // 房间总人数
116   - PlayerTypeCount [][]int `json:"user_type_number"` // 玩家类型数量
117   - AutoRobot []int `json:"auto_room"` // 自动填充机器人
118   - InitRobot [][]int `json:"disposition_robots"` // 配置机器人
119   - Awards []string `json:"rewards"` // 奖励
120   - SettleScores []int `json:"score_adjest"` // 结算分数调整
121   - SettleUserType []int `json:"user_type"` // 结算用户类型
  111 + Id int `json:"id"` // id
  112 + Levels []int `json:"level_range"` // 等级范围
  113 + UserClass int `json:"rating"` // 评级
  114 + UserScore []int `json:"score_range"` // 分数范围
  115 + TotalPlayer int `json:"room_user_number"` // 房间总人数
  116 + PlayerTypeCount [][]int `json:"user_type_number"` // 玩家类型数量
  117 + AutoRobot []int `json:"auto_room"` // 自动填充机器人
  118 + InitRobot [][]int `json:"disposition_robots"` // 配置机器人
  119 + Awards map[string]string `json:"rewards"` // 奖励
  120 + SettleScores []int `json:"score_adjest"` // 结算分数调整
  121 + SettleUserType []int `json:"user_type"` // 结算用户类型
122 122 }
... ...
service/roomrank/logic.go
... ... @@ -3,6 +3,7 @@ package roomrank
3 3 import (
4 4 "apigame/configs/confroomrank"
5 5 "apigame/service-common/svconst"
  6 + "apigame/util/utstring"
6 7 "apigame/util/zjson"
7 8 "fmt"
8 9 )
... ... @@ -50,8 +51,8 @@ func TrySettle(gameId string, topType int, player *Player, config *confroomrank.
50 51 if !hasConfRoom {
51 52 return
52 53 }
53   - if len(confRoom.Awards) > rankIndex {
54   - player.SettleAward = confRoom.Awards[rankIndex]
  54 + if confAward, hasConfAward := confRoom.Awards[utstring.IntToString(player.SettleRank)]; hasConfAward {
  55 + player.SettleAward = confAward
55 56 }
56 57 if len(confRoom.SettleScores) > rankIndex {
57 58 player.AddUserScore(confRoom.SettleScores[rankIndex])
... ...
service/roomrank/player.go
... ... @@ -7,6 +7,7 @@ import (
7 7 "apigame/service-common/svmysql"
8 8 "apigame/util/util-lx/lxalilog"
9 9 "apigame/util/util-lx/lxtime"
  10 + "apigame/util/utstring"
10 11 "math/rand"
11 12 )
12 13  
... ... @@ -100,8 +101,8 @@ func GetInfoFromRoom(player *Player, room *Room, config *confroomrank.ActivityCo
100 101 Icon: p.Icon,
101 102 }
102 103 if confRoom, hasConfRoom := config.Room[room.ConfigId]; hasConfRoom {
103   - if len(confRoom.Awards) > i {
104   - node.Award = confRoom.Awards[i]
  104 + if confAward, hasConfAward := confRoom.Awards[utstring.IntToString(rank)]; hasConfAward {
  105 + node.Award = confAward
105 106 }
106 107 }
107 108 if player.Uid == p.Uid {
... ...