Files
zhengchiliu b94dd6dffb feat(order): 重构退款全流程并新增申请退款中状态
- 订单状态新增「6 申请退款中」,用户申请退款原子流转并落待审核退款流水
- 退款失败回退订单至已支付并恢复被取消的权益发放任务
- 新增虚拟支付退款查单兜底任务,反查超时订单并自动订正
- 会员包来源额度不叠加,扣减/回退/回收口径统一为只取生效一份
- 退款回收流水按吊销前后有效剩余差值记账,避免无效回收记录
- 同步更新 README 与 Stitch 设计文档
2026-09-16 03:44:09 +08:00

87 lines
3.2 KiB
Go
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
package dto
// OrderCreateRequest 创建订单
type OrderCreateRequest struct {
GoodsCode string `json:"goods_code" binding:"required"`
}
// OrderCreateResponse 创建订单响应
type OrderCreateResponse struct {
OrderNo string `json:"order_no"`
PayAmount int64 `json:"pay_amount"` // 应付(分)
ExpireTime int64 `json:"expire_time"` // 支付截止(秒),前端倒计时
PayParams *WechatPayParams `json:"pay_params"` // 小程序拉起支付参数
}
// WechatPayParams 微信小程序支付参数
type WechatPayParams struct {
TimeStamp string `json:"timeStamp"`
NonceStr string `json:"nonceStr"`
Package string `json:"package"`
SignType string `json:"signType"`
PaySign string `json:"paySign"`
}
// VirtualOrderCreateRequest 创建虚拟支付订单(小程序虚拟支付,覆盖 iOS/Android 全终端)
type VirtualOrderCreateRequest struct {
GoodsCode string `json:"goods_code" binding:"required"` // 商品编码
Platform string `json:"platform" binding:"required,oneof=android ios harmony windows"` // 支付平台(前端按 systemInfo.platform 上报)
}
// VirtualOrderCreateResponse 虚拟支付订单响应(前端据此调 wx.requestVirtualPayment)
type VirtualOrderCreateResponse struct {
OrderNo string `json:"order_no"` // 业务订单号(作为 outTradeNo)
PayAmount int64 `json:"pay_amount"` // 实付金额(分)
ExpireTime int64 `json:"expire_time"` // 支付截止(秒),前端倒计时
SignData string `json:"sign_data"` // 参与签名的 JSON 字符串(原样传给前端)
PaySig string `json:"pay_sig"` // 支付签名
Signature string `json:"signature"` // 用户态签名
}
// OrderResponse 订单信息
type OrderResponse struct {
OrderNo string `json:"order_no"`
GoodsName string `json:"goods_name"`
UnitPrice int64 `json:"unit_price"` // 单价(分)
PayAmount int64 `json:"pay_amount"` // 实付(分)
PayChannel int8 `json:"pay_channel"` // 支付渠道 1=微信支付 2=虚拟支付
OrderStatus int8 `json:"order_status"` // 1=待支付 2=已支付 3=已取消 4=已过期 5=已退款 6=申请退款中
MemberDays int64 `json:"member_days"`
ExpireTime int64 `json:"expire_time"`
PayTime int64 `json:"pay_time"`
RefundTime int64 `json:"refund_time"`
RefundAmount int64 `json:"refund_amount"`
CreatedAt int64 `json:"created_at"`
}
// OrderListRequest 订单列表
type OrderListRequest struct {
PageRequest
Status int8 `form:"status" binding:"omitempty,oneof=1 2 3 4 5 6"`
}
// OrderListResponse 订单列表
type OrderListResponse struct {
PageResponse
List []OrderResponse `json:"list"`
}
// OrderCancelRequest 取消订单
type OrderCancelRequest struct {
OrderNo string `json:"order_no" binding:"required"`
}
// RefundApplyRequest 申请退款
type RefundApplyRequest struct {
OrderNo string `json:"order_no" binding:"required"`
Reason string `json:"reason" binding:"required,max=200"`
}
// RefundResponse 退款信息
type RefundResponse struct {
RefundNo string `json:"refund_no"`
RefundAmount int64 `json:"refund_amount"`
Status int8 `json:"status"` // 0=待处理 1=退款中 2=成功 3=失败
ApplyTime int64 `json:"apply_time"`
}