You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
35 lines
898 B
35 lines
898 B
2 years ago
|
package wikeyun
|
||
|
|
||
|
import (
|
||
|
"encoding/json"
|
||
|
)
|
||
|
|
||
|
type RestUserQueryResponse struct {
|
||
|
Code string `json:"code"`
|
||
|
Msg string `json:"msg"`
|
||
|
Data struct {
|
||
|
Money string `json:"money"`
|
||
|
ID int `json:"id"`
|
||
|
} `json:"data"`
|
||
|
}
|
||
|
|
||
|
type RestUserQueryResult struct {
|
||
|
Result RestUserQueryResponse // 结果
|
||
|
Body []byte // 内容
|
||
|
Err error // 错误
|
||
|
}
|
||
|
|
||
|
func NewRestUserQueryResult(result RestUserQueryResponse, body []byte, err error) *RestUserQueryResult {
|
||
|
return &RestUserQueryResult{Result: result, Body: body, Err: err}
|
||
|
}
|
||
|
|
||
|
// RestUserQuery 查询余额接口
|
||
|
func (app *App) RestUserQuery() *RestUserQueryResult {
|
||
|
// 请求
|
||
|
body, err := app.request("https://router.wikeyun.cn/rest/User/query", map[string]interface{}{})
|
||
|
// 定义
|
||
|
var response RestUserQueryResponse
|
||
|
err = json.Unmarshal(body, &response)
|
||
|
return NewRestUserQueryResult(response, body, err)
|
||
|
}
|