小程序一些功能更新
This commit is contained in:
94
api/user/v1/order.go
Normal file
94
api/user/v1/order.go
Normal file
@@ -0,0 +1,94 @@
|
||||
package v1
|
||||
|
||||
import "github.com/gogf/gf/v2/frame/g"
|
||||
|
||||
// ============================================================================
|
||||
// 用户端 · 会员 / 次数包订单(N1 两步式:建单 / 建签名 / 详情 / 应用优惠)
|
||||
//
|
||||
// 铁律 S1:响应一律 snake_case。请求沿用 member / quota 组既有字段名(snake_case)。
|
||||
//
|
||||
// 正当例外(非豁免):微信虚拟支付规定字段 signData / paySig / signature / env 由客户端
|
||||
// 原样交给 wx.requestVirtualPayment,**必须原样透传、禁止改名**(改名会导致收银台直接失败)。
|
||||
// 此类「外部平台规定」的命名不受 S1 约束(见 MemberOrderPayRes)。
|
||||
// ============================================================================
|
||||
|
||||
// MemberOrderPayReq 对已建订单构建支付参数(O2)
|
||||
type MemberOrderPayReq struct {
|
||||
g.Meta `path:"/member/order/pay" method:"post" tags:"member" summary:"对已建订单构建支付参数"`
|
||||
OutTradeNo string `v:"required#订单号不能为空" json:"out_trade_no"`
|
||||
Code string `v:"required#缺少微信登录凭证" json:"code"`
|
||||
}
|
||||
|
||||
// MemberOrderPayRes 虚拟支付参数(O2 / O6)。
|
||||
//
|
||||
// ⚠️ SignData / PaySig / Signature / Env 的字段名由微信 wx.requestVirtualPayment 规定,
|
||||
// 必须原样透传、禁止改动(改名会导致收银台直接失败)。
|
||||
type MemberOrderPayRes struct {
|
||||
OutTradeNo string `json:"out_trade_no"`
|
||||
Mode string `json:"mode"` // 固定 short_series_goods
|
||||
SignData string `json:"signData"`
|
||||
PaySig string `json:"paySig"`
|
||||
Signature string `json:"signature"`
|
||||
Env int `json:"env"`
|
||||
}
|
||||
|
||||
// QuotaOrderPayReq 次数包订单构建支付参数(O6,与会员完全同构)
|
||||
type QuotaOrderPayReq struct {
|
||||
g.Meta `path:"/quota/order/pay" method:"post" tags:"quota" summary:"次数包订单构建支付参数"`
|
||||
OutTradeNo string `v:"required#订单号不能为空" json:"out_trade_no"`
|
||||
Code string `v:"required#缺少微信登录凭证" json:"code"`
|
||||
}
|
||||
|
||||
// QuotaOrderPayRes 次数包支付参数(与会员完全同构)
|
||||
type QuotaOrderPayRes = MemberOrderPayRes
|
||||
|
||||
// MemberOrderDetailReq 订单详情(O3)
|
||||
type MemberOrderDetailReq struct {
|
||||
g.Meta `path:"/member/order/detail" method:"get" tags:"member" summary:"订单详情"`
|
||||
OutTradeNo string `v:"required#订单号不能为空" json:"out_trade_no"`
|
||||
}
|
||||
|
||||
// MemberOrderDetailRes 订单详情(O3,响应 snake_case)。
|
||||
type MemberOrderDetailRes struct {
|
||||
OutTradeNo string `json:"out_trade_no"`
|
||||
OrderType int `json:"order_type"` // 1 套餐 2 次数包
|
||||
Title string `json:"title"` // 套餐名 / 次数包名
|
||||
PlanKey string `json:"plan_key"`
|
||||
PlanName string `json:"plan_name"`
|
||||
PackKey string `json:"pack_key"` // 次数包 key(order_type=2 时用于查询可选免单券)
|
||||
ToolKey string `json:"tool_key"`
|
||||
ToolName string `json:"tool_name"`
|
||||
Times int `json:"times"`
|
||||
OriginPriceCents int64 `json:"origin_price_cents"`
|
||||
PaidPriceCents int64 `json:"paid_price_cents"`
|
||||
DiscountCents int64 `json:"discount_cents"`
|
||||
PromoKind int `json:"promo_kind"` // 0 无 1 优惠码 2 免单券
|
||||
PromoCode string `json:"promo_code"`
|
||||
UserCouponId int64 `json:"user_coupon_id"`
|
||||
Status int `json:"status"` // 0 待支付 1 已发货 2 已退款 3 已关闭
|
||||
StatusText string `json:"status_text"`
|
||||
CreatedAt string `json:"created_at"`
|
||||
DeliveredAt string `json:"delivered_at"`
|
||||
}
|
||||
|
||||
// MemberOrderApplyVoucherReq 应用 / 更换 / 清除优惠(O4)。
|
||||
//
|
||||
// PromoCode 与 UserCouponId **互斥**:同时传 → 4010(后端校验,不靠前端隐藏);两者皆空 = 清除优惠。
|
||||
type MemberOrderApplyVoucherReq struct {
|
||||
g.Meta `path:"/member/order/apply-voucher" method:"post" tags:"member" summary:"应用/更换/清除优惠"`
|
||||
OutTradeNo string `v:"required#订单号不能为空" json:"out_trade_no"`
|
||||
PromoCode string `json:"promo_code"`
|
||||
UserCouponId int64 `json:"user_coupon_id"`
|
||||
}
|
||||
|
||||
// MemberOrderApplyVoucherRes 应用优惠结果(O4,响应 snake_case)。
|
||||
type MemberOrderApplyVoucherRes struct {
|
||||
Valid bool `json:"valid"`
|
||||
OriginPriceCents int64 `json:"origin_price_cents"`
|
||||
PaidPriceCents int64 `json:"paid_price_cents"`
|
||||
DiscountCents int64 `json:"discount_cents"`
|
||||
PromoKind int `json:"promo_kind"`
|
||||
PromoCode string `json:"promo_code"`
|
||||
UserCouponId int64 `json:"user_coupon_id"`
|
||||
Message string `json:"message"`
|
||||
}
|
||||
Reference in New Issue
Block a user