Commit f1f886fcde76469d9d80cd82d495bfef9dac5439
1 parent
044c1035
Exists in
master
and in
1 other branch
feat✨:房间排行活动:等级判断
Showing
2 changed files
with
14 additions
and
1 deletions
Show diff stats
service/code-msg/code-msg.go
| ... | ... | @@ -50,6 +50,7 @@ const ( |
| 50 | 50 | RECODE_MERGE_CARDHOLDER_NOAUTOEXCHANGEINFO_ERROR = "2107" |
| 51 | 51 | |
| 52 | 52 | RECODE_MERGE_ROOMRANK_NOTOPEN_ERROR = "2200" |
| 53 | + RECODE_MERGE_ROOMRANK_LEVEL_ERROR = "2201" | |
| 53 | 54 | ) |
| 54 | 55 | |
| 55 | 56 | var recodeText = map[string]string{ |
| ... | ... | @@ -100,6 +101,7 @@ var recodeText = map[string]string{ |
| 100 | 101 | RECODE_MERGE_CARDHOLDER_NOAUTOEXCHANGEINFO_ERROR: "没有星星商店自动兑换信息", |
| 101 | 102 | |
| 102 | 103 | RECODE_MERGE_ROOMRANK_NOTOPEN_ERROR: "活动未开放", |
| 104 | + RECODE_MERGE_ROOMRANK_LEVEL_ERROR: "参与等级不足", | |
| 103 | 105 | } |
| 104 | 106 | |
| 105 | 107 | func RecodeText(code string) string { | ... | ... |
service/roomrank/handle.go
| ... | ... | @@ -13,7 +13,11 @@ func HandleGetConfig(req *models.ReqRoomRankGetConfig) (code string, rsp models. |
| 13 | 13 | gameId := req.GameID |
| 14 | 14 | |
| 15 | 15 | // 尝试更新配置 |
| 16 | - config, _ := confroomrank.GetCurrent(gameId) | |
| 16 | + config, hasConfig := confroomrank.GetCurrent(gameId) | |
| 17 | + if !hasConfig { | |
| 18 | + code = code_msg.RECODE_MERGE_ROOMRANK_NOTOPEN_ERROR | |
| 19 | + return | |
| 20 | + } | |
| 17 | 21 | rsp.ActivityId = config.Id |
| 18 | 22 | |
| 19 | 23 | rsp.Config = config.Client |
| ... | ... | @@ -33,6 +37,13 @@ func HandleInfo(req *models.ReqRoomRankInfo) (code string, rsp models.RspRoomRan |
| 33 | 37 | config, hasConfig := confroomrank.GetCurrent(gameId) |
| 34 | 38 | if !hasConfig { |
| 35 | 39 | config = new(confroomrank.ActivityConfig) |
| 40 | + code = code_msg.RECODE_MERGE_ROOMRANK_NOTOPEN_ERROR | |
| 41 | + return | |
| 42 | + } | |
| 43 | + // 判断玩家等级 | |
| 44 | + if req.PlayerLevel < config.OpenLevel { | |
| 45 | + code = code_msg.RECODE_MERGE_ROOMRANK_LEVEL_ERROR | |
| 46 | + return | |
| 36 | 47 | } |
| 37 | 48 | |
| 38 | 49 | // 读取游戏数据 | ... | ... |