diff --git a/configs/confroomrank/config.go b/configs/confroomrank/config.go index 428a0e7..2cf5326 100644 --- a/configs/confroomrank/config.go +++ b/configs/confroomrank/config.go @@ -108,15 +108,15 @@ type RobotConfig struct { // RoomConfig 房间配置 type RoomConfig struct { - Id int `json:"id"` // id - Levels []int `json:"level_range"` // 等级范围 - UserClass int `json:"rating"` // 评级 - UserScore []int `json:"score_range"` // 分数范围 - TotalPlayer int `json:"room_user_number"` // 房间总人数 - PlayerTypeCount [][]int `json:"user_type_number"` // 玩家类型数量 - AutoRobot []int `json:"auto_room"` // 自动填充机器人 - InitRobot [][]int `json:"disposition_robots"` // 配置机器人 - Awards map[string]string `json:"rewards"` // 奖励 - SettleScores []int `json:"score_adjest"` // 结算分数调整 - SettleUserType []int `json:"user_type"` // 结算用户类型 + Id int `json:"id"` // id + Levels []int `json:"level_range"` // 等级范围 + UserClass int `json:"rating"` // 评级 + UserScore []int `json:"score_range"` // 分数范围 + TotalPlayer int `json:"room_user_number"` // 房间总人数 + PlayerTypeCount [][]int `json:"user_type_number"` // 玩家类型数量 + AutoRobot []int `json:"auto_room"` // 自动填充机器人 + InitRobot [][]int `json:"disposition_robots"` // 配置机器人 + Awards []string `json:"rewards"` // 奖励 + SettleScores []int `json:"score_adjest"` // 结算分数调整 + SettleUserType []int `json:"user_type"` // 结算用户类型 } diff --git a/service/roomrank/logic.go b/service/roomrank/logic.go index ab91bfd..f0491a4 100644 --- a/service/roomrank/logic.go +++ b/service/roomrank/logic.go @@ -3,7 +3,6 @@ package roomrank import ( "apigame/configs/confroomrank" "apigame/service-common/svconst" - "apigame/util/utstring" "apigame/util/zjson" "fmt" ) @@ -51,8 +50,8 @@ func TrySettle(gameId string, topType int, player *Player, config *confroomrank. if !hasConfRoom { return } - if confAward, hasConfAward := confRoom.Awards[utstring.IntToString(player.SettleRank)]; hasConfAward { - player.SettleAward = confAward + if len(confRoom.Awards) > rankIndex { + player.SettleAward = confRoom.Awards[rankIndex] } if len(confRoom.SettleScores) > rankIndex { player.AddUserScore(confRoom.SettleScores[rankIndex]) diff --git a/service/roomrank/player.go b/service/roomrank/player.go index 8cc74b0..58ac2df 100644 --- a/service/roomrank/player.go +++ b/service/roomrank/player.go @@ -7,7 +7,6 @@ import ( "apigame/service-common/svmysql" "apigame/util/util-lx/lxalilog" "apigame/util/util-lx/lxtime" - "apigame/util/utstring" "math/rand" ) @@ -101,8 +100,8 @@ func GetInfoFromRoom(player *Player, room *Room, config *confroomrank.ActivityCo Icon: p.Icon, } if confRoom, hasConfRoom := config.Room[room.ConfigId]; hasConfRoom { - if confAward, hasConfAward := confRoom.Awards[utstring.IntToString(rank)]; hasConfAward { - node.Award = confAward + if len(confRoom.Awards) > i { + node.Award = confRoom.Awards[i] } } if player.Uid == p.Uid { -- libgit2 0.21.0