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.recharge.query.go

51 lines
1.6 KiB

2 years ago
package wikeyun
import (
2 years ago
"context"
2 years ago
"encoding/json"
"go.dtapp.net/gorequest"
)
type RestRechargeQueryResponse struct {
Code string `json:"code"`
Msg string `json:"msg"`
Time string `json:"time"`
Data struct {
Id uint `json:"id"`
2 years ago
Fanli string `json:"fanli"`
Amount int64 `json:"amount"`
Mobile string `json:"mobile"`
2 years ago
Status int `json:"status"`
OrderNo string `json:"order_no"`
CostPrice string `json:"cost_price"`
OrderNumber string `json:"order_number"`
2 years ago
OrgOrderNumber string `json:"org_order_number"`
} `json:"data"`
}
type RestRechargeQueryResult struct {
Result RestRechargeQueryResponse // 结果
Body []byte // 内容
Http gorequest.Response // 请求
Err error // 错误
}
2 years ago
func newRestRechargeQueryResult(result RestRechargeQueryResponse, body []byte, http gorequest.Response, err error) *RestRechargeQueryResult {
2 years ago
return &RestRechargeQueryResult{Result: result, Body: body, Http: http, Err: err}
}
// RestRechargeQuery 话费订单查询
// https://open.wikeyun.cn/#/apiDocument/9/document/299
2 years ago
func (c *Client) RestRechargeQuery(ctx context.Context, orderNumber string) *RestRechargeQueryResult {
2 years ago
// 参数
2 years ago
param := gorequest.NewParams()
2 years ago
param.Set("order_number", orderNumber) // 平台订单号
2 years ago
params := gorequest.NewParamsWith(param)
2 years ago
// 请求
2 years ago
request, err := c.request(ctx, apiUrl+"/rest/Recharge/query", params)
2 years ago
// 定义
var response RestRechargeQueryResponse
err = json.Unmarshal(request.ResponseBody, &response)
2 years ago
return newRestRechargeQueryResult(response, request.ResponseBody, request, err)
2 years ago
}