2025-12-10 09:02:41 +08:00
|
|
|
|
package dto
|
|
|
|
|
|
|
|
|
|
|
|
import (
|
|
|
|
|
|
"time"
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
// CreateOrderReq 创建订单请求
|
|
|
|
|
|
|
|
|
|
|
|
type CreateOrderReq struct {
|
|
|
|
|
|
TenantID string `json:"tenant_id" binding:"required"` // 租户ID
|
|
|
|
|
|
UserID string `json:"user_id" binding:"required"` // 用户ID
|
|
|
|
|
|
OrderType string `json:"order_type" binding:"required"` // 订单类型
|
|
|
|
|
|
Subject string `json:"subject" binding:"required"` // 订单标题
|
|
|
|
|
|
Description string `json:"description"` // 订单描述
|
|
|
|
|
|
OrderItems []OrderItemReq `json:"order_items" binding:"required"` // 订单商品
|
|
|
|
|
|
ShippingInfo ShippingInfoReq `json:"shipping_info"` // 收货信息
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// OrderItemReq 创建订单商品项请求
|
|
|
|
|
|
|
|
|
|
|
|
type OrderItemReq struct {
|
2025-12-12 11:03:05 +08:00
|
|
|
|
AssetID string `json:"asset_id" binding:"required"` // 资产ID
|
|
|
|
|
|
AssetName string `json:"asset_name" binding:"required"` // 资产名称
|
|
|
|
|
|
AssetType string `json:"asset_type" binding:"required"` // 资产类型:product-商品型,service-服务型,software-软件型
|
|
|
|
|
|
ImageURL string `json:"image_url"` // 资产图片
|
|
|
|
|
|
Stocks []OrderItemStockReq `json:"stocks" binding:"required"` // 库存项列表
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// OrderItemStockReq 创建订单商品项库存明细请求
|
|
|
|
|
|
|
|
|
|
|
|
type OrderItemStockReq struct {
|
|
|
|
|
|
StockID string `json:"stock_id" binding:"required"` // 库存ID
|
|
|
|
|
|
Price int64 `json:"price" binding:"required,min=1"` // 单价(分)
|
|
|
|
|
|
StockAttrs map[string]interface{} `json:"stock_attrs"` // 库存项属性(动态字段)
|
2025-12-10 09:02:41 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// ShippingInfoReq 收货信息请求
|
|
|
|
|
|
|
|
|
|
|
|
type ShippingInfoReq struct {
|
|
|
|
|
|
Consignee string `json:"consignee" binding:"required"` // 收货人
|
|
|
|
|
|
Phone string `json:"phone" binding:"required"` // 手机号
|
|
|
|
|
|
Province string `json:"province" binding:"required"` // 省份
|
|
|
|
|
|
City string `json:"city" binding:"required"` // 城市
|
|
|
|
|
|
District string `json:"district" binding:"required"` // 区县
|
|
|
|
|
|
Address string `json:"address" binding:"required"` // 详细地址
|
|
|
|
|
|
PostalCode string `json:"postal_code"` // 邮编
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// CreateOrderResp 创建订单响应
|
|
|
|
|
|
|
|
|
|
|
|
type CreateOrderResp struct {
|
|
|
|
|
|
OrderNo string `json:"order_no"` // 订单号
|
|
|
|
|
|
TotalAmount int64 `json:"total_amount"` // 订单总金额
|
|
|
|
|
|
PayAmount int64 `json:"pay_amount"` // 实付金额
|
|
|
|
|
|
ExpiredAt string `json:"expired_at"` // 过期时间
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// PayOrderReq 支付订单请求
|
|
|
|
|
|
|
|
|
|
|
|
type PayOrderReq struct {
|
|
|
|
|
|
TenantID string `json:"tenant_id" binding:"required"` // 租户ID
|
|
|
|
|
|
OrderNo string `json:"order_no" binding:"required"` // 订单号
|
|
|
|
|
|
PayMethod string `json:"pay_method" binding:"required"` // 支付方式:wechat/alipay
|
|
|
|
|
|
PayType string `json:"pay_type" binding:"required"` // 支付类型:native/jsapi/app/h5
|
|
|
|
|
|
ClientIP string `json:"client_ip"` // 客户端IP
|
|
|
|
|
|
OpenID string `json:"openid"` // 用户OpenID(JSAPI支付)
|
|
|
|
|
|
AuthCode string `json:"auth_code"` // 授权码(付款码支付)
|
|
|
|
|
|
ReturnURL string `json:"return_url"` // 支付完成跳转URL
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// PayOrderResp 支付订单响应
|
|
|
|
|
|
|
|
|
|
|
|
type PayOrderResp struct {
|
|
|
|
|
|
OrderNo string `json:"order_no"` // 订单号
|
|
|
|
|
|
QRCode string `json:"qrcode"` // 支付二维码(Native支付)
|
|
|
|
|
|
PayURL string `json:"pay_url"` // 支付链接(H5支付)
|
|
|
|
|
|
PrepayID string `json:"prepay_id"` // 预支付ID(微信)
|
|
|
|
|
|
JSAPIParams string `json:"jsapi_params"` // JSAPI参数(微信)
|
|
|
|
|
|
APPParams string `json:"app_params"` // APP参数
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// QueryOrderReq 查询订单请求
|
|
|
|
|
|
|
|
|
|
|
|
type QueryOrderReq struct {
|
|
|
|
|
|
TenantID string `json:"tenant_id" binding:"required"` // 租户ID
|
|
|
|
|
|
OrderNo string `json:"order_no" binding:"required"` // 订单号
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// QueryOrderResp 查询订单响应
|
|
|
|
|
|
|
|
|
|
|
|
type QueryOrderResp struct {
|
|
|
|
|
|
Order OrderDetail `json:"order"` // 订单详情
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// OrderDetail 订单详情
|
|
|
|
|
|
|
|
|
|
|
|
type OrderDetail struct {
|
|
|
|
|
|
ID string `json:"id"` // 订单ID
|
|
|
|
|
|
TenantID string `json:"tenant_id"` // 租户ID
|
|
|
|
|
|
OrderNo string `json:"order_no"` // 订单号
|
2025-12-12 16:20:47 +08:00
|
|
|
|
UserID int64 `json:"user_id"` // 用户ID
|
2025-12-10 09:02:41 +08:00
|
|
|
|
TotalAmount int64 `json:"total_amount"` // 订单总金额
|
|
|
|
|
|
PayAmount int64 `json:"pay_amount"` // 实付金额
|
|
|
|
|
|
Status string `json:"status"` // 订单状态
|
|
|
|
|
|
PayMethod string `json:"pay_method"` // 支付方式
|
|
|
|
|
|
PayStatus string `json:"pay_status"` // 支付状态
|
|
|
|
|
|
OrderType string `json:"order_type"` // 订单类型
|
|
|
|
|
|
Subject string `json:"subject"` // 订单标题
|
|
|
|
|
|
Description string `json:"description"` // 订单描述
|
|
|
|
|
|
OrderItems []OrderItem `json:"order_items"` // 订单商品
|
|
|
|
|
|
ShippingInfo ShippingInfo `json:"shipping_info"` // 收货信息
|
|
|
|
|
|
PayInfo PayInfo `json:"pay_info"` // 支付信息
|
|
|
|
|
|
CreatedAt time.Time `json:"created_at"` // 创建时间
|
|
|
|
|
|
UpdatedAt time.Time `json:"updated_at"` // 更新时间
|
|
|
|
|
|
PaidAt *time.Time `json:"paid_at"` // 支付时间
|
|
|
|
|
|
ExpiredAt *time.Time `json:"expired_at"` // 过期时间
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// OrderItem 订单商品项(响应)
|
|
|
|
|
|
|
|
|
|
|
|
type OrderItem struct {
|
2025-12-12 11:03:05 +08:00
|
|
|
|
AssetID string `json:"asset_id"` // 资产ID
|
|
|
|
|
|
AssetName string `json:"asset_name"` // 资产名称
|
|
|
|
|
|
AssetType string `json:"asset_type"` // 资产类型:product-商品型,service-服务型,software-软件型
|
|
|
|
|
|
ImageURL string `json:"image_url"` // 资产图片
|
|
|
|
|
|
Quantity int `json:"quantity"` // 总数量
|
|
|
|
|
|
TotalPrice int64 `json:"total_price"` // 小计(分)
|
|
|
|
|
|
Stocks []OrderItemStock `json:"stocks"` // 库存项列表
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// OrderItemStock 订单商品项库存明细(响应)
|
|
|
|
|
|
|
|
|
|
|
|
type OrderItemStock struct {
|
|
|
|
|
|
StockID string `json:"stock_id"` // 库存ID
|
|
|
|
|
|
Price int64 `json:"price"` // 单价(分)
|
|
|
|
|
|
StockAttrs map[string]interface{} `json:"stock_attrs"` // 库存项属性(动态字段)
|
2025-12-10 09:02:41 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// ShippingInfo 收货信息(响应)
|
|
|
|
|
|
|
|
|
|
|
|
type ShippingInfo struct {
|
|
|
|
|
|
Consignee string `json:"consignee"` // 收货人
|
|
|
|
|
|
Phone string `json:"phone"` // 手机号
|
|
|
|
|
|
Province string `json:"province"` // 省份
|
|
|
|
|
|
City string `json:"city"` // 城市
|
|
|
|
|
|
District string `json:"district"` // 区县
|
|
|
|
|
|
Address string `json:"address"` // 详细地址
|
|
|
|
|
|
PostalCode string `json:"postal_code"` // 邮编
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// PayInfo 支付信息(响应)
|
|
|
|
|
|
|
|
|
|
|
|
type PayInfo struct {
|
|
|
|
|
|
TransactionID string `json:"transaction_id"` // 支付平台交易号
|
|
|
|
|
|
OutTradeNo string `json:"out_trade_no"` // 商户订单号
|
|
|
|
|
|
PrepayID string `json:"prepay_id"` // 预支付ID
|
|
|
|
|
|
QRCode string `json:"qrcode"` // 支付二维码
|
|
|
|
|
|
PayURL string `json:"pay_url"` // 支付链接
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// CancelOrderReq 取消订单请求
|
|
|
|
|
|
|
|
|
|
|
|
type CancelOrderReq struct {
|
|
|
|
|
|
TenantID string `json:"tenant_id" binding:"required"` // 租户ID
|
|
|
|
|
|
OrderNo string `json:"order_no" binding:"required"` // 订单号
|
|
|
|
|
|
Reason string `json:"reason"` // 取消原因
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// CancelOrderResp 取消订单响应
|
|
|
|
|
|
|
|
|
|
|
|
type CancelOrderResp struct {
|
|
|
|
|
|
OrderNo string `json:"order_no"` // 订单号
|
|
|
|
|
|
Status string `json:"status"` // 新状态
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// RefundOrderReq 退款请求
|
|
|
|
|
|
|
|
|
|
|
|
type RefundOrderReq struct {
|
|
|
|
|
|
TenantID string `json:"tenant_id" binding:"required"` // 租户ID
|
|
|
|
|
|
OrderNo string `json:"order_no" binding:"required"` // 订单号
|
|
|
|
|
|
RefundAmount int64 `json:"refund_amount" binding:"required"` // 退款金额(分)
|
|
|
|
|
|
Reason string `json:"reason"` // 退款原因
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// RefundOrderResp 退款响应
|
|
|
|
|
|
|
|
|
|
|
|
type RefundOrderResp struct {
|
|
|
|
|
|
RefundNo string `json:"refund_no"` // 退款单号
|
|
|
|
|
|
RefundID string `json:"refund_id"` // 退款ID
|
|
|
|
|
|
RefundAmount int64 `json:"refund_amount"` // 退款金额
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// ListOrdersReq 订单列表请求
|
|
|
|
|
|
|
|
|
|
|
|
type ListOrdersReq struct {
|
|
|
|
|
|
TenantID string `json:"tenant_id" binding:"required"` // 租户ID
|
|
|
|
|
|
UserID string `json:"user_id"` // 用户ID(可选)
|
|
|
|
|
|
Status string `json:"status"` // 订单状态(可选)
|
|
|
|
|
|
Page int `json:"page"` // 页码
|
|
|
|
|
|
PageSize int `json:"page_size"` // 每页大小
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// ListOrdersResp 订单列表响应
|
|
|
|
|
|
|
|
|
|
|
|
type ListOrdersResp struct {
|
|
|
|
|
|
Orders []OrderSummary `json:"orders"` // 订单列表
|
|
|
|
|
|
Total int64 `json:"total"` // 总记录数
|
|
|
|
|
|
Page int `json:"page"` // 当前页码
|
|
|
|
|
|
PageSize int `json:"page_size"` // 每页大小
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// OrderSummary 订单摘要(用于列表)
|
|
|
|
|
|
|
|
|
|
|
|
type OrderSummary struct {
|
|
|
|
|
|
ID string `json:"id"` // 订单ID
|
|
|
|
|
|
OrderNo string `json:"order_no"` // 订单号
|
|
|
|
|
|
TotalAmount int64 `json:"total_amount"` // 订单总金额
|
|
|
|
|
|
PayAmount int64 `json:"pay_amount"` // 实付金额
|
|
|
|
|
|
Status string `json:"status"` // 订单状态
|
|
|
|
|
|
Subject string `json:"subject"` // 订单标题
|
|
|
|
|
|
CreatedAt time.Time `json:"created_at"` // 创建时间
|
|
|
|
|
|
PaidAt *time.Time `json:"paid_at"` // 支付时间
|
|
|
|
|
|
}
|
2025-12-10 13:51:09 +08:00
|
|
|
|
|
|
|
|
|
|
// PaymentNotifyReq 支付回调请求
|
|
|
|
|
|
|
|
|
|
|
|
type PaymentNotifyReq struct {
|
|
|
|
|
|
TenantID string `json:"tenant_id"` // 租户ID
|
|
|
|
|
|
OrderNo string `json:"order_no"` // 订单号
|
|
|
|
|
|
PayMethod string `json:"pay_method"` // 支付方式
|
|
|
|
|
|
Status string `json:"status"` // 支付状态
|
|
|
|
|
|
TransactionID string `json:"transaction_id"` // 交易号
|
|
|
|
|
|
TradeNo string `json:"trade_no"` // 交易号
|
|
|
|
|
|
Sign string `json:"sign"` // 签名
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// PaymentNotifyResp 支付回调响应
|
|
|
|
|
|
|
|
|
|
|
|
type PaymentNotifyResp struct {
|
|
|
|
|
|
Success bool `json:"success"` // 是否成功
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// RefundNotifyReq 退款回调请求
|
|
|
|
|
|
|
|
|
|
|
|
type RefundNotifyReq struct {
|
|
|
|
|
|
TenantID string `json:"tenant_id"` // 租户ID
|
|
|
|
|
|
RefundNo string `json:"refund_no"` // 退款单号
|
|
|
|
|
|
Status string `json:"status"` // 退款状态
|
|
|
|
|
|
RefundID string `json:"refund_id"` // 退款ID
|
|
|
|
|
|
Sign string `json:"sign"` // 签名
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// RefundNotifyResp 退款回调响应
|
|
|
|
|
|
|
|
|
|
|
|
type RefundNotifyResp struct {
|
|
|
|
|
|
Success bool `json:"success"` // 是否成功
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// CreatePaymentConfigReq 创建支付配置请求
|
|
|
|
|
|
|
|
|
|
|
|
type CreatePaymentConfigReq struct {
|
|
|
|
|
|
TenantID string `json:"tenant_id" binding:"required"` // 租户ID
|
|
|
|
|
|
PayMethod string `json:"pay_method" binding:"required"` // 支付方式:wechat/alipay
|
|
|
|
|
|
ConfigName string `json:"config_name" binding:"required"` // 配置名称
|
|
|
|
|
|
Remark string `json:"remark"` // 备注
|
|
|
|
|
|
IsEnabled bool `json:"is_enabled"` // 是否启用
|
|
|
|
|
|
Config map[string]interface{} `json:"config" binding:"required"` // 配置参数
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// UpdatePaymentConfigReq 更新支付配置请求
|
|
|
|
|
|
|
|
|
|
|
|
type UpdatePaymentConfigReq struct {
|
|
|
|
|
|
ID string `json:"id" binding:"required"` // 配置ID
|
|
|
|
|
|
TenantID string `json:"tenant_id" binding:"required"` // 租户ID
|
|
|
|
|
|
ConfigName string `json:"config_name" binding:"required"` // 配置名称
|
|
|
|
|
|
Remark string `json:"remark"` // 备注
|
|
|
|
|
|
IsEnabled bool `json:"is_enabled"` // 是否启用
|
|
|
|
|
|
Config map[string]interface{} `json:"config" binding:"required"` // 配置参数
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// QueryPaymentConfigReq 查询支付配置请求
|
|
|
|
|
|
|
|
|
|
|
|
type QueryPaymentConfigReq struct {
|
|
|
|
|
|
TenantID string `json:"tenant_id" binding:"required"` // 租户ID
|
|
|
|
|
|
PayMethod string `json:"pay_method"` // 支付方式(可选)
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// PaymentConfigResp 支付配置响应
|
|
|
|
|
|
|
|
|
|
|
|
type PaymentConfigResp struct {
|
|
|
|
|
|
ID string `json:"id"` // 配置ID
|
|
|
|
|
|
TenantID string `json:"tenant_id"` // 租户ID
|
|
|
|
|
|
PayMethod string `json:"pay_method"` // 支付方式
|
|
|
|
|
|
ConfigName string `json:"config_name"` // 配置名称
|
|
|
|
|
|
Remark string `json:"remark"` // 备注
|
|
|
|
|
|
IsEnabled bool `json:"is_enabled"` // 是否启用
|
|
|
|
|
|
Config map[string]interface{} `json:"config"` // 配置参数
|
|
|
|
|
|
CreatedAt time.Time `json:"created_at"` // 创建时间
|
|
|
|
|
|
UpdatedAt time.Time `json:"updated_at"` // 更新时间
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// WechatConfig 微信支付配置
|
|
|
|
|
|
|
|
|
|
|
|
type WechatConfig struct {
|
|
|
|
|
|
ID string `json:"id"` // 配置ID
|
|
|
|
|
|
TenantID string `json:"tenant_id"` // 租户ID
|
|
|
|
|
|
ConfigName string `json:"config_name"` // 配置名称
|
|
|
|
|
|
AppID string `json:"app_id"` // 应用ID
|
|
|
|
|
|
MchID string `json:"mch_id"` // 商户号
|
|
|
|
|
|
APIKey string `json:"api_key"` // API密钥
|
|
|
|
|
|
NotifyURL string `json:"notify_url"` // 回调地址
|
|
|
|
|
|
ReturnURL string `json:"return_url"` // 返回地址
|
|
|
|
|
|
CertPath string `json:"cert_path"` // 证书路径
|
|
|
|
|
|
KeyPath string `json:"key_path"` // 密钥路径
|
|
|
|
|
|
Sandbox bool `json:"sandbox"` // 是否沙箱环境
|
|
|
|
|
|
SupportNative bool `json:"support_native"` // 支持扫码支付
|
|
|
|
|
|
SupportJSAPI bool `json:"support_jsapi"` // 支持JSAPI支付
|
|
|
|
|
|
SupportAPP bool `json:"support_app"` // 支持APP支付
|
|
|
|
|
|
SupportH5 bool `json:"support_h5"` // 支持H5支付
|
|
|
|
|
|
GatewayURL string `json:"gateway_url"` // 网关地址
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// AlipayConfig 支付宝支付配置
|
|
|
|
|
|
|
|
|
|
|
|
type AlipayConfig struct {
|
|
|
|
|
|
ID string `json:"id"` // 配置ID
|
|
|
|
|
|
TenantID string `json:"tenant_id"` // 租户ID
|
|
|
|
|
|
ConfigName string `json:"config_name"` // 配置名称
|
|
|
|
|
|
AppID string `json:"app_id"` // 应用ID
|
|
|
|
|
|
NotifyURL string `json:"notify_url"` // 回调地址
|
|
|
|
|
|
ReturnURL string `json:"return_url"` // 返回地址
|
|
|
|
|
|
AppPrivateKey string `json:"app_private_key"` // 应用私钥
|
|
|
|
|
|
AlipayPublicKey string `json:"alipay_public_key"` // 支付宝公钥
|
|
|
|
|
|
Sandbox bool `json:"sandbox"` // 是否沙箱环境
|
|
|
|
|
|
GatewayURL string `json:"gateway_url"` // 网关地址
|
|
|
|
|
|
SupportNative bool `json:"support_native"` // 支持扫码支付
|
|
|
|
|
|
SupportJSAPI bool `json:"support_jsapi"` // 支持JSAPI支付
|
|
|
|
|
|
SupportAPP bool `json:"support_app"` // 支持APP支付
|
|
|
|
|
|
SupportH5 bool `json:"support_h5"` // 支持H5支付
|
|
|
|
|
|
}
|