Commit 6aa15284abe648568d46df30ce4355299d5fdce9
1 parent
d032a23d
Exists in
master
and in
4 other branches
提交
Showing
4 changed files
with
47 additions
and
26 deletions
Show diff stats
.gitignore
src/HttpServer/logic/datadef.go
| ... | ... | @@ -5,26 +5,32 @@ type UserLoginReq struct { |
| 5 | 5 | Sharetype int `json:"sharetype"` |
| 6 | 6 | } |
| 7 | 7 | |
| 8 | -type UserLoginResp struct { | |
| 9 | - Code int `json:"code"` | |
| 10 | - Message string `json:"message"` | |
| 8 | +type UserLoginData struct { | |
| 11 | 9 | Walletgold int `json:"walletgold"` |
| 12 | 10 | Leftads int `json:"leftads"` |
| 13 | 11 | Guangold int `json:"guangold"` |
| 12 | +} | |
| 13 | + | |
| 14 | +type UserLoginResp struct { | |
| 15 | + Code int `json:"code"` | |
| 16 | + Message string `json:"message"` | |
| 17 | + Data UserLoginData `json:"data"` | |
| 14 | 18 | |
| 15 | 19 | } |
| 16 | 20 | |
| 17 | 21 | |
| 22 | +type WatchadsData struct { | |
| 23 | + Leftads int `json:"leftads"` | |
| 24 | +} | |
| 25 | + | |
| 18 | 26 | type WatchadsResp struct { |
| 19 | 27 | Code int `json:"code"` |
| 20 | 28 | Message string `json:"message"` |
| 21 | - Leftads int `json:"leftads"` | |
| 29 | + Data WatchadsData `json:"data"` | |
| 22 | 30 | |
| 23 | 31 | } |
| 24 | 32 | |
| 25 | -type QueryguaninfoResp struct { | |
| 26 | - Code int `json:"code"` | |
| 27 | - Message string `json:"message"` | |
| 33 | +type QueryguaninfoData struct { | |
| 28 | 34 | Leftcnt int `json:"leftcnt"` |
| 29 | 35 | Totalcnt int `json:"totalcnt"` |
| 30 | 36 | Guangold int `json:"guangold"` |
| ... | ... | @@ -33,26 +39,40 @@ type QueryguaninfoResp struct { |
| 33 | 39 | Loginday int `json:"loginday"` |
| 34 | 40 | } |
| 35 | 41 | |
| 42 | +type QueryguaninfoResp struct { | |
| 43 | + Code int `json:"code"` | |
| 44 | + Message string `json:"message"` | |
| 45 | + Data QueryguaninfoData `json:"data"` | |
| 46 | +} | |
| 47 | + | |
| 36 | 48 | |
| 37 | 49 | type GetguangoldReq struct { |
| 38 | 50 | Goldnum int `json:"goldnum"` |
| 39 | 51 | } |
| 40 | 52 | |
| 53 | +type GetguangoldData struct { | |
| 54 | + Guangold int `json:"guangold"` | |
| 55 | +} | |
| 56 | + | |
| 41 | 57 | type GetguangoldResp struct { |
| 42 | 58 | Code int `json:"code"` |
| 43 | 59 | Message string `json:"message"` |
| 44 | - Guangold int `json:"guangold"` | |
| 60 | + Data GetguangoldData `json:"data"` | |
| 45 | 61 | } |
| 46 | 62 | |
| 47 | 63 | type DrawguangoldReq struct { |
| 48 | 64 | Goldnum int `json:"goldnum"` |
| 49 | 65 | } |
| 50 | 66 | |
| 67 | +type DrawguangoldData struct { | |
| 68 | + Guangold int `json:"guangold"` | |
| 69 | + Wallgold int `json:"wallgold"` | |
| 70 | +} | |
| 71 | + | |
| 51 | 72 | type DrawguangoldResp struct { |
| 52 | 73 | Code int `json:"code"` |
| 53 | 74 | Message string `json:"message"` |
| 54 | - Guangold int `json:"guangold"` | |
| 55 | - Wallgold int `json:"wallgold"` | |
| 75 | + Data DrawguangoldData `json:"data"` | |
| 56 | 76 | } |
| 57 | 77 | |
| 58 | 78 | //********************************************************************************************************** | ... | ... |
src/HttpServer/logic/function.go
| ... | ... | @@ -55,9 +55,9 @@ func InitUserInfo(data *UserLoginReq, resp *UserLoginResp, uuid int) error{ |
| 55 | 55 | initdata.RealGold = 0 |
| 56 | 56 | initdata.WatchAddsTime =WATCH_ADD_DAY_LIMIT |
| 57 | 57 | |
| 58 | - resp.Guangold = initdata.GuanGold | |
| 59 | - resp.Leftads = initdata.WatchAddsTime | |
| 60 | - resp.Walletgold = initdata.RealGold | |
| 58 | + resp.Data.Guangold = initdata.GuanGold | |
| 59 | + resp.Data.Leftads = initdata.WatchAddsTime | |
| 60 | + resp.Data.Walletgold = initdata.RealGold | |
| 61 | 61 | |
| 62 | 62 | err := SaveUserInfo(&initdata) |
| 63 | 63 | |
| ... | ... | @@ -123,9 +123,9 @@ func GetUserData(uuid int, resp *UserLoginResp) error{ |
| 123 | 123 | //此处要处理一下跨天逻辑 |
| 124 | 124 | data.HandlePassDay() |
| 125 | 125 | |
| 126 | - resp.Walletgold = data.RealGold | |
| 127 | - resp.Leftads = data.WatchAddsTime | |
| 128 | - resp.Guangold = data.GuanGold | |
| 126 | + resp.Data.Walletgold = data.RealGold | |
| 127 | + resp.Data.Leftads = data.WatchAddsTime | |
| 128 | + resp.Data.Guangold = data.GuanGold | |
| 129 | 129 | |
| 130 | 130 | return nil |
| 131 | 131 | } |
| 132 | 132 | \ No newline at end of file | ... | ... |
src/HttpServer/logic/logic.go
| ... | ... | @@ -35,12 +35,12 @@ func HandlerQueryguaninfo(w http.ResponseWriter, data string, uuid int) { |
| 35 | 35 | } |
| 36 | 36 | |
| 37 | 37 | |
| 38 | - resp.Guangold = uinfo.GuanGold | |
| 39 | - resp.Loginday = uinfo.ContinueLoginDay | |
| 40 | - resp.Totalcnt = uinfo.CalcTotalCnt() | |
| 41 | - resp.Leftcnt = resp.Totalcnt - uinfo.GetFromGuanCnt | |
| 42 | - resp.Maxget = mcfg.Max | |
| 43 | - resp.Minget = mcfg.Min | |
| 38 | + resp.Data.Guangold = uinfo.GuanGold | |
| 39 | + resp.Data.Loginday = uinfo.ContinueLoginDay | |
| 40 | + resp.Data.Totalcnt = uinfo.CalcTotalCnt() | |
| 41 | + resp.Data.Leftcnt = resp.Data.Totalcnt - uinfo.GetFromGuanCnt | |
| 42 | + resp.Data.Maxget = mcfg.Max | |
| 43 | + resp.Data.Minget = mcfg.Min | |
| 44 | 44 | resp.Code = ERROR_OK |
| 45 | 45 | break |
| 46 | 46 | |
| ... | ... | @@ -154,8 +154,8 @@ func HandlerDrawguangold(w http.ResponseWriter, data string, uuid int) { |
| 154 | 154 | //todo 此处需要调佣SDK接口通知金币变化 |
| 155 | 155 | |
| 156 | 156 | |
| 157 | - resp.Guangold = uinfo.GuanGold | |
| 158 | - resp.Wallgold = uinfo.RealGold | |
| 157 | + resp.Data.Guangold = uinfo.GuanGold | |
| 158 | + resp.Data.Wallgold = uinfo.RealGold | |
| 159 | 159 | |
| 160 | 160 | SaveUserInfo(uinfo) |
| 161 | 161 | |
| ... | ... | @@ -206,7 +206,7 @@ func HandlerGetguangold(w http.ResponseWriter, data string, uuid int) { |
| 206 | 206 | uinfo.GuanGold = mcfg.Max |
| 207 | 207 | } |
| 208 | 208 | |
| 209 | - resp.Guangold = uinfo.GuanGold | |
| 209 | + resp.Data.Guangold = uinfo.GuanGold | |
| 210 | 210 | |
| 211 | 211 | SaveUserInfo(uinfo) |
| 212 | 212 | ... | ... |