Commit b71bf2ea09961b1507ad9d206b09b2424614e620
1 parent
fa43e8b2
Exists in
master
提交
Showing
2 changed files
with
29 additions
and
0 deletions
Show diff stats
src/HttpServer/logic/function.go
... | ... | @@ -211,6 +211,27 @@ func (u *UserData) CalcRandRedBagNum() float32 { |
211 | 211 | return addnum |
212 | 212 | } |
213 | 213 | |
214 | +//计算主界面猫的数量 包含37级猫 | |
215 | +func (u *UserData) CalcMainCatNum() int { | |
216 | + var sumnum int | |
217 | + for _, v := range u.PosInfo { | |
218 | + if v.Cat < REDCATIDEXTRA { | |
219 | + sumnum++ | |
220 | + } | |
221 | + | |
222 | + if v.Cat > REDCATIDEXTRA && v.Cat < BOXGIFTEXTRA { | |
223 | + cfg := jsonconf.GetRedCatConfig(v.Cat) | |
224 | + if cfg != nil { | |
225 | + if cfg.Is_37 == 1 { | |
226 | + sumnum++ | |
227 | + } | |
228 | + } | |
229 | + } | |
230 | + } | |
231 | + | |
232 | + return sumnum | |
233 | +} | |
234 | + | |
214 | 235 | //加红包接口 |
215 | 236 | func (u *UserData) AddRedPackect(num float32, atype int) (int, error) { |
216 | 237 | SERVERKEY := conf.GetCoinConf().Key | ... | ... |
src/HttpServer/logic/logic.go
... | ... | @@ -2016,6 +2016,14 @@ func HandlerRecovery(w http.ResponseWriter, data string, uuid int) { |
2016 | 2016 | break |
2017 | 2017 | } |
2018 | 2018 | |
2019 | + catnum := uinfo.CalcMainCatNum() | |
2020 | + if catnum <= 1 { | |
2021 | + logger.Error("HandlerRecovery CatLV failed=%v", err) | |
2022 | + resp.Code = 1 | |
2023 | + resp.Message = "当前只有一只猫咪无法回收!" | |
2024 | + break | |
2025 | + } | |
2026 | + | |
2019 | 2027 | cfg := jsonconf.GetCatConfig(uinfo.PosInfo[rdata.Position].Cat) |
2020 | 2028 | if cfg == nil { |
2021 | 2029 | logger.Error("HandlerRecovery CatLVCFG failed=%v", uinfo.PosInfo[rdata.Position].Cat) | ... | ... |