调整交易和账单模型,完善支付与用户余额基础处理逻辑

This commit is contained in:
2025-04-09 16:34:41 +08:00
parent 4c47a71f30
commit 02897db890
10 changed files with 203 additions and 85 deletions

View File

@@ -17,8 +17,6 @@ type Bill struct {
ID int32 `gorm:"column:id;primaryKey;autoIncrement:true;comment:账单ID" json:"id"` // 账单ID
UserID int32 `gorm:"column:user_id;not null;comment:用户ID" json:"user_id"` // 用户ID
Info string `gorm:"column:info;comment:产品可读信息" json:"info"` // 产品可读信息
Amount float64 `gorm:"column:amount;not null;comment:总金额" json:"amount"` // 总金额
Payment float64 `gorm:"column:payment;not null;comment:支付金额" json:"payment"` // 支付金额
CreatedAt time.Time `gorm:"column:created_at;default:CURRENT_TIMESTAMP;comment:创建时间" json:"created_at"` // 创建时间
UpdatedAt time.Time `gorm:"column:updated_at;default:CURRENT_TIMESTAMP;comment:更新时间" json:"updated_at"` // 更新时间
DeletedAt gorm.DeletedAt `gorm:"column:deleted_at;comment:删除时间" json:"deleted_at"` // 删除时间
@@ -26,6 +24,8 @@ type Bill struct {
ResourceID int32 `gorm:"column:resource_id" json:"resource_id"`
Type int32 `gorm:"column:type;not null" json:"type"`
BillNo string `gorm:"column:bill_no;not null" json:"bill_no"`
RefundID int32 `gorm:"column:refund_id" json:"refund_id"`
Status int32 `gorm:"column:status;not null" json:"status"`
}
// TableName Bill's table name

View File

@@ -17,7 +17,7 @@ type Trade struct {
ID int32 `gorm:"column:id;primaryKey;autoIncrement:true;comment:订单ID" json:"id"` // 订单ID
UserID int32 `gorm:"column:user_id;not null;comment:用户ID" json:"user_id"` // 用户ID
InnerNo string `gorm:"column:inner_no;not null;comment:内部订单号" json:"inner_no"` // 内部订单号
OuterNo string `gorm:"column:outer_no;not null;comment:外部订单号" json:"outer_no"` // 外部订单号
OuterNo string `gorm:"column:outer_no;comment:外部订单号" json:"outer_no"` // 外部订单号
Subject string `gorm:"column:subject;not null;comment:订单主题" json:"subject"` // 订单主题
Remark string `gorm:"column:remark;comment:订单备注" json:"remark"` // 订单备注
Amount float64 `gorm:"column:amount;not null;comment:订单总金额" json:"amount"` // 订单总金额
@@ -27,6 +27,9 @@ type Trade struct {
CreatedAt time.Time `gorm:"column:created_at;default:CURRENT_TIMESTAMP;comment:创建时间" json:"created_at"` // 创建时间
UpdatedAt time.Time `gorm:"column:updated_at;default:CURRENT_TIMESTAMP;comment:更新时间" json:"updated_at"` // 更新时间
DeletedAt gorm.DeletedAt `gorm:"column:deleted_at;comment:删除时间" json:"deleted_at"` // 删除时间
Type int32 `gorm:"column:type;not null" json:"type"`
CancelAt time.Time `gorm:"column:cancel_at" json:"cancel_at"`
PaidAt time.Time `gorm:"column:paid_at" json:"paid_at"`
}
// TableName Trade's table name