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.
wikeyun/rest.user.query.go

41 lines
1.2 KiB

package wikeyun
import (
"context"
"encoding/json"
"go.dtapp.net/gorequest"
)
type RestUserQueryResponse struct {
Code string `json:"code"`
Msg string `json:"msg"`
Data struct {
Id string `json:"id"`
Avatar string `json:"avatar"`
Money string `json:"money"`
Mobile string `json:"mobile"`
} `json:"data"`
}
type RestUserQueryResult struct {
Result RestUserQueryResponse // 结果
Body []byte // 内容
Http gorequest.Response // 请求
Err error // 错误
}
func newRestUserQueryResult(result RestUserQueryResponse, body []byte, http gorequest.Response, err error) *RestUserQueryResult {
return &RestUserQueryResult{Result: result, Body: body, Http: http, Err: err}
}
// RestUserQuery 用户信息
// https://open.wikeyun.cn/#/apiDocument/10/document/336
func (c *Client) RestUserQuery(ctx context.Context) *RestUserQueryResult {
// 请求
request, err := c.request(ctx, apiUrl+"/rest/User/query", map[string]interface{}{})
// 定义
var response RestUserQueryResponse
err = json.Unmarshal(request.ResponseBody, &response)
return newRestUserQueryResult(response, request.ResponseBody, request, err)
}