Commit 3e40caf368704bc0e9ce2abbcdf6e5f70f7fe31b
1 parent
10e3fb1a
Exists in
master
提交i
Showing
3 changed files
with
21 additions
and
7 deletions
Show diff stats
src/HttpServer/logic/datadef.go
... | ... | @@ -211,6 +211,7 @@ type FetchredbagReq struct { |
211 | 211 | } |
212 | 212 | |
213 | 213 | type FetchredbagData struct { |
214 | + Gunrednum int `json:"gunrednum"` | |
214 | 215 | Guanrednum int `json:"guanrednum"` |
215 | 216 | Timeredbagleft int `json:"timeredbagleft"` |
216 | 217 | Getgold int `json:"getgold"` |
... | ... | @@ -293,7 +294,7 @@ type UserData struct { |
293 | 294 | UpLvCostTime int //上一个等级升级时间 |
294 | 295 | UpLvCostTimeSec int //上一个等级升级的时间点时刻 |
295 | 296 | PassLevel int //当前关卡 |
296 | - BigLevel int //当前等级 | |
297 | + GunLevel int //当前枪最高等级 | |
297 | 298 | SpecialLevel int //特殊关卡 |
298 | 299 | GuanRedNum int //关卡红包领取进度 |
299 | 300 | JiRedNum int //等级红包领取进度 | ... | ... |
src/HttpServer/logic/function.go
... | ... | @@ -138,7 +138,7 @@ func HandlerSyncuserdata(w http.ResponseWriter, data string, uuid int) { |
138 | 138 | |
139 | 139 | resp.Data.Walletgold = data.RealGold |
140 | 140 | resp.Data.Nowtime = int(time.Now().Unix()) |
141 | - resp.Data.Curji = data.BigLevel | |
141 | + resp.Data.Curji = data.GunLevel | |
142 | 142 | resp.Data.Curlevel = data.PassLevel |
143 | 143 | resp.Data.Guanrednum = data.GuanRedNum |
144 | 144 | resp.Data.Jirednum = data.JiRedNum |
... | ... | @@ -533,7 +533,7 @@ func InitUserInfo(data *UserLoginReq, resp *UserLoginResp, uuid int, uniqueuid s |
533 | 533 | initdata.LeftFreeRB = FREE_REDBAG_NUM |
534 | 534 | initdata.UpLvCostTime = 0 |
535 | 535 | initdata.PassLevel = 1 |
536 | - initdata.BigLevel = 1 | |
536 | + initdata.GunLevel = 1 | |
537 | 537 | initdata.SpecialLevel = 0 |
538 | 538 | initdata.GuanRedNum = 0 |
539 | 539 | initdata.JiRedNum = 0 |
... | ... | @@ -581,7 +581,7 @@ func InitUserInfo(data *UserLoginReq, resp *UserLoginResp, uuid int, uniqueuid s |
581 | 581 | |
582 | 582 | //resp.Data.Leftredbagcnt = initdata.WatchAddsTime |
583 | 583 | resp.Data.Walletgold = initdata.RealGold |
584 | - resp.Data.Curji = initdata.BigLevel | |
584 | + resp.Data.Curji = initdata.GunLevel | |
585 | 585 | resp.Data.Curlevel = initdata.PassLevel |
586 | 586 | resp.Data.Guanrednum = initdata.GuanRedNum |
587 | 587 | resp.Data.Jirednum = initdata.JiRedNum | ... | ... |
src/HttpServer/logic/logic.go
... | ... | @@ -623,6 +623,13 @@ func HandlerFetchredbag(w http.ResponseWriter, data string, uuid int) { |
623 | 623 | if rdata.Rtype == 1 { |
624 | 624 | //等级红包 |
625 | 625 | |
626 | + if uinfo.JiRedNum >= uinfo.GunLevel { | |
627 | + logger.Error("HandlerFetchredbag failed err=%v", err) | |
628 | + resp.Message = "没有可以领取的等级红包" | |
629 | + resp.Code = 1 | |
630 | + break | |
631 | + } | |
632 | + | |
626 | 633 | cfg := jsonconf.GetGunLvRdNum(rdata.Param) |
627 | 634 | if cfg == nil { |
628 | 635 | logger.Error("HandlerFetchredbag failed err=%v", err) |
... | ... | @@ -643,6 +650,11 @@ func HandlerFetchredbag(w http.ResponseWriter, data string, uuid int) { |
643 | 650 | resp.Data.Getgold = addgold |
644 | 651 | resp.Data.Walletgold = realgold |
645 | 652 | |
653 | + | |
654 | + uinfo.JiRedNum ++ | |
655 | + | |
656 | + | |
657 | + | |
646 | 658 | }else if rdata.Rtype == 2 { |
647 | 659 | //关卡红包 |
648 | 660 | curprocess := (uinfo.PassLevel-1) / 3 |
... | ... | @@ -771,6 +783,7 @@ func HandlerFetchredbag(w http.ResponseWriter, data string, uuid int) { |
771 | 783 | |
772 | 784 | resp.Data.Timeredbagleft = uinfo.RandNum |
773 | 785 | resp.Data.Guanrednum = uinfo.GuanRedNum |
786 | + resp.Data.Gunrednum = uinfo.JiRedNum | |
774 | 787 | |
775 | 788 | resp.Code = 0 |
776 | 789 | break |
... | ... | @@ -849,8 +862,8 @@ func HandlerUploadbiglevel(w http.ResponseWriter, data string, uuid int) { |
849 | 862 | break |
850 | 863 | } |
851 | 864 | |
852 | - if rdata.Level > uinfo.BigLevel { | |
853 | - uinfo.BigLevel = rdata.Level | |
865 | + if rdata.Level > uinfo.GunLevel { | |
866 | + uinfo.GunLevel = rdata.Level | |
854 | 867 | } |
855 | 868 | |
856 | 869 | |
... | ... | @@ -1097,7 +1110,7 @@ func GetUserData(uuid int, uniqueuid string, req *UserLoginReq, resp *UserLoginR |
1097 | 1110 | SaveUserInfo(data, uniqueuid) |
1098 | 1111 | |
1099 | 1112 | resp.Data.Walletgold = data.RealGold |
1100 | - resp.Data.Curji = data.BigLevel | |
1113 | + resp.Data.Curji = data.GunLevel | |
1101 | 1114 | resp.Data.Curlevel = data.PassLevel |
1102 | 1115 | resp.Data.Guanrednum = data.GuanRedNum |
1103 | 1116 | resp.Data.Jirednum = data.JiRedNum | ... | ... |