Commit 81a9e55a289840f02a5eace1e36df313daf6ffe1
1 parent
3bbdc302
Exists in
master
and in
1 other branch
fix🐛:配置错误时给出提示
Showing
2 changed files
with
15 additions
and
15 deletions
Show diff stats
configs/confbase/external.go
| ... | ... | @@ -85,7 +85,7 @@ func GetCurrent[T1 IConfData, T2 IConfRawData](gameId string, obj T1) bool { |
| 85 | 85 | } else { |
| 86 | 86 | has = GetConfig[T1, T2](gameId, currentId, obj) |
| 87 | 87 | if has { |
| 88 | - if obj.CheckCurrent() { | |
| 88 | + if !obj.CheckCurrent() { | |
| 89 | 89 | hasFind = FindDuringTime[T1, T2](obj, confRaw, gameId) |
| 90 | 90 | } |
| 91 | 91 | } else { | ... | ... |
service/roomrank/handle.go
| ... | ... | @@ -6,7 +6,6 @@ import ( |
| 6 | 6 | "apigame/service-common/svmysql" |
| 7 | 7 | "apigame/service/code-msg" |
| 8 | 8 | "apigame/util/zredislock" |
| 9 | - "fmt" | |
| 10 | 9 | ) |
| 11 | 10 | |
| 12 | 11 | // HandleGetConfig 活动配置 |
| ... | ... | @@ -83,17 +82,15 @@ func HandleInfo(req *models.ReqRoomRankInfo) (code string, rsp models.RspRoomRan |
| 83 | 82 | // 尝试加入房间 |
| 84 | 83 | room, hasRoom := TryGetRoom(gameId, player, config, playerLevel) |
| 85 | 84 | |
| 86 | - if hasRoom { | |
| 87 | - TryReSort(room, config) | |
| 88 | - | |
| 89 | - SavePlayer(gameId, player) | |
| 90 | - SaveRoom(gameId, room) | |
| 85 | + if !hasRoom { | |
| 86 | + code = code_msg.RECODE_MERGE_CONFIG_ERROR | |
| 87 | + return | |
| 91 | 88 | } |
| 92 | - | |
| 89 | + TryReSort(room, config) | |
| 90 | + SavePlayer(gameId, player) | |
| 91 | + SaveRoom(gameId, room) | |
| 93 | 92 | rsp.RoomRankInfo = GetInfoFromRoom(player, room) |
| 94 | 93 | |
| 95 | - fmt.Println("dwjw🐸 len(room.Details.Players) 1:", len(room.Details.Players)) | |
| 96 | - | |
| 97 | 94 | return |
| 98 | 95 | } |
| 99 | 96 | |
| ... | ... | @@ -138,6 +135,8 @@ func HandleGetSettleAward(req *models.ReqRoomRankGetSettleAward) (code string, r |
| 138 | 135 | rsp.AwardText = player.SettleAward |
| 139 | 136 | player.SettleHas = false |
| 140 | 137 | player.SettleAward = "" |
| 138 | + player.ActivityId = config.Id | |
| 139 | + player.RoomUid = 0 | |
| 141 | 140 | SavePlayer(gameId, player) |
| 142 | 141 | |
| 143 | 142 | // 记录日志 |
| ... | ... | @@ -202,12 +201,13 @@ func HandleAddScore(req *models.ReqRoomRankAddScore) (code string, rsp models.Rs |
| 202 | 201 | // 房间排行增加积分 |
| 203 | 202 | oldScore, newScore := ChangePlayerScore(room, player, req.AddScore) |
| 204 | 203 | |
| 205 | - if hasRoom { | |
| 206 | - TryReSort(room, config) | |
| 207 | - | |
| 208 | - SavePlayer(gameId, player) | |
| 209 | - SaveRoom(gameId, room) | |
| 204 | + if !hasRoom { | |
| 205 | + code = code_msg.RECODE_MERGE_CONFIG_ERROR | |
| 206 | + return | |
| 210 | 207 | } |
| 208 | + TryReSort(room, config) | |
| 209 | + SavePlayer(gameId, player) | |
| 210 | + SaveRoom(gameId, room) | |
| 211 | 211 | |
| 212 | 212 | rsp.RoomRankInfo = GetInfoFromRoom(player, room) |
| 213 | 213 | ... | ... |