59 lines
2.9 KiB
Go
59 lines
2.9 KiB
Go
package model
|
|
|
|
import "time"
|
|
|
|
// ProfitSharingStatus 分润状态
|
|
type ProfitSharingStatus string
|
|
|
|
const (
|
|
ProfitSharingStatusPending ProfitSharingStatus = "PENDING"
|
|
ProfitSharingStatusProcessing ProfitSharingStatus = "PROCESSING"
|
|
ProfitSharingStatusSuccess ProfitSharingStatus = "SUCCESS"
|
|
ProfitSharingStatusFailed ProfitSharingStatus = "FAILED"
|
|
ProfitSharingStatusRollback ProfitSharingStatus = "ROLLBACK"
|
|
)
|
|
|
|
// ProfitSharingConfig 分润配置(应用级)
|
|
type ProfitSharingConfig struct {
|
|
ID uint64 `gorm:"column:id;primaryKey;autoIncrement"`
|
|
AppID string `gorm:"column:app_id;size:32;not null;uniqueIndex"`
|
|
ReceiverMerchantID string `gorm:"column:receiver_merchant_id;size:64;not null"`
|
|
ReceiverType string `gorm:"column:receiver_type;size:20;not null"` // PLATFORM / SUB_MERCHANT
|
|
MaxSharingRatio float64 `gorm:"column:max_sharing_ratio;type:decimal(5,4);not null"`
|
|
Status int8 `gorm:"column:status;not null;default:1"`
|
|
CreatedAt time.Time `gorm:"column:created_at;autoCreateTime:milli"`
|
|
UpdatedAt time.Time `gorm:"column:updated_at;autoUpdateTime:milli"`
|
|
}
|
|
|
|
func (ProfitSharingConfig) TableName() string { return "profit_sharing_config" }
|
|
|
|
// ProfitSharingOrder 分润记录
|
|
type ProfitSharingOrder struct {
|
|
ID uint64 `gorm:"column:id;primaryKey;autoIncrement"`
|
|
SharingNo string `gorm:"column:sharing_no;uniqueIndex;size:32;not null"`
|
|
TradeNo string `gorm:"column:trade_no;uniqueIndex;size:32;not null"`
|
|
AppID string `gorm:"column:app_id;size:32;not null"`
|
|
ReceiverMerchantID string `gorm:"column:receiver_merchant_id;size:64;not null"`
|
|
SharingAmount int64 `gorm:"column:sharing_amount;not null"`
|
|
Status ProfitSharingStatus `gorm:"column:status;size:20;not null;default:PENDING"`
|
|
ChannelSharingNo string `gorm:"column:channel_sharing_no;size:64"`
|
|
FailReason string `gorm:"column:fail_reason;size:256"`
|
|
SharingTime *time.Time `gorm:"column:sharing_time"`
|
|
CreatedAt time.Time `gorm:"column:created_at;autoCreateTime:milli"`
|
|
UpdatedAt time.Time `gorm:"column:updated_at;autoUpdateTime:milli"`
|
|
}
|
|
|
|
func (ProfitSharingOrder) TableName() string { return "profit_sharing_order" }
|
|
|
|
// ProfitSharingLog 分润流水
|
|
type ProfitSharingLog struct {
|
|
ID uint64 `gorm:"column:id;primaryKey;autoIncrement"`
|
|
SharingNo string `gorm:"column:sharing_no;size:32;not null;index"`
|
|
Action string `gorm:"column:action;size:20;not null"` // SPLIT / ROLLBACK
|
|
Amount int64 `gorm:"column:amount;not null"`
|
|
Status string `gorm:"column:status;size:20;not null"`
|
|
CreatedAt time.Time `gorm:"column:created_at;autoCreateTime:milli"`
|
|
}
|
|
|
|
func (ProfitSharingLog) TableName() string { return "profit_sharing_log" }
|