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.
39 lines
1.2 KiB
39 lines
1.2 KiB
2 years ago
|
package wikeyun
|
||
|
|
||
|
import (
|
||
|
"encoding/json"
|
||
2 years ago
|
"go.dtapp.net/library/gorequest"
|
||
2 years ago
|
)
|
||
|
|
||
|
type RestPowerCancelResponse struct {
|
||
|
Code string `json:"code"`
|
||
|
Msg string `json:"msg"`
|
||
|
Data string `json:"data"`
|
||
|
}
|
||
|
|
||
|
type RestPowerCancelResult struct {
|
||
|
Result RestPowerCancelResponse // 结果
|
||
|
Body []byte // 内容
|
||
|
Http gorequest.Response // 请求
|
||
|
Err error // 错误
|
||
|
}
|
||
|
|
||
|
func NewRestPowerCancelResult(result RestPowerCancelResponse, body []byte, http gorequest.Response, err error) *RestPowerCancelResult {
|
||
|
return &RestPowerCancelResult{Result: result, Body: body, Http: http, Err: err}
|
||
|
}
|
||
|
|
||
|
// RestPowerCancel 电费订单取消
|
||
|
// https://open.wikeyun.cn/#/apiDocument/9/document/323
|
||
|
func (app *App) RestPowerCancel(orderNumber string) *RestPowerCancelResult {
|
||
|
// 参数
|
||
|
param := NewParams()
|
||
|
param.Set("order_number", orderNumber) // 取消的单号,多个用英文逗号隔开
|
||
|
params := app.NewParamsWith(param)
|
||
|
// 请求
|
||
|
request, err := app.request("https://router.wikeyun.cn/rest/Power/cancel", params)
|
||
|
// 定义
|
||
|
var response RestPowerCancelResponse
|
||
|
err = json.Unmarshal(request.ResponseBody, &response)
|
||
|
return NewRestPowerCancelResult(response, request.ResponseBody, request, err)
|
||
|
}
|