Commit ad05276e7d9b3efcf465b3e162626fbb73e22367
1 parent
b4816ad6
Exists in
master
提交
Showing
2 changed files
with
18 additions
and
0 deletions
Show diff stats
src/HttpServer/logic/function.go
@@ -316,6 +316,16 @@ func (u *UserData) GetLimitCatList() []int { | @@ -316,6 +316,16 @@ func (u *UserData) GetLimitCatList() []int { | ||
316 | return rtlist | 316 | return rtlist |
317 | } | 317 | } |
318 | 318 | ||
319 | +//查询是否有空位 | ||
320 | +func (u *UserData) HasEmptyPos() bool { | ||
321 | + for _, v := range u.PosInfo { | ||
322 | + if v.Cat == 0 { | ||
323 | + return true | ||
324 | + } | ||
325 | + } | ||
326 | + return false | ||
327 | +} | ||
328 | + | ||
319 | //根据猫等级获得位置 | 329 | //根据猫等级获得位置 |
320 | func (u *UserData) GetCatPos(catlv int) int { | 330 | func (u *UserData) GetCatPos(catlv int) int { |
321 | pos := -1 | 331 | pos := -1 |
src/HttpServer/logic/logic.go
@@ -1499,6 +1499,14 @@ func HandlerDoFlop(w http.ResponseWriter, data string, uuid int) { | @@ -1499,6 +1499,14 @@ func HandlerDoFlop(w http.ResponseWriter, data string, uuid int) { | ||
1499 | break | 1499 | break |
1500 | } | 1500 | } |
1501 | 1501 | ||
1502 | + //判断下是否有位置 | ||
1503 | + if !uinfo.HasEmptyPos() { | ||
1504 | + logger.Error("HandlerDoFlop flopcnt failed=%v", err) | ||
1505 | + resp.Code = 1 | ||
1506 | + resp.Message = "请尽快合成或回收猫咪为分红猫腾出位置" | ||
1507 | + break | ||
1508 | + } | ||
1509 | + | ||
1502 | uinfo.DoFlopCardd(&resp) | 1510 | uinfo.DoFlopCardd(&resp) |
1503 | 1511 | ||
1504 | resp.Code = 0 | 1512 | resp.Code = 0 |