diff --git a/src/HttpServer/logic/constdef.go b/src/HttpServer/logic/constdef.go index 98e0059..d730a5c 100644 --- a/src/HttpServer/logic/constdef.go +++ b/src/HttpServer/logic/constdef.go @@ -48,4 +48,5 @@ const ( const ( WATCH_ADD_DAY_LIMIT = 9 //当天观看视频次数限制 + FREE_REDBAG_NUM = 3 //玩家免费红包次数 ) diff --git a/src/HttpServer/logic/datadef.go b/src/HttpServer/logic/datadef.go index 05da92b..69a17e6 100644 --- a/src/HttpServer/logic/datadef.go +++ b/src/HttpServer/logic/datadef.go @@ -27,11 +27,12 @@ type GetuserdataReq struct { } type GetuserdataData struct { - Walletgold int `json:"walletgold"` - Leftads int `json:"leftads"` - Guangold int `json:"guangold"` - Userlv int `json:"userlv"` - Userexp int `json:"userexp"` + Walletgold int `json:"walletgold"` + Leftads int `json:"leftads"` + Guangold int `json:"guangold"` + Userlv int `json:"userlv"` + Userexp int `json:"userexp"` + Leftfreeredbag int `json:"leftfreeredbag"` } type GetuserdataResp struct { @@ -280,6 +281,7 @@ type UserData struct { SignRound int //签到轮数 SignSum int //累计签到天数 IsSignToday int //今日是否已经签到 1是 0否 + LeftFreeRB int //剩余免费红包次数 WithDraw WithDrawInfo //提现记录信息 Task TaskInfo //玩家任务完成相关信息 Achieve AchieveMentInfo //玩家成就完成相关数据 diff --git a/src/HttpServer/logic/function.go b/src/HttpServer/logic/function.go index 944ec8e..9ca01d6 100644 --- a/src/HttpServer/logic/function.go +++ b/src/HttpServer/logic/function.go @@ -440,6 +440,7 @@ func InitUserInfo(data *UserLoginReq, resp *UserLoginResp, uuid int) error { initdata.LastLoginTime = int(time.Now().Unix()) initdata.RealGold = 0 initdata.WatchAddsTime = WATCH_ADD_DAY_LIMIT + initdata.LeftFreeRB = FREE_REDBAG_NUM for _, val := range jsonconf.GetJsonConf().WithDrawConfig { var tmp WithDrawDesc diff --git a/src/HttpServer/logic/logic.go b/src/HttpServer/logic/logic.go index 3132bbb..486e314 100644 --- a/src/HttpServer/logic/logic.go +++ b/src/HttpServer/logic/logic.go @@ -512,6 +512,9 @@ func HandlerUpdatetaskandachieve(w http.ResponseWriter, data string, uuid int) { uinfo.Task.PassLevel += rdata.Value case TASKTYPE_GETREDBAG: uinfo.Task.GetRedbagCnt += rdata.Value + if uinfo.LeftFreeRB > 0 { + uinfo.LeftFreeRB-- + } case TASKTYPE_WATCHADS: uinfo.Achieve.WatchAdsCnt += rdata.Value case TASKTYPE_KILLSTAR: @@ -779,6 +782,7 @@ func HandlerGetuserdata(w http.ResponseWriter, data string, uuid int) { resp.Data.Leftads = data.WatchAddsTime resp.Data.Userexp = data.Exp resp.Data.Userlv = data.Lv + resp.Data.Leftfreeredbag = data.LeftFreeRB SaveUserInfo(data) resp.Code = ERROR_OK -- libgit2 0.21.0