35 lines
1.3 KiB
Go
35 lines
1.3 KiB
Go
package models
|
||
|
||
import (
|
||
"platform/web/core"
|
||
|
||
"github.com/shopspring/decimal"
|
||
)
|
||
|
||
// Bill 账单表
|
||
type Bill struct {
|
||
core.Model
|
||
UserID int32 `json:"user_id" gorm:"column:user_id"` // 用户ID
|
||
TradeID *int32 `json:"trade_id" gorm:"column:trade_id"` // 订单ID
|
||
ResourceID *int32 `json:"resource_id" gorm:"column:resource_id"` // 套餐ID
|
||
RefundID *int32 `json:"refund_id" gorm:"column:refund_id"` // 退款ID
|
||
BillNo string `json:"bill_no" gorm:"column:bill_no"` // 易读账单号
|
||
Info *string `json:"info" gorm:"column:info"` // 产品可读信息
|
||
Type BillType `json:"type" gorm:"column:type"` // 账单类型:1-消费,2-退款,3-充值
|
||
Amount decimal.Decimal `json:"amount" gorm:"column:amount"` // 账单金额
|
||
|
||
User *User `json:"user" gorm:"foreignKey:UserID"`
|
||
Trade *Trade `json:"trade" gorm:"foreignKey:TradeID"`
|
||
Resource *Resource `json:"resource" gorm:"foreignKey:ResourceID"`
|
||
Refund *Refund `json:"refund" gorm:"foreignKey:RefundID"`
|
||
}
|
||
|
||
// BillType 账单类型枚举
|
||
type BillType int
|
||
|
||
const (
|
||
BillTypeConsume BillType = 1 // 消费
|
||
BillTypeRefund BillType = 2 // 退款
|
||
BillTypeRecharge BillType = 3 // 充值
|
||
)
|