70 lines
2.4 KiB
Go
70 lines
2.4 KiB
Go
package po
|
|
|
|
import (
|
|
"fmt"
|
|
"gitea.cdlsxd.cn/sdk/plugin/proto"
|
|
)
|
|
|
|
type OrderReq struct {
|
|
Amount float32 `validate:"required" json:"amount"` // 微信:0.3-200;支付宝:<400单位:元
|
|
BatchId string `validate:"required" json:"batchId"` // 批次ID
|
|
BizNo string `validate:"required" json:"bizNo"` // 业务单号,需唯一
|
|
|
|
Name string `json:"name"` // 真实姓名 支付宝必填
|
|
Phone string `json:"phone"` // 支付宝必填
|
|
|
|
//WxAppId string `json:"wxAppId"` // 公众号ID 微信必填
|
|
//OpenId string `json:"openId"` // 微信openId 微信必填
|
|
//Wishing string `json:"wishing"` // 红包祝福语,微信使用
|
|
|
|
//RedPacketName string `son:"redPacketName"` // 红包名称 默认"现金红包"
|
|
//Expand string `json:"expand"` // 拓展信息
|
|
//Remark string `json:"remark"` // 红包备注 默认“现金红包”
|
|
//SendName string `json:"sendName"` // 发送名称 微信使用默认与redPacketName相同
|
|
|
|
NotifyUrl string `validate:"required" json:"notifyUrl"`
|
|
|
|
Sign string `json:"sign"` // MD5签名
|
|
}
|
|
|
|
type OrderWechatReq struct {
|
|
Amount float32 `validate:"required" json:"amount"` // 微信:0.3-200;支付宝:<400单位:元
|
|
BatchId string `validate:"required" json:"batchId"` // 批次ID
|
|
BizNo string `validate:"required" json:"bizNo"` // 业务单号,需唯一
|
|
|
|
WxAppId string `validate:"required" json:"wxAppId"` // 公众号ID 微信必填
|
|
OpenId string `validate:"required" json:"openId"` // 微信openId 微信必填
|
|
Wishing string `validate:"required" json:"wishing"` // 红包祝福语,微信使用
|
|
|
|
RedPacketName string `validate:"required" json:"redPacketName"` // 红包名称 默认"现金红包"
|
|
Expand string `json:"expand"` // 拓展信息
|
|
Remark string `json:"remark"` // 红包备注 默认“现金红包”
|
|
SendName string `validate:"required" json:"sendName"` // 发送名称 微信使用默认与redPacketName相同
|
|
|
|
Sign string `json:"sign"` // MD5签名
|
|
}
|
|
|
|
type OrderResp struct {
|
|
Code any `json:"code"`
|
|
Msg string `json:"msg"`
|
|
}
|
|
|
|
func (o *OrderResp) IsSuccess() bool {
|
|
strCode := fmt.Sprintf("%v", o.Code)
|
|
return strCode == "000000"
|
|
}
|
|
|
|
func (o *OrderResp) GetMsg() string {
|
|
if o.IsSuccess() {
|
|
return o.Msg
|
|
}
|
|
return fmt.Sprintf("code:[%v],msg:[%s]", o.Code, o.Msg)
|
|
}
|
|
|
|
func (o *OrderResp) GetOrderStatus() proto.Status {
|
|
if o.IsSuccess() {
|
|
return proto.Status_ING
|
|
}
|
|
return proto.Status_FAIL
|
|
}
|