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