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.power.push_order.go

42 lines
1.3 KiB

package wikeyun
import (
"context"
"encoding/json"
"go.dtapp.net/gorequest"
)
type RestPowerPushOrderResponse struct {
Code string `json:"code"`
Msg string `json:"msg"`
Time string `json:"time"`
Data struct {
OrderNumber string `json:"order_number"`
} `json:"data"`
}
type RestPowerPushOrderResult struct {
Result RestPowerPushOrderResponse // 结果
Body []byte // 内容
Http gorequest.Response // 请求
Err error // 错误
}
func newRestPowerPushOrderResult(result RestPowerPushOrderResponse, body []byte, http gorequest.Response, err error) *RestPowerPushOrderResult {
return &RestPowerPushOrderResult{Result: result, Body: body, Http: http, Err: err}
}
// RestPowerPushOrder 电费充值API
// https://open.wikeyun.cn/#/apiDocument/9/document/311
func (c *Client) RestPowerPushOrder(ctx context.Context, notMustParams ...gorequest.Params) *RestPowerPushOrderResult {
// 参数
params := gorequest.NewParamsWith(notMustParams...)
params.Set("store_id", c.GetStoreId()) // 店铺ID
// 请求
request, err := c.request(ctx, apiUrl+"/rest/Power/pushOrder", params)
// 定义
var response RestPowerPushOrderResponse
err = json.Unmarshal(request.ResponseBody, &response)
return newRestPowerPushOrderResult(response, request.ResponseBody, request, err)
}