package model import ( "bkb-seller/global" "gorm.io/gorm" ) type Bill struct { global.MG_MODEL UserID string `gorm:"size:50;index" json:"userID"` //用户id Type string `gorm:"size:1;default:1" json:"type"` //类型 1-佣金 2-订单 3-提现 Title string `gorm:"size:255" json:"title"` // 账单标题 Account string `gorm:"size:50" json:"account"` //收款账户(提现) OrderID string `gorm:"size:50" json:"order_id"` //关联订单id WithdID string `gorm:"size:50" json:"withd_id"` //提现id Price float64 `gorm:"type:decimal(10,2)" json:"price"` //价格 Balance float64 `gorm:"type:decimal(10,2)" json:"balance"` //余额 Amount int `gorm:"type:int(2);default:1" json:"amount"` //数量 Status int `gorm:"type:int(1);default:0" json:"status"` //类型 1-支出 2-收入 Receipt int `gorm:"type:tinyint(1)" json:"receipt"` //是否已到账 1-是 2-否 3-已取消付款 WithdrawalStatus int `gorm:"type:tinyint(1)" json:"withdrawalStatus"` //提现状态 0-提现中 1-提现完成 2-提现失败 CheckStatus string `gorm:"size:1" json:"check_status"` // 审核状态 0:待审核 1:审核通过 2:审核未通过 Remark string `gorm:"size:50" json:"remark"` //备注 Platform string `gorm:"size:50" json:"platform"` //平台 saller / customer / influencer TransactionId string `gorm:"size:50" json:"transaction_id"` // 交易编号 } type BillList struct { Bill } type BillTotal struct { Income float64 `json:"income"` //收入 IncomeNum float64 `json:"incomeNum"` //收入笔数 Payout float64 `json:"payout"` //支出 PayoutNum float64 `json:"payoutNum"` //支出笔数 } func (q *Bill) New(tx *gorm.DB) error { return tx.Model(&Bill{}).Create(&q).Error } func (Bill) TableName() string { return "bill" }