添加文件: xy_sh/types.go
This commit is contained in:
commit
c9f01792b2
|
|
@ -0,0 +1,118 @@
|
||||||
|
package xy_sh
|
||||||
|
|
||||||
|
// ===== 接口1:卡券/直充权益下单接口 =====
|
||||||
|
|
||||||
|
// OrderRequest 下单接口业务请求参数
|
||||||
|
type OrderRequest struct {
|
||||||
|
ActCode string `json:"actCode"` // 活动code
|
||||||
|
GoodsCode string `json:"goodsCode"` // 供应商商品编号
|
||||||
|
ActOrderNum string `json:"actOrderNum"` // 活动方订单号,唯一
|
||||||
|
Account string `json:"account,omitempty"` // 充值账号
|
||||||
|
CallbackUrl string `json:"callbackUrl,omitempty"` // 回调地址
|
||||||
|
}
|
||||||
|
|
||||||
|
// OrderData 下单接口响应解密后的业务数据
|
||||||
|
type OrderData struct {
|
||||||
|
OrderNo string `json:"orderNo"` // 供应商订单号
|
||||||
|
CouponNo string `json:"couponNo,omitempty"` // 卡号/短链
|
||||||
|
CouponCode string `json:"couponCode,omitempty"` // 卡密
|
||||||
|
Status int `json:"status"` // 状态:-1发放中 0成功 1失败 2已核销 3已过期
|
||||||
|
ExpireTime string `json:"expireTime,omitempty"` // 有效期 yyyy-MM-dd HH:mm:ss
|
||||||
|
}
|
||||||
|
|
||||||
|
// OrderResponse 下单接口响应
|
||||||
|
type OrderResponse struct {
|
||||||
|
Code int `json:"code"`
|
||||||
|
Msg string `json:"msg"`
|
||||||
|
Data *OrderData `json:"data,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// ===== 接口2:卡券/直充/微信立减金订单查询接口 =====
|
||||||
|
|
||||||
|
// QueryRequest 查询接口业务请求参数
|
||||||
|
type QueryRequest struct {
|
||||||
|
ActCode string `json:"actCode"` // 活动code
|
||||||
|
OrderNo string `json:"orderNo"` // 供应商订单号
|
||||||
|
}
|
||||||
|
|
||||||
|
// QueryData 查询接口响应解密后的业务数据
|
||||||
|
type QueryData struct {
|
||||||
|
OrderNo string `json:"orderNo"` // 供应商订单号
|
||||||
|
Status int `json:"status"` // 订单状态
|
||||||
|
Account string `json:"account,omitempty"` // 充值账号,直充类型时存在
|
||||||
|
CardInfo *CardInfo `json:"cardInfo,omitempty"` // 卡券信息
|
||||||
|
CouponId string `json:"couponId,omitempty"` // 微信优惠id
|
||||||
|
}
|
||||||
|
|
||||||
|
// QueryResponse 查询接口响应
|
||||||
|
type QueryResponse struct {
|
||||||
|
Code int `json:"code"`
|
||||||
|
Msg string `json:"msg"`
|
||||||
|
Data *QueryData `json:"data,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// CardInfo 卡券信息
|
||||||
|
type CardInfo struct {
|
||||||
|
CouponNo string `json:"couponNo"` // 卡号/短链
|
||||||
|
CouponCode string `json:"couponCode"` // 卡密
|
||||||
|
ExpireTime string `json:"expireTime"` // 过期时间 yyyy-MM-dd HH:mm:ss
|
||||||
|
}
|
||||||
|
|
||||||
|
// ===== 接口3:微信立减金订单充值接口 =====
|
||||||
|
|
||||||
|
// WechatRechargeRequest 微信立减金充值业务请求参数
|
||||||
|
type WechatRechargeRequest struct {
|
||||||
|
ActCode string `json:"actCode"` // 活动code
|
||||||
|
OrderNo string `json:"orderNo"` // 供应商订单号
|
||||||
|
GoodsCode string `json:"goodsCode"` // 供应商商品编号
|
||||||
|
ActOrderNum string `json:"actOrderNum"` // 活动方订单号,唯一
|
||||||
|
AppId string `json:"appId"` // 公众账号ID
|
||||||
|
OpenId string `json:"openId"` // 微信用户标识
|
||||||
|
CallbackUrl string `json:"callbackUrl,omitempty"` // 回调地址
|
||||||
|
}
|
||||||
|
|
||||||
|
// WechatRechargeData 微信立减金充值响应解密后的业务数据
|
||||||
|
type WechatRechargeData struct {
|
||||||
|
OrderNo string `json:"orderNo"` // 供应商订单号
|
||||||
|
Status int `json:"status"` // 订单状态
|
||||||
|
CouponId string `json:"couponId,omitempty"` // 微信优惠id
|
||||||
|
}
|
||||||
|
|
||||||
|
// WechatRechargeResponse 微信立减金充值响应
|
||||||
|
type WechatRechargeResponse struct {
|
||||||
|
Code int `json:"code"`
|
||||||
|
Msg string `json:"msg"`
|
||||||
|
Data *WechatRechargeData `json:"data,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// ===== 接口4:回调通知接口 =====
|
||||||
|
|
||||||
|
// CallbackRequest 回调通知业务请求参数
|
||||||
|
type CallbackRequest struct {
|
||||||
|
OrderNo string `json:"orderNo"` // 供应商订单号
|
||||||
|
ActOrderNum string `json:"actOrderNum"` // 活动方订单号
|
||||||
|
Status int `json:"status"` // 订单状态
|
||||||
|
Account string `json:"account,omitempty"` // 直充账号
|
||||||
|
CardInfo *CardInfo `json:"cardInfo,omitempty"` // 卡券信息
|
||||||
|
CouponId string `json:"couponId,omitempty"` // 微信优惠id
|
||||||
|
}
|
||||||
|
|
||||||
|
// CallbackResponse 回调通知响应(HTTP响应)
|
||||||
|
type CallbackResponse struct {
|
||||||
|
StatusCode int `json:"-"` // HTTP状态码
|
||||||
|
Body string `json:"-"` // 响应体内容
|
||||||
|
}
|
||||||
|
|
||||||
|
// ===== 通用结构 =====
|
||||||
|
|
||||||
|
// EncryptedRequest 加密请求体
|
||||||
|
type EncryptedRequest struct {
|
||||||
|
EncryptedData string `json:"encryptedData"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// RawResponse 原始响应结构,data 字段为加密后的 JSON 字符串
|
||||||
|
type RawResponse struct {
|
||||||
|
Code int `json:"code"`
|
||||||
|
Msg string `json:"msg"`
|
||||||
|
Data string `json:"data"`
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue