diff --git a/.gitignore b/.gitignore index 5d8dd49..a45a440 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ *.txt -.idea/ \ No newline at end of file +.idea/ +log/ \ No newline at end of file diff --git a/src/HttpServer/logic/datadef.go b/src/HttpServer/logic/datadef.go index 63814f3..ae1f357 100644 --- a/src/HttpServer/logic/datadef.go +++ b/src/HttpServer/logic/datadef.go @@ -5,26 +5,32 @@ type UserLoginReq struct { Sharetype int `json:"sharetype"` } -type UserLoginResp struct { - Code int `json:"code"` - Message string `json:"message"` +type UserLoginData struct { Walletgold int `json:"walletgold"` Leftads int `json:"leftads"` Guangold int `json:"guangold"` +} + +type UserLoginResp struct { + Code int `json:"code"` + Message string `json:"message"` + Data UserLoginData `json:"data"` } +type WatchadsData struct { + Leftads int `json:"leftads"` +} + type WatchadsResp struct { Code int `json:"code"` Message string `json:"message"` - Leftads int `json:"leftads"` + Data WatchadsData `json:"data"` } -type QueryguaninfoResp struct { - Code int `json:"code"` - Message string `json:"message"` +type QueryguaninfoData struct { Leftcnt int `json:"leftcnt"` Totalcnt int `json:"totalcnt"` Guangold int `json:"guangold"` @@ -33,26 +39,40 @@ type QueryguaninfoResp struct { Loginday int `json:"loginday"` } +type QueryguaninfoResp struct { + Code int `json:"code"` + Message string `json:"message"` + Data QueryguaninfoData `json:"data"` +} + type GetguangoldReq struct { Goldnum int `json:"goldnum"` } +type GetguangoldData struct { + Guangold int `json:"guangold"` +} + type GetguangoldResp struct { Code int `json:"code"` Message string `json:"message"` - Guangold int `json:"guangold"` + Data GetguangoldData `json:"data"` } type DrawguangoldReq struct { Goldnum int `json:"goldnum"` } +type DrawguangoldData struct { + Guangold int `json:"guangold"` + Wallgold int `json:"wallgold"` +} + type DrawguangoldResp struct { Code int `json:"code"` Message string `json:"message"` - Guangold int `json:"guangold"` - Wallgold int `json:"wallgold"` + Data DrawguangoldData `json:"data"` } //********************************************************************************************************** diff --git a/src/HttpServer/logic/function.go b/src/HttpServer/logic/function.go index a14b53c..d81a9e7 100644 --- a/src/HttpServer/logic/function.go +++ b/src/HttpServer/logic/function.go @@ -55,9 +55,9 @@ func InitUserInfo(data *UserLoginReq, resp *UserLoginResp, uuid int) error{ initdata.RealGold = 0 initdata.WatchAddsTime =WATCH_ADD_DAY_LIMIT - resp.Guangold = initdata.GuanGold - resp.Leftads = initdata.WatchAddsTime - resp.Walletgold = initdata.RealGold + resp.Data.Guangold = initdata.GuanGold + resp.Data.Leftads = initdata.WatchAddsTime + resp.Data.Walletgold = initdata.RealGold err := SaveUserInfo(&initdata) @@ -123,9 +123,9 @@ func GetUserData(uuid int, resp *UserLoginResp) error{ //此处要处理一下跨天逻辑 data.HandlePassDay() - resp.Walletgold = data.RealGold - resp.Leftads = data.WatchAddsTime - resp.Guangold = data.GuanGold + resp.Data.Walletgold = data.RealGold + resp.Data.Leftads = data.WatchAddsTime + resp.Data.Guangold = data.GuanGold return nil } \ No newline at end of file diff --git a/src/HttpServer/logic/logic.go b/src/HttpServer/logic/logic.go index 1e9fb90..ce58ca7 100644 --- a/src/HttpServer/logic/logic.go +++ b/src/HttpServer/logic/logic.go @@ -35,12 +35,12 @@ func HandlerQueryguaninfo(w http.ResponseWriter, data string, uuid int) { } - resp.Guangold = uinfo.GuanGold - resp.Loginday = uinfo.ContinueLoginDay - resp.Totalcnt = uinfo.CalcTotalCnt() - resp.Leftcnt = resp.Totalcnt - uinfo.GetFromGuanCnt - resp.Maxget = mcfg.Max - resp.Minget = mcfg.Min + resp.Data.Guangold = uinfo.GuanGold + resp.Data.Loginday = uinfo.ContinueLoginDay + resp.Data.Totalcnt = uinfo.CalcTotalCnt() + resp.Data.Leftcnt = resp.Data.Totalcnt - uinfo.GetFromGuanCnt + resp.Data.Maxget = mcfg.Max + resp.Data.Minget = mcfg.Min resp.Code = ERROR_OK break @@ -154,8 +154,8 @@ func HandlerDrawguangold(w http.ResponseWriter, data string, uuid int) { //todo 此处需要调佣SDK接口通知金币变化 - resp.Guangold = uinfo.GuanGold - resp.Wallgold = uinfo.RealGold + resp.Data.Guangold = uinfo.GuanGold + resp.Data.Wallgold = uinfo.RealGold SaveUserInfo(uinfo) @@ -206,7 +206,7 @@ func HandlerGetguangold(w http.ResponseWriter, data string, uuid int) { uinfo.GuanGold = mcfg.Max } - resp.Guangold = uinfo.GuanGold + resp.Data.Guangold = uinfo.GuanGold SaveUserInfo(uinfo) -- libgit2 0.21.0