diff --git a/src/HttpServer/logic/datadef.go b/src/HttpServer/logic/datadef.go index 8cbf880..899abbf 100644 --- a/src/HttpServer/logic/datadef.go +++ b/src/HttpServer/logic/datadef.go @@ -211,6 +211,7 @@ type FetchredbagReq struct { } type FetchredbagData struct { + Gunrednum int `json:"gunrednum"` Guanrednum int `json:"guanrednum"` Timeredbagleft int `json:"timeredbagleft"` Getgold int `json:"getgold"` @@ -293,7 +294,7 @@ type UserData struct { UpLvCostTime int //上一个等级升级时间 UpLvCostTimeSec int //上一个等级升级的时间点时刻 PassLevel int //当前关卡 - BigLevel int //当前等级 + GunLevel int //当前枪最高等级 SpecialLevel int //特殊关卡 GuanRedNum int //关卡红包领取进度 JiRedNum int //等级红包领取进度 diff --git a/src/HttpServer/logic/function.go b/src/HttpServer/logic/function.go index 688c0b8..332a9d9 100644 --- a/src/HttpServer/logic/function.go +++ b/src/HttpServer/logic/function.go @@ -138,7 +138,7 @@ func HandlerSyncuserdata(w http.ResponseWriter, data string, uuid int) { resp.Data.Walletgold = data.RealGold resp.Data.Nowtime = int(time.Now().Unix()) - resp.Data.Curji = data.BigLevel + resp.Data.Curji = data.GunLevel resp.Data.Curlevel = data.PassLevel resp.Data.Guanrednum = data.GuanRedNum resp.Data.Jirednum = data.JiRedNum @@ -533,7 +533,7 @@ func InitUserInfo(data *UserLoginReq, resp *UserLoginResp, uuid int, uniqueuid s initdata.LeftFreeRB = FREE_REDBAG_NUM initdata.UpLvCostTime = 0 initdata.PassLevel = 1 - initdata.BigLevel = 1 + initdata.GunLevel = 1 initdata.SpecialLevel = 0 initdata.GuanRedNum = 0 initdata.JiRedNum = 0 @@ -581,7 +581,7 @@ func InitUserInfo(data *UserLoginReq, resp *UserLoginResp, uuid int, uniqueuid s //resp.Data.Leftredbagcnt = initdata.WatchAddsTime resp.Data.Walletgold = initdata.RealGold - resp.Data.Curji = initdata.BigLevel + resp.Data.Curji = initdata.GunLevel resp.Data.Curlevel = initdata.PassLevel resp.Data.Guanrednum = initdata.GuanRedNum resp.Data.Jirednum = initdata.JiRedNum diff --git a/src/HttpServer/logic/logic.go b/src/HttpServer/logic/logic.go index debb48c..3d1d308 100644 --- a/src/HttpServer/logic/logic.go +++ b/src/HttpServer/logic/logic.go @@ -623,6 +623,13 @@ func HandlerFetchredbag(w http.ResponseWriter, data string, uuid int) { if rdata.Rtype == 1 { //等级红包 + if uinfo.JiRedNum >= uinfo.GunLevel { + logger.Error("HandlerFetchredbag failed err=%v", err) + resp.Message = "没有可以领取的等级红包" + resp.Code = 1 + break + } + cfg := jsonconf.GetGunLvRdNum(rdata.Param) if cfg == nil { logger.Error("HandlerFetchredbag failed err=%v", err) @@ -643,6 +650,11 @@ func HandlerFetchredbag(w http.ResponseWriter, data string, uuid int) { resp.Data.Getgold = addgold resp.Data.Walletgold = realgold + + uinfo.JiRedNum ++ + + + }else if rdata.Rtype == 2 { //关卡红包 curprocess := (uinfo.PassLevel-1) / 3 @@ -771,6 +783,7 @@ func HandlerFetchredbag(w http.ResponseWriter, data string, uuid int) { resp.Data.Timeredbagleft = uinfo.RandNum resp.Data.Guanrednum = uinfo.GuanRedNum + resp.Data.Gunrednum = uinfo.JiRedNum resp.Code = 0 break @@ -849,8 +862,8 @@ func HandlerUploadbiglevel(w http.ResponseWriter, data string, uuid int) { break } - if rdata.Level > uinfo.BigLevel { - uinfo.BigLevel = rdata.Level + if rdata.Level > uinfo.GunLevel { + uinfo.GunLevel = rdata.Level } @@ -1097,7 +1110,7 @@ func GetUserData(uuid int, uniqueuid string, req *UserLoginReq, resp *UserLoginR SaveUserInfo(data, uniqueuid) resp.Data.Walletgold = data.RealGold - resp.Data.Curji = data.BigLevel + resp.Data.Curji = data.GunLevel resp.Data.Curlevel = data.PassLevel resp.Data.Guanrednum = data.GuanRedNum resp.Data.Jirednum = data.JiRedNum -- libgit2 0.21.0