27 lines
1.8 KiB
Go
27 lines
1.8 KiB
Go
|
|
package models
|
|||
|
|
|
|||
|
|
import (
|
|||
|
|
"time"
|
|||
|
|
|
|||
|
|
"git.apinb.com/bsm-sdk/core/database"
|
|||
|
|
)
|
|||
|
|
|
|||
|
|
// WalletRefund 对应 wallet_refund,保存支付退款结果。
|
|||
|
|
type WalletRefund struct {
|
|||
|
|
Entity // 公共实体字段
|
|||
|
|
WalletBasicID uint64 `gorm:"column:wallet_basic_id;not null;index" json:"wallet_basic_id"` // 钱包自增主键
|
|||
|
|
WalletPaymentID uint64 `gorm:"column:wallet_payment_id;not null;index" json:"wallet_payment_id"` // 原支付记录自增主键
|
|||
|
|
RefundNo string `gorm:"column:refund_no;type:varchar(64);not null;uniqueIndex" json:"refund_no"` // 内部退款单号
|
|||
|
|
OrderIdentity string `gorm:"column:order_identity;type:varchar(64);not null;index" json:"order_identity"` // 订单业务标识
|
|||
|
|
Amount int64 `gorm:"column:amount;not null;check:amount > 0" json:"amount"` // 退款金额,单位分
|
|||
|
|
Fee int64 `gorm:"column:fee;not null;default:0;check:fee >= 0" json:"fee"` // 退款手续费,单位分
|
|||
|
|
Reason string `gorm:"column:reason;type:text;not null;default:''" json:"reason"` // 退款原因
|
|||
|
|
OrderInfo string `gorm:"column:order_info;type:text;not null;default:''" json:"order_info"` // 订单信息快照
|
|||
|
|
Result string `gorm:"column:result;type:text;not null;default:''" json:"result"` // 第三方处理结果
|
|||
|
|
TradeNo string `gorm:"column:trade_no;type:varchar(128);not null;default:'';index" json:"trade_no"` // 第三方退款流水号
|
|||
|
|
CompletedAt *time.Time `gorm:"column:completed_at;type:timestamptz" json:"completed_at"` // 完成时间
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
func init() { database.AppendMigrate(&WalletRefund{}) }
|
|||
|
|
func (table *WalletRefund) TableName() string { return "wallet_refund" }
|