55 lines
1.9 KiB
Go
55 lines
1.9 KiB
Go
package dto
|
|
|
|
import "github.com/gogf/gf/v2/frame/g"
|
|
|
|
// ListPlansReq 套餐列表(登录态;价格以服务端 config.yml plans 为准)
|
|
type ListPlansReq struct {
|
|
g.Meta `path:"/plans" method:"get" summary:"套餐列表" tags:"订单"`
|
|
}
|
|
|
|
// PlanItem 套餐项:展示名由客户端按 days 派生"N天"
|
|
type PlanItem struct {
|
|
PlanId string `json:"planId"`
|
|
Days int `json:"days"`
|
|
PriceCents int64 `json:"priceCents"`
|
|
}
|
|
|
|
type ListPlansRes struct {
|
|
List []*PlanItem `json:"list"`
|
|
}
|
|
|
|
// CreateOrderReq 创建支付订单(登录态:手机号由 AuthRequired 从 token 解出)
|
|
type CreateOrderReq struct {
|
|
g.Meta `path:"/orders" method:"post" summary:"创建支付订单" tags:"订单"`
|
|
PlanId string `json:"planId" v:"required" dc:"套餐标识(需在 config.yml plans 存在)"`
|
|
Channel string `json:"channel" v:"required|in:wechat,alipay" dc:"支付渠道"`
|
|
}
|
|
|
|
// CreateOrderRes 创建订单结果:payParams 按渠道二选一填充
|
|
type CreateOrderRes struct {
|
|
OrderId string `json:"orderId"`
|
|
PayParams *PayParams `json:"payParams"`
|
|
}
|
|
|
|
// PayParams 支付拉起参数:微信走 App 支付参数,支付宝走 orderStr
|
|
type PayParams struct {
|
|
PartnerId string `json:"partnerId,omitempty"`
|
|
PrepayId string `json:"prepayId,omitempty"`
|
|
NonceStr string `json:"nonceStr,omitempty"`
|
|
TimeStamp string `json:"timeStamp,omitempty"`
|
|
Sign string `json:"sign,omitempty"`
|
|
PackageValue string `json:"packageValue,omitempty"`
|
|
OrderStr string `json:"orderStr,omitempty"`
|
|
}
|
|
|
|
// ConfirmOrderReq 确认支付结果(幂等,仅加速刷新,授权以回调为准)
|
|
type ConfirmOrderReq struct {
|
|
g.Meta `path:"/orders/{orderId}/confirm" method:"post" summary:"确认支付结果" tags:"订单"`
|
|
OrderId string `json:"orderId" v:"required" in:"path" dc:"订单号"`
|
|
}
|
|
|
|
// ConfirmOrderRes 确认结果:paid | created | closed
|
|
type ConfirmOrderRes struct {
|
|
Status string `json:"status"`
|
|
}
|