Commit dd4d741eec41021349747d1b8cc2face1a2a27b4
1 parent
504fbd44
Exists in
master
提交
Showing
3 changed files
with
35 additions
and
1 deletions
Show diff stats
src/HttpServer/logic/datadef.go
... | ... | @@ -959,6 +959,7 @@ type UserData struct { |
959 | 959 | FlyBoxNumTimes int //生意飞天宝箱次数 |
960 | 960 | LeftOfflineTimes int //离线奖励剩余领取次数 |
961 | 961 | EmptyBoxLeftTime int //空格宝箱生意领取次数 |
962 | + WaitFetchList []LimitListDesc //待领取的分红猫列表 领取完删除 | |
962 | 963 | CatShopInfo CatShopData //猫咖门店数据 |
963 | 964 | Taskinfo TaskData //任务数据 |
964 | 965 | AchieveMent AchieveMentData //成就数据 | ... | ... |
src/HttpServer/logic/function.go
... | ... | @@ -1022,6 +1022,9 @@ func (u *UserData) CalcHigestCatName() string { |
1022 | 1022 | func (u *UserData) GetRedCatIdList() []LimitListDesc { |
1023 | 1023 | var rtsl []LimitListDesc |
1024 | 1024 | nowtime := int(time.Now().Unix()) |
1025 | + | |
1026 | + rtsl = append(rtsl, u.WaitFetchList...) | |
1027 | + | |
1025 | 1028 | for _, val := range u.PosInfo { |
1026 | 1029 | if val.Cat > REDCATIDEXTRA && val.Cat < BOXGIFTEXTRA { |
1027 | 1030 | //是红包猫并且是有时间的并且时间到了 |
... | ... | @@ -1034,6 +1037,9 @@ func (u *UserData) GetRedCatIdList() []LimitListDesc { |
1034 | 1037 | rtsl = append(rtsl, tmp) |
1035 | 1038 | //需要删除 |
1036 | 1039 | u.CleadPos(val.Position) |
1040 | + | |
1041 | + //加入待领取列表 | |
1042 | + u.WaitFetchList = append(u.WaitFetchList, tmp) | |
1037 | 1043 | } |
1038 | 1044 | } |
1039 | 1045 | ... | ... |
src/HttpServer/logic/logic.go
... | ... | @@ -1735,6 +1735,22 @@ func HandlerRecvRedCat(w http.ResponseWriter, data string, uuid int) { |
1735 | 1735 | break |
1736 | 1736 | } |
1737 | 1737 | |
1738 | + //从待领取列表删除 | |
1739 | + idx := -1 | |
1740 | + for i := 0; i < len(uinfo.WaitFetchList); i++ { | |
1741 | + if uinfo.WaitFetchList[i].Cat == rdata.RedCatId { | |
1742 | + idx = i | |
1743 | + break | |
1744 | + } | |
1745 | + } | |
1746 | + | |
1747 | + if idx == -1 { | |
1748 | + logger.Error("HandlerRecvRedCat idx failed=%v", rdata) | |
1749 | + resp.Code = 1 | |
1750 | + resp.Message = "没有可领取的分红猫" | |
1751 | + break | |
1752 | + } | |
1753 | + | |
1738 | 1754 | //先判断位置 |
1739 | 1755 | /*cpos := uinfo.GetCatPos(rdata.RedCatId) |
1740 | 1756 | if cpos == -1 { |
... | ... | @@ -1770,7 +1786,18 @@ func HandlerRecvRedCat(w http.ResponseWriter, data string, uuid int) { |
1770 | 1786 | addredpack = addredpack * 2 |
1771 | 1787 | } |
1772 | 1788 | |
1773 | - uinfo.AddRedPackect(addredpack, 100) | |
1789 | + _, err = uinfo.AddRedPackect(addredpack, 100) | |
1790 | + if err != nil { | |
1791 | + logger.Error("AddRedPackect failed") | |
1792 | + resp.Code = 1 | |
1793 | + resp.Message = "获取红包失败" | |
1794 | + break | |
1795 | + } | |
1796 | + | |
1797 | + if idx != -1 { | |
1798 | + uinfo.WaitFetchList = append(uinfo.WaitFetchList[:idx], uinfo.WaitFetchList[idx+1:]...) | |
1799 | + } | |
1800 | + //删除待领取 | |
1774 | 1801 | //uinfo.CleadPos(cpos) |
1775 | 1802 | |
1776 | 1803 | uinfo.CalcGoldRate() | ... | ... |