Commit 664229f02cb73bd38132281c48a9b2a5ed94306b
1 parent
a280539c
Exists in
master
提交
Showing
2 changed files
with
15 additions
and
8 deletions
Show diff stats
src/HttpServer/logic/function.go
@@ -668,11 +668,11 @@ func (u *UserData) SetDuboCatPos(catlv int) { | @@ -668,11 +668,11 @@ func (u *UserData) SetDuboCatPos(catlv int) { | ||
668 | } | 668 | } |
669 | 669 | ||
670 | //设置红包猫 | 670 | //设置红包猫 |
671 | -func (u *UserData) SetRedCatPos(catlv, time int, redpack float32, starttime int) { | 671 | +func (u *UserData) SetRedCatPos(catlv, time int, redpack float32, starttime int) bool { |
672 | pos := getCatPutPos(u, catlv) | 672 | pos := getCatPutPos(u, catlv) |
673 | if pos < 0 || pos >= len(u.PosInfo) { | 673 | if pos < 0 || pos >= len(u.PosInfo) { |
674 | logger.Error("CleadPos failed pos=%v,posinfo=%v", pos, u.PosInfo) | 674 | logger.Error("CleadPos failed pos=%v,posinfo=%v", pos, u.PosInfo) |
675 | - return | 675 | + return false |
676 | } | 676 | } |
677 | 677 | ||
678 | u.PosInfo[pos].Cat = catlv | 678 | u.PosInfo[pos].Cat = catlv |
@@ -680,6 +680,7 @@ func (u *UserData) SetRedCatPos(catlv, time int, redpack float32, starttime int) | @@ -680,6 +680,7 @@ func (u *UserData) SetRedCatPos(catlv, time int, redpack float32, starttime int) | ||
680 | u.PosInfo[pos].StartTime = starttime | 680 | u.PosInfo[pos].StartTime = starttime |
681 | u.PosInfo[pos].RedPacket = redpack | 681 | u.PosInfo[pos].RedPacket = redpack |
682 | u.PosInfo[pos].Time = time | 682 | u.PosInfo[pos].Time = time |
683 | + return true | ||
683 | } | 684 | } |
684 | 685 | ||
685 | //计算购买后猫箱子的位置,将箱子放到对应位置 返回值表示位置 -1表示失败都满了 | 686 | //计算购买后猫箱子的位置,将箱子放到对应位置 返回值表示位置 -1表示失败都满了 |
src/HttpServer/logic/logic.go
@@ -2941,14 +2941,14 @@ func HandlerTakeCatoutfromWareHouse(w http.ResponseWriter, data string, uuid int | @@ -2941,14 +2941,14 @@ func HandlerTakeCatoutfromWareHouse(w http.ResponseWriter, data string, uuid int | ||
2941 | if err != nil { | 2941 | if err != nil { |
2942 | logger.Error("HandlerTakeCatoutfromWareHouse json unmarshal failed=%v", err) | 2942 | logger.Error("HandlerTakeCatoutfromWareHouse json unmarshal failed=%v", err) |
2943 | resp.Code = 1 | 2943 | resp.Code = 1 |
2944 | - resp.Message = "json failed" | 2944 | + resp.Message = "服务器错误" |
2945 | break | 2945 | break |
2946 | } | 2946 | } |
2947 | udatastr, err := redishandler.GetRedisClient().HGet(redis.USER_WAREHOUSE_INFO, strconv.Itoa(uuid)) | 2947 | udatastr, err := redishandler.GetRedisClient().HGet(redis.USER_WAREHOUSE_INFO, strconv.Itoa(uuid)) |
2948 | if err != nil { | 2948 | if err != nil { |
2949 | logger.Info("HandlerTakeCatoutfromWareHouse failed err=%v", err) | 2949 | logger.Info("HandlerTakeCatoutfromWareHouse failed err=%v", err) |
2950 | resp.Code = 1 | 2950 | resp.Code = 1 |
2951 | - resp.Message = "get redis failed" | 2951 | + resp.Message = "服务器错误" |
2952 | break | 2952 | break |
2953 | } | 2953 | } |
2954 | udata := new(UserWareHouseData) | 2954 | udata := new(UserWareHouseData) |
@@ -2956,7 +2956,7 @@ func HandlerTakeCatoutfromWareHouse(w http.ResponseWriter, data string, uuid int | @@ -2956,7 +2956,7 @@ func HandlerTakeCatoutfromWareHouse(w http.ResponseWriter, data string, uuid int | ||
2956 | if err != nil { | 2956 | if err != nil { |
2957 | logger.Error("HandlerTakeCatoutfromWareHouse Unmarshal redis failed ") | 2957 | logger.Error("HandlerTakeCatoutfromWareHouse Unmarshal redis failed ") |
2958 | resp.Code = 1 | 2958 | resp.Code = 1 |
2959 | - resp.Message = "Unmarshal redis failed" | 2959 | + resp.Message = "服务器错误" |
2960 | break | 2960 | break |
2961 | } | 2961 | } |
2962 | 2962 | ||
@@ -2964,7 +2964,7 @@ func HandlerTakeCatoutfromWareHouse(w http.ResponseWriter, data string, uuid int | @@ -2964,7 +2964,7 @@ func HandlerTakeCatoutfromWareHouse(w http.ResponseWriter, data string, uuid int | ||
2964 | if err != nil || uinfo == nil { | 2964 | if err != nil || uinfo == nil { |
2965 | logger.Error("HandlerPutCattoWareHouse getuserinfo failed=%v", err) | 2965 | logger.Error("HandlerPutCattoWareHouse getuserinfo failed=%v", err) |
2966 | resp.Code = 1 | 2966 | resp.Code = 1 |
2967 | - resp.Message = "get userinfo failed" | 2967 | + resp.Message = "服务器错误" |
2968 | break | 2968 | break |
2969 | } | 2969 | } |
2970 | cid, _ := strconv.Atoi(rdata.CatId) | 2970 | cid, _ := strconv.Atoi(rdata.CatId) |
@@ -2972,12 +2972,18 @@ func HandlerTakeCatoutfromWareHouse(w http.ResponseWriter, data string, uuid int | @@ -2972,12 +2972,18 @@ func HandlerTakeCatoutfromWareHouse(w http.ResponseWriter, data string, uuid int | ||
2972 | if wpos == -1 { | 2972 | if wpos == -1 { |
2973 | logger.Error("HandlerTakeCatoutfromWareHouse wpos failed=%v", err) | 2973 | logger.Error("HandlerTakeCatoutfromWareHouse wpos failed=%v", err) |
2974 | resp.Code = 1 | 2974 | resp.Code = 1 |
2975 | - resp.Message = "wpos" | 2975 | + resp.Message = "没有正确的猫" |
2976 | break | 2976 | break |
2977 | } | 2977 | } |
2978 | winfo := udata.Info[wpos] | 2978 | winfo := udata.Info[wpos] |
2979 | 2979 | ||
2980 | - uinfo.SetRedCatPos(winfo.Warelv, winfo.Time, winfo.RedPacket, winfo.StartTime) | 2980 | + success := uinfo.SetRedCatPos(winfo.Warelv, winfo.Time, winfo.RedPacket, winfo.StartTime) |
2981 | + if !success { | ||
2982 | + logger.Error("HandlerTakeCatoutfromWareHouse wpos failed=%v", err) | ||
2983 | + resp.Code = 1 | ||
2984 | + resp.Message = "合成界面已满,请先整理置位" | ||
2985 | + break | ||
2986 | + } | ||
2981 | 2987 | ||
2982 | udata.Info[wpos].Warelv = 0 | 2988 | udata.Info[wpos].Warelv = 0 |
2983 | udata.Info[wpos].StartTime = 0 | 2989 | udata.Info[wpos].StartTime = 0 |