Commit c7b48d0ba72739aed3af75016b7c8883a982013c
1 parent
be5fa0b9
Exists in
master
and in
1 other branch
提交
Showing
4 changed files
with
33 additions
and
2 deletions
Show diff stats
src/HttpServer/logic/constdef.go
| ... | ... | @@ -8,6 +8,9 @@ const ( |
| 8 | 8 | TASKTYPE_KILLSTAR = 4 //4表示消除x颗星星 |
| 9 | 9 | TASKTYPE_USEITEM = 5 //5表示使用x次道具 |
| 10 | 10 | TASKTYPE_PLAYSMALLGAMES = 6 //6表示试玩15s小游戏 |
| 11 | + TASKTYPE_WATCHADSSURPRICE = 7 //领取惊喜红包 | |
| 12 | + TASKTYPE_WATCHADSPAY = 8 //领取付费红包 | |
| 13 | + TASKTYPE_WATCHADSTIME = 9 //领取时长红包 | |
| 11 | 14 | |
| 12 | 15 | ) |
| 13 | 16 | |
| ... | ... | @@ -53,7 +56,9 @@ const ( |
| 53 | 56 | ) |
| 54 | 57 | |
| 55 | 58 | const ( |
| 56 | - WATCH_ADD_DAY_LIMIT = 50 //当天获取红包次数限制 | |
| 59 | + WATCH_ADD_DAY_LIMIT = 25 //当天获取红包次数限制 | |
| 60 | + PAY_ADD_DAY_LIMIT = 20 //当天付费红包次数限制 | |
| 61 | + TIME_ADD_DAY_LIMIT = 5 //当天时长红包次数限制 | |
| 57 | 62 | FREE_REDBAG_NUM = 3 //玩家免费红包次数 |
| 58 | 63 | READGOLDMULTI = 700 //阅读量到金币转化倍数 |
| 59 | 64 | SDKOPGOLD_TYPEWE = 302 //微转发金币类型 | ... | ... |
src/HttpServer/logic/datadef.go
| ... | ... | @@ -18,6 +18,8 @@ type UserLoginReq struct { |
| 18 | 18 | type UserLoginData struct { |
| 19 | 19 | Walletgold int `json:"walletgold"` |
| 20 | 20 | Leftredbagcnt int `json:"leftredbagcnt"` |
| 21 | + Leftredbagpaycnt int `json:"leftredbagpaycnt"` | |
| 22 | + Leftredbagtimecnt int `json:"leftredbagtimecnt"` | |
| 21 | 23 | Guangold int `json:"guangold"` |
| 22 | 24 | Userlv int `json:"userlv"` |
| 23 | 25 | Userexp int `json:"userexp"` |
| ... | ... | @@ -38,6 +40,8 @@ type GetuserdataReq struct { |
| 38 | 40 | type GetuserdataData struct { |
| 39 | 41 | Walletgold int `json:"walletgold"` |
| 40 | 42 | Leftredbagcnt int `json:"leftredbagcnt"` |
| 43 | + Leftredbagpaycnt int `json:"leftredbagpaycnt"` | |
| 44 | + Leftredbagtimrcnt int `json:"leftredbagtimrcnt"` | |
| 41 | 45 | Guangold int `json:"guangold"` |
| 42 | 46 | Userlv int `json:"userlv"` |
| 43 | 47 | Userexp int `json:"userexp"` |
| ... | ... | @@ -347,7 +351,9 @@ type UserData struct { |
| 347 | 351 | Exp int //玩家当前经验值 |
| 348 | 352 | GuanGold int //玩家存钱罐中金币数量 |
| 349 | 353 | RealGold int //玩家实际金币数量(可用于提现的) |
| 350 | - WatchAddsTime int //当天剩余红包次数 初始化50次 | |
| 354 | + WatchAddsTime int //当天惊喜红包次数 初始化20次 | |
| 355 | + PayAddsTime int //当天付费红包 25次 | |
| 356 | + TimeAddsTime int //当天时长红包 5次 | |
| 351 | 357 | LastLoginTime int //上次登陆时间 |
| 352 | 358 | ContinueLoginDay int //连续登录天数 |
| 353 | 359 | SumLoginDay int //累计登陆天数 | ... | ... |
src/HttpServer/logic/function.go
| ... | ... | @@ -484,6 +484,8 @@ func InitUserInfo(data *UserLoginReq, resp *UserLoginResp, uuid int, uniqueuid s |
| 484 | 484 | goldnum, _ := GetCoinFromSdk(uuid, data.Gameid, data.Channel) |
| 485 | 485 | initdata.RealGold = goldnum |
| 486 | 486 | initdata.WatchAddsTime = WATCH_ADD_DAY_LIMIT |
| 487 | + initdata.PayAddsTime = PAY_ADD_DAY_LIMIT | |
| 488 | + initdata.TimeAddsTime = TIME_ADD_DAY_LIMIT | |
| 487 | 489 | initdata.LeftFreeRB = FREE_REDBAG_NUM |
| 488 | 490 | initdata.UpLvCostTime = 0 |
| 489 | 491 | initdata.UpLvCostTimeSec = int(time.Now().Unix()) |
| ... | ... | @@ -688,6 +690,8 @@ func (u *UserData) HandlePassDay(uuid int, channel string) { |
| 688 | 690 | //跨天了 |
| 689 | 691 | u.SumLoginDay++ |
| 690 | 692 | u.WatchAddsTime = WATCH_ADD_DAY_LIMIT |
| 693 | + u.PayAddsTime = PAY_ADD_DAY_LIMIT | |
| 694 | + u.TimeAddsTime = TIME_ADD_DAY_LIMIT | |
| 691 | 695 | //todo 重置任务相关的数据 |
| 692 | 696 | u.GetFromGuanCnt = 0 |
| 693 | 697 | u.GetCashCnt = 0 |
| ... | ... | @@ -779,6 +783,8 @@ func GetUserData(uuid int, uniqueuid string, req *UserLoginReq, resp *UserLoginR |
| 779 | 783 | |
| 780 | 784 | resp.Data.Walletgold = data.RealGold |
| 781 | 785 | resp.Data.Leftredbagcnt = data.WatchAddsTime |
| 786 | + resp.Data.Leftredbagpaycnt = data.PayAddsTime | |
| 787 | + resp.Data.Leftredbagtimecnt = data.TimeAddsTime | |
| 782 | 788 | resp.Data.Guangold = data.GuanGold |
| 783 | 789 | resp.Data.Userlv = data.Lv |
| 784 | 790 | resp.Data.Userexp = data.Exp | ... | ... |
src/HttpServer/logic/logic.go
| ... | ... | @@ -764,6 +764,18 @@ func HandlerUpdatetaskandachieve(w http.ResponseWriter, data string, uuid int) { |
| 764 | 764 | uinfo.Achieve.SumUseItemCnt += rdata.Value |
| 765 | 765 | case TASKTYPE_PLAYSMALLGAMES: |
| 766 | 766 | uinfo.Task.PlaySmall += 1 |
| 767 | + case TASKTYPE_WATCHADSSURPRICE: | |
| 768 | + if uinfo.WatchAddsTime > 0 { | |
| 769 | + uinfo.WatchAddsTime-- | |
| 770 | + } | |
| 771 | + case TASKTYPE_WATCHADSPAY: | |
| 772 | + if uinfo.PayAddsTime > 0 { | |
| 773 | + uinfo.PayAddsTime-- | |
| 774 | + } | |
| 775 | + case TASKTYPE_WATCHADSTIME: | |
| 776 | + if uinfo.TimeAddsTime > 0 { | |
| 777 | + uinfo.TimeAddsTime-- | |
| 778 | + } | |
| 767 | 779 | } |
| 768 | 780 | logger.Info("HandlerUpdatetaskandachieve uinfo=%v rdata=%v", uinfo, rdata) |
| 769 | 781 | SaveUserInfo(uinfo, uniqueuuid) |
| ... | ... | @@ -1068,6 +1080,8 @@ func HandlerGetuserdata(w http.ResponseWriter, data string, uuid int) { |
| 1068 | 1080 | resp.Data.Walletgold = data.RealGold |
| 1069 | 1081 | resp.Data.Guangold = data.GuanGold |
| 1070 | 1082 | resp.Data.Leftredbagcnt = data.WatchAddsTime |
| 1083 | + resp.Data.Leftredbagpaycnt = data.PayAddsTime | |
| 1084 | + resp.Data.Leftredbagtimrcnt = data.TimeAddsTime | |
| 1071 | 1085 | resp.Data.Userexp = data.Exp |
| 1072 | 1086 | resp.Data.Userlv = data.Lv |
| 1073 | 1087 | resp.Data.Leftfreeredbag = data.LeftFreeRB | ... | ... |