Commit 6aa15284abe648568d46df30ce4355299d5fdce9

Authored by 陆恒
1 parent d032a23d

提交

1 *.txt 1 *.txt
2 -.idea/  
3 \ No newline at end of file 2 \ No newline at end of file
  3 +.idea/
  4 +log/
4 \ No newline at end of file 5 \ No newline at end of file
src/HttpServer/logic/datadef.go
@@ -5,26 +5,32 @@ type UserLoginReq struct { @@ -5,26 +5,32 @@ type UserLoginReq struct {
5 Sharetype int `json:"sharetype"` 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 Walletgold int `json:"walletgold"` 9 Walletgold int `json:"walletgold"`
12 Leftads int `json:"leftads"` 10 Leftads int `json:"leftads"`
13 Guangold int `json:"guangold"` 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 type WatchadsResp struct { 26 type WatchadsResp struct {
19 Code int `json:"code"` 27 Code int `json:"code"`
20 Message string `json:"message"` 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 Leftcnt int `json:"leftcnt"` 34 Leftcnt int `json:"leftcnt"`
29 Totalcnt int `json:"totalcnt"` 35 Totalcnt int `json:"totalcnt"`
30 Guangold int `json:"guangold"` 36 Guangold int `json:"guangold"`
@@ -33,26 +39,40 @@ type QueryguaninfoResp struct { @@ -33,26 +39,40 @@ type QueryguaninfoResp struct {
33 Loginday int `json:"loginday"` 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 type GetguangoldReq struct { 49 type GetguangoldReq struct {
38 Goldnum int `json:"goldnum"` 50 Goldnum int `json:"goldnum"`
39 } 51 }
40 52
  53 +type GetguangoldData struct {
  54 + Guangold int `json:"guangold"`
  55 +}
  56 +
41 type GetguangoldResp struct { 57 type GetguangoldResp struct {
42 Code int `json:"code"` 58 Code int `json:"code"`
43 Message string `json:"message"` 59 Message string `json:"message"`
44 - Guangold int `json:"guangold"` 60 + Data GetguangoldData `json:"data"`
45 } 61 }
46 62
47 type DrawguangoldReq struct { 63 type DrawguangoldReq struct {
48 Goldnum int `json:"goldnum"` 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 type DrawguangoldResp struct { 72 type DrawguangoldResp struct {
52 Code int `json:"code"` 73 Code int `json:"code"`
53 Message string `json:"message"` 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,9 +55,9 @@ func InitUserInfo(data *UserLoginReq, resp *UserLoginResp, uuid int) error{
55 initdata.RealGold = 0 55 initdata.RealGold = 0
56 initdata.WatchAddsTime =WATCH_ADD_DAY_LIMIT 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 err := SaveUserInfo(&initdata) 62 err := SaveUserInfo(&initdata)
63 63
@@ -123,9 +123,9 @@ func GetUserData(uuid int, resp *UserLoginResp) error{ @@ -123,9 +123,9 @@ func GetUserData(uuid int, resp *UserLoginResp) error{
123 //此处要处理一下跨天逻辑 123 //此处要处理一下跨天逻辑
124 data.HandlePassDay() 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 return nil 130 return nil
131 } 131 }
132 \ No newline at end of file 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,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 resp.Code = ERROR_OK 44 resp.Code = ERROR_OK
45 break 45 break
46 46
@@ -154,8 +154,8 @@ func HandlerDrawguangold(w http.ResponseWriter, data string, uuid int) { @@ -154,8 +154,8 @@ func HandlerDrawguangold(w http.ResponseWriter, data string, uuid int) {
154 //todo 此处需要调佣SDK接口通知金币变化 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 SaveUserInfo(uinfo) 160 SaveUserInfo(uinfo)
161 161
@@ -206,7 +206,7 @@ func HandlerGetguangold(w http.ResponseWriter, data string, uuid int) { @@ -206,7 +206,7 @@ func HandlerGetguangold(w http.ResponseWriter, data string, uuid int) {
206 uinfo.GuanGold = mcfg.Max 206 uinfo.GuanGold = mcfg.Max
207 } 207 }
208 208
209 - resp.Guangold = uinfo.GuanGold 209 + resp.Data.Guangold = uinfo.GuanGold
210 210
211 SaveUserInfo(uinfo) 211 SaveUserInfo(uinfo)
212 212