优化表结构,重构模型,重新实现基于白银网关的提取节点流程
This commit is contained in:
74
web/models/trade.go
Normal file
74
web/models/trade.go
Normal file
@@ -0,0 +1,74 @@
|
||||
package models
|
||||
|
||||
import (
|
||||
"platform/web/core"
|
||||
"time"
|
||||
|
||||
"github.com/shopspring/decimal"
|
||||
)
|
||||
|
||||
// Trade 订单表
|
||||
type Trade struct {
|
||||
core.Model
|
||||
UserID int32 `json:"user_id" gorm:"column:user_id"` // 用户ID
|
||||
InnerNo string `json:"inner_no" gorm:"column:inner_no"` // 内部订单号
|
||||
OuterNo *string `json:"outer_no" gorm:"column:outer_no"` // 外部订单号
|
||||
Type TradeType `json:"type" gorm:"column:type"` // 订单类型:1-购买产品,2-充值余额
|
||||
Subject string `json:"subject" gorm:"column:subject"` // 订单主题
|
||||
Remark *string `json:"remark" gorm:"column:remark"` // 订单备注
|
||||
Amount decimal.Decimal `json:"amount" gorm:"column:amount"` // 订单总金额
|
||||
Payment decimal.Decimal `json:"payment" gorm:"column:payment"` // 实际支付金额
|
||||
Method TradeMethod `json:"method" gorm:"column:method"` // 支付方式:1-支付宝,2-微信,3-商福通,4-商福通渠道支付宝,5-商福通渠道微信
|
||||
Platform TradePlatform `json:"platform" gorm:"column:platform"` // 支付平台:1-电脑网站,2-手机网站
|
||||
Acquirer *TradeAcquirer `json:"acquirer" gorm:"column:acquirer"` // 收单机构:1-支付宝,2-微信,3-银联
|
||||
Status TradeStatus `json:"status" gorm:"column:status"` // 订单状态:0-待支付,1-已支付,2-已取消
|
||||
Refunded bool `json:"refunded" gorm:"column:refunded"` // 是否已退款
|
||||
PaymentURL *string `json:"payment_url" gorm:"column:payment_url"` // 支付链接
|
||||
CompletedAt *time.Time `json:"completed_at" gorm:"column:completed_at"` // 支付时间
|
||||
CanceledAt *time.Time `json:"canceled_at" gorm:"column:canceled_at"` // 取消时间
|
||||
}
|
||||
|
||||
// TradeType 订单类型枚举
|
||||
type TradeType int
|
||||
|
||||
const (
|
||||
TradeTypePurchase TradeType = 1 // 购买产品
|
||||
TradeTypeRecharge TradeType = 2 // 充值余额
|
||||
)
|
||||
|
||||
// TradeMethod 支付方式枚举
|
||||
type TradeMethod int
|
||||
|
||||
const (
|
||||
TradeMethodAlipay TradeMethod = 1 // 支付宝
|
||||
TradeMethodWechat TradeMethod = 2 // 微信
|
||||
TradeMethodSft TradeMethod = 3 // 商福通
|
||||
TradeMethodSftAlipay TradeMethod = 4 // 商福通渠道支付宝
|
||||
TradeMethodSftWechat TradeMethod = 5 // 商福通渠道微信
|
||||
)
|
||||
|
||||
// TradePlatform 支付平台枚举
|
||||
type TradePlatform int
|
||||
|
||||
const (
|
||||
TradePlatformPC TradePlatform = 1 // 电脑网站
|
||||
TradePlatformMobile TradePlatform = 2 // 手机网站
|
||||
)
|
||||
|
||||
// TradeAcquirer 收单机构枚举
|
||||
type TradeAcquirer int
|
||||
|
||||
const (
|
||||
TradeAcquirerAlipay TradeAcquirer = 1 // 支付宝
|
||||
TradeAcquirerWechat TradeAcquirer = 2 // 微信
|
||||
TradeAcquirerUnionPay TradeAcquirer = 3 // 银联
|
||||
)
|
||||
|
||||
// TradeStatus 订单状态枚举
|
||||
type TradeStatus int
|
||||
|
||||
const (
|
||||
TradeStatusPending TradeStatus = 0 // 待支付
|
||||
TradeStatusSuccess TradeStatus = 1 // 已支付
|
||||
TradeStatusCanceled TradeStatus = 2 // 已取消
|
||||
)
|
||||
Reference in New Issue
Block a user