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.
go-library/service/ejiaofei/chongzhi_jkorders.go

41 lines
1.5 KiB

3 years ago
package ejiaofei
import (
"encoding/xml"
"fmt"
"net/http"
)
type ChOngZhiJkOrdersResult struct {
XMLName xml.Name `xml:"response"`
UserID string `xml:"userid"` // 会员账号
PorderID string `xml:"Porderid"` // 鼎信平台订单号
OrderID string `xml:"orderid"` // 用户订单号
Account string `xml:"account"` // 需要充值的手机号码
Face string `xml:"face"` // 充值面值
Amount string `xml:"amount"` // 购买数量
StartTime string `xml:"starttime"` // 开始时间
State string `xml:"state"` // 订单状态
EndTime string `xml:"endtime"` // 结束时间
Error string `xml:"error"` // 错误提示
}
// ChOngZhiJkOrders 话费充值接口
// orderid 用户提交的订单号 用户提交的订单号最长32位用户保证其唯一性
// face 充值面值 以元为单位包含10、20、30、50、100、200、300、500 移动联通电信
// account 手机号码 需要充值的手机号码
func (app *App) ChOngZhiJkOrders(orderID string, face int, account string) (body []byte, err error) {
// 参数
param := NewParams()
param.Set("orderid", orderID)
param.Set("face", face)
param.Set("account", account)
param.Set("amount", 1)
params := app.NewParamsWith(param)
// 签名
app.signStr = fmt.Sprintf("userid%vpwd%vorderid%vface%vaccount%vamount1", app.UserID, app.Pwd, orderID, face, account)
// 请求
body, err = app.request("http://api.ejiaofei.net:11140/chongzhi_jkorders.do", params, http.MethodGet)
return body, err
}