Files
go-sms-V2/internal/model/entity/billing.go
T

79 lines
3.7 KiB
Go

package entity
import "time"
// BillingOrder 充值订单(付款审核确认后到账)。
type BillingOrder struct {
ID int64 `gorm:"primaryKey;autoIncrement" json:"id"`
OrderNo string `gorm:"size:32;uniqueIndex:uk_order_no" json:"order_no"`
AccountID int64 `gorm:"index:idx_account_time,priority:1" json:"account_id"`
Amount float64 `gorm:"type:decimal(12,2)" json:"amount"`
Count int64 `json:"count"`
PayType string `gorm:"size:16" json:"pay_type"`
PayStatus int8 `gorm:"index:idx_pay_status;default:0" json:"pay_status"` // 0待1到账2失败
Operator string `gorm:"size:64" json:"operator"`
PaidAt *time.Time `json:"paid_at"`
Remark string `gorm:"size:255" json:"remark"`
CreatedAt time.Time `gorm:"autoCreateTime;index:idx_account_time,priority:2" json:"created_at"`
}
func (BillingOrder) TableName() string { return "billing_order" }
// BillingConsumeLog 消耗日志(按账号/业务/天)。
type BillingConsumeLog struct {
ID int64 `gorm:"primaryKey;autoIncrement" json:"id"`
AccountID int64 `gorm:"uniqueIndex:uk_account_date,priority:1" json:"account_id"`
Business string `gorm:"size:16;uniqueIndex:uk_account_date,priority:2;default:sms" json:"business"`
StatDate time.Time `gorm:"type:date;uniqueIndex:uk_account_date,priority:3" json:"stat_date"`
SubmitCount int `json:"submit_count"`
SuccessCount int `json:"success_count"`
FailCount int `json:"fail_count"`
FeeTotal float64 `gorm:"type:decimal(12,4)" json:"fee_total"`
CreatedAt time.Time `gorm:"autoCreateTime" json:"created_at"`
}
func (BillingConsumeLog) TableName() string { return "billing_consume_log" }
// SettleCustomer 下家(客户)月度结算单。
type SettleCustomer struct {
ID int64 `gorm:"primaryKey;autoIncrement" json:"id"`
SettleNo string `gorm:"size:32" json:"settle_no"`
AccountID int64 `gorm:"uniqueIndex:uk_account_period,priority:1" json:"account_id"`
Period string `gorm:"size:7;uniqueIndex:uk_account_period,priority:2;index:idx_period" json:"period"`
SuccessCount int64 `json:"success_count"`
Amount float64 `gorm:"type:decimal(12,2)" json:"amount"`
Status int8 `gorm:"default:0" json:"status"`
CreatedAt time.Time `gorm:"autoCreateTime" json:"created_at"`
}
func (SettleCustomer) TableName() string { return "settle_customer" }
// SettleUpstream 上家月度结算单。
type SettleUpstream struct {
ID int64 `gorm:"primaryKey;autoIncrement" json:"id"`
SettleNo string `gorm:"size:32" json:"settle_no"`
UpstreamID int64 `gorm:"uniqueIndex:uk_upstream_period,priority:1" json:"upstream_id"`
Period string `gorm:"size:7;uniqueIndex:uk_upstream_period,priority:2;index:idx_period" json:"period"`
SuccessCount int64 `json:"success_count"`
Amount float64 `gorm:"type:decimal(12,2)" json:"amount"`
Status int8 `gorm:"default:0" json:"status"`
CreatedAt time.Time `gorm:"autoCreateTime" json:"created_at"`
}
func (SettleUpstream) TableName() string { return "settle_upstream" }
// SettleRecord 结账记录。
type SettleRecord struct {
ID int64 `gorm:"primaryKey;autoIncrement" json:"id"`
SettleNo string `gorm:"size:32;index:idx_settle_no" json:"settle_no"`
Direction int8 `gorm:"default:1" json:"direction"` // 1下家 2上家
Amount float64 `gorm:"type:decimal(12,2)" json:"amount"`
PayType string `gorm:"size:16" json:"pay_type"`
Operator string `gorm:"size:64" json:"operator"`
SettledAt time.Time `json:"settled_at"`
Remark string `gorm:"size:255" json:"remark"`
CreatedAt time.Time `gorm:"autoCreateTime" json:"created_at"`
}
func (SettleRecord) TableName() string { return "settle_record" }