- 新增用户订单号字段以区分内部订单号 - 修改订单表结构添加 user_order_id 字段及索引 - 更新 CreateOrder 接口支持用户订单号参数-重构 CreateOrder 和 GetPaymentUrl 方法返回统一结果对象 - 新增模型定义用于封装订单创建与支付结果 - 调整相关逻辑方法签名与调用方式适配新结构- 优化订单创建流程增加内部订单号生成逻辑 - 完善订单查询逻辑确保正确关联用户订单号- 更新控制器层对接新版服务接口- 升级 Cookie 状态及订单状态管理枚举类型使用
36 lines
1.3 KiB
Go
36 lines
1.3 KiB
Go
package model
|
|
|
|
import "kami/internal/consts"
|
|
|
|
// ====================================================================================
|
|
// JD Cookie 相关模型结构体
|
|
// ====================================================================================
|
|
|
|
// CreateOrderResult 创建订单返回结果
|
|
type CreateOrderResult struct {
|
|
WxPayUrl string `json:"wxPayUrl" dc:"微信支付链接"`
|
|
JdOrderId string `json:"jdOrderId" dc:"京东订单号"`
|
|
OrderId string `json:"orderId" dc:"内部订单号"`
|
|
}
|
|
|
|
// PaymentResult 支付结果
|
|
type PaymentResult struct {
|
|
WxPayUrl string `json:"wxPayUrl" dc:"微信支付链接"`
|
|
JdOrderId string `json:"jdOrderId" dc:"京东订单号"`
|
|
OrderId string `json:"orderId" dc:"内部订单号"`
|
|
}
|
|
|
|
// CreateNewJdOrderWithRetryReq 创建新的京东订单请求参数
|
|
type CreateNewJdOrderWithRetryReq struct {
|
|
OrderId string `json:"orderId" dc:"内部订单号"`
|
|
Amount float64 `json:"amount" dc:"订单金额"`
|
|
Category consts.RedeemOrderCardCategory `json:"category" dc:"卡券类别"`
|
|
}
|
|
|
|
// CreateNewJdOrderWithRetryRes 创建新的京东订单返回结果
|
|
type CreateNewJdOrderWithRetryRes struct {
|
|
JdOrderId string `json:"jdOrderId" dc:"京东订单号"`
|
|
CookieId string `json:"cookieId" dc:"Cookie ID"`
|
|
WxPayUrl string `json:"wxPayUrl" dc:"微信支付链接"`
|
|
}
|