From c7b48d0ba72739aed3af75016b7c8883a982013c Mon Sep 17 00:00:00 2001 From: 陆恒 Date: Thu, 2 Jul 2020 18:06:04 +0800 Subject: [PATCH] 提交 --- src/HttpServer/logic/constdef.go | 7 ++++++- src/HttpServer/logic/datadef.go | 8 +++++++- src/HttpServer/logic/function.go | 6 ++++++ src/HttpServer/logic/logic.go | 14 ++++++++++++++ 4 files changed, 33 insertions(+), 2 deletions(-) diff --git a/src/HttpServer/logic/constdef.go b/src/HttpServer/logic/constdef.go index f52d683..5403e44 100644 --- a/src/HttpServer/logic/constdef.go +++ b/src/HttpServer/logic/constdef.go @@ -8,6 +8,9 @@ const ( TASKTYPE_KILLSTAR = 4 //4表示消除x颗星星 TASKTYPE_USEITEM = 5 //5表示使用x次道具 TASKTYPE_PLAYSMALLGAMES = 6 //6表示试玩15s小游戏 + TASKTYPE_WATCHADSSURPRICE = 7 //领取惊喜红包 + TASKTYPE_WATCHADSPAY = 8 //领取付费红包 + TASKTYPE_WATCHADSTIME = 9 //领取时长红包 ) @@ -53,7 +56,9 @@ const ( ) const ( - WATCH_ADD_DAY_LIMIT = 50 //当天获取红包次数限制 + WATCH_ADD_DAY_LIMIT = 25 //当天获取红包次数限制 + PAY_ADD_DAY_LIMIT = 20 //当天付费红包次数限制 + TIME_ADD_DAY_LIMIT = 5 //当天时长红包次数限制 FREE_REDBAG_NUM = 3 //玩家免费红包次数 READGOLDMULTI = 700 //阅读量到金币转化倍数 SDKOPGOLD_TYPEWE = 302 //微转发金币类型 diff --git a/src/HttpServer/logic/datadef.go b/src/HttpServer/logic/datadef.go index b242450..861fa54 100644 --- a/src/HttpServer/logic/datadef.go +++ b/src/HttpServer/logic/datadef.go @@ -18,6 +18,8 @@ type UserLoginReq struct { type UserLoginData struct { Walletgold int `json:"walletgold"` Leftredbagcnt int `json:"leftredbagcnt"` + Leftredbagpaycnt int `json:"leftredbagpaycnt"` + Leftredbagtimecnt int `json:"leftredbagtimecnt"` Guangold int `json:"guangold"` Userlv int `json:"userlv"` Userexp int `json:"userexp"` @@ -38,6 +40,8 @@ type GetuserdataReq struct { type GetuserdataData struct { Walletgold int `json:"walletgold"` Leftredbagcnt int `json:"leftredbagcnt"` + Leftredbagpaycnt int `json:"leftredbagpaycnt"` + Leftredbagtimrcnt int `json:"leftredbagtimrcnt"` Guangold int `json:"guangold"` Userlv int `json:"userlv"` Userexp int `json:"userexp"` @@ -347,7 +351,9 @@ type UserData struct { Exp int //玩家当前经验值 GuanGold int //玩家存钱罐中金币数量 RealGold int //玩家实际金币数量(可用于提现的) - WatchAddsTime int //当天剩余红包次数 初始化50次 + WatchAddsTime int //当天惊喜红包次数 初始化20次 + PayAddsTime int //当天付费红包 25次 + TimeAddsTime int //当天时长红包 5次 LastLoginTime int //上次登陆时间 ContinueLoginDay int //连续登录天数 SumLoginDay int //累计登陆天数 diff --git a/src/HttpServer/logic/function.go b/src/HttpServer/logic/function.go index 6ce45b2..d253e5e 100644 --- a/src/HttpServer/logic/function.go +++ b/src/HttpServer/logic/function.go @@ -484,6 +484,8 @@ func InitUserInfo(data *UserLoginReq, resp *UserLoginResp, uuid int, uniqueuid s goldnum, _ := GetCoinFromSdk(uuid, data.Gameid, data.Channel) initdata.RealGold = goldnum initdata.WatchAddsTime = WATCH_ADD_DAY_LIMIT + initdata.PayAddsTime = PAY_ADD_DAY_LIMIT + initdata.TimeAddsTime = TIME_ADD_DAY_LIMIT initdata.LeftFreeRB = FREE_REDBAG_NUM initdata.UpLvCostTime = 0 initdata.UpLvCostTimeSec = int(time.Now().Unix()) @@ -688,6 +690,8 @@ func (u *UserData) HandlePassDay(uuid int, channel string) { //跨天了 u.SumLoginDay++ u.WatchAddsTime = WATCH_ADD_DAY_LIMIT + u.PayAddsTime = PAY_ADD_DAY_LIMIT + u.TimeAddsTime = TIME_ADD_DAY_LIMIT //todo 重置任务相关的数据 u.GetFromGuanCnt = 0 u.GetCashCnt = 0 @@ -779,6 +783,8 @@ func GetUserData(uuid int, uniqueuid string, req *UserLoginReq, resp *UserLoginR resp.Data.Walletgold = data.RealGold resp.Data.Leftredbagcnt = data.WatchAddsTime + resp.Data.Leftredbagpaycnt = data.PayAddsTime + resp.Data.Leftredbagtimecnt = data.TimeAddsTime resp.Data.Guangold = data.GuanGold resp.Data.Userlv = data.Lv resp.Data.Userexp = data.Exp diff --git a/src/HttpServer/logic/logic.go b/src/HttpServer/logic/logic.go index 8a9deef..c9c9c07 100644 --- a/src/HttpServer/logic/logic.go +++ b/src/HttpServer/logic/logic.go @@ -764,6 +764,18 @@ func HandlerUpdatetaskandachieve(w http.ResponseWriter, data string, uuid int) { uinfo.Achieve.SumUseItemCnt += rdata.Value case TASKTYPE_PLAYSMALLGAMES: uinfo.Task.PlaySmall += 1 + case TASKTYPE_WATCHADSSURPRICE: + if uinfo.WatchAddsTime > 0 { + uinfo.WatchAddsTime-- + } + case TASKTYPE_WATCHADSPAY: + if uinfo.PayAddsTime > 0 { + uinfo.PayAddsTime-- + } + case TASKTYPE_WATCHADSTIME: + if uinfo.TimeAddsTime > 0 { + uinfo.TimeAddsTime-- + } } logger.Info("HandlerUpdatetaskandachieve uinfo=%v rdata=%v", uinfo, rdata) SaveUserInfo(uinfo, uniqueuuid) @@ -1068,6 +1080,8 @@ func HandlerGetuserdata(w http.ResponseWriter, data string, uuid int) { resp.Data.Walletgold = data.RealGold resp.Data.Guangold = data.GuanGold resp.Data.Leftredbagcnt = data.WatchAddsTime + resp.Data.Leftredbagpaycnt = data.PayAddsTime + resp.Data.Leftredbagtimrcnt = data.TimeAddsTime resp.Data.Userexp = data.Exp resp.Data.Userlv = data.Lv resp.Data.Leftfreeredbag = data.LeftFreeRB -- libgit2 0.21.0