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,15 +108,15 @@ type RobotConfig struct {
108 108
109 // RoomConfig 房间配置 109 // RoomConfig 房间配置
110 type RoomConfig struct { 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,6 +3,7 @@ package roomrank
3 import ( 3 import (
4 "apigame/configs/confroomrank" 4 "apigame/configs/confroomrank"
5 "apigame/service-common/svconst" 5 "apigame/service-common/svconst"
  6 + "apigame/util/utstring"
6 "apigame/util/zjson" 7 "apigame/util/zjson"
7 "fmt" 8 "fmt"
8 ) 9 )
@@ -50,8 +51,8 @@ func TrySettle(gameId string, topType int, player *Player, config *confroomrank. @@ -50,8 +51,8 @@ func TrySettle(gameId string, topType int, player *Player, config *confroomrank.
50 if !hasConfRoom { 51 if !hasConfRoom {
51 return 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 if len(confRoom.SettleScores) > rankIndex { 57 if len(confRoom.SettleScores) > rankIndex {
57 player.AddUserScore(confRoom.SettleScores[rankIndex]) 58 player.AddUserScore(confRoom.SettleScores[rankIndex])
service/roomrank/player.go
@@ -7,6 +7,7 @@ import ( @@ -7,6 +7,7 @@ import (
7 "apigame/service-common/svmysql" 7 "apigame/service-common/svmysql"
8 "apigame/util/util-lx/lxalilog" 8 "apigame/util/util-lx/lxalilog"
9 "apigame/util/util-lx/lxtime" 9 "apigame/util/util-lx/lxtime"
  10 + "apigame/util/utstring"
10 "math/rand" 11 "math/rand"
11 ) 12 )
12 13
@@ -100,8 +101,8 @@ func GetInfoFromRoom(player *Player, room *Room, config *confroomrank.ActivityCo @@ -100,8 +101,8 @@ func GetInfoFromRoom(player *Player, room *Room, config *confroomrank.ActivityCo
100 Icon: p.Icon, 101 Icon: p.Icon,
101 } 102 }
102 if confRoom, hasConfRoom := config.Room[room.ConfigId]; hasConfRoom { 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 if player.Uid == p.Uid { 108 if player.Uid == p.Uid {