first commit
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
package mysqlmodel
|
||||
|
||||
// BenefitGrantTask 权益发放补偿任务,用于支付成功后权益发放失败时的幂等补偿。
|
||||
// 唯一索引 (order_no, benefit_type) 作为幂等凭证,防止重复发放。
|
||||
type BenefitGrantTask struct {
|
||||
Model
|
||||
UserID int64 `gorm:"column:user_id"` // 用户ID
|
||||
// OrderNo 商户订单号;与 BenefitType 组成联合唯一索引作为幂等凭证。
|
||||
OrderNo string `gorm:"column:order_no;uniqueIndex:uk_benefit_task_idem,priority:1"`
|
||||
GoodsID int64 `gorm:"column:goods_id"` // 关联商品ID
|
||||
// BenefitType 权益类型 1=vip 2=cos 3=ai 4=closet_share 5=outfit_share
|
||||
BenefitType int8 `gorm:"column:benefit_type;uniqueIndex:uk_benefit_task_idem,priority:2"`
|
||||
Amount int64 `gorm:"column:amount"` // 发放数量
|
||||
Status int8 `gorm:"column:status"` // 状态 0=待发放 1=已发放 2=发放失败
|
||||
RetryCount int `gorm:"column:retry_count"` // 已重试次数
|
||||
MaxRetry int `gorm:"column:max_retry"` // 最大重试次数
|
||||
LastError string `gorm:"column:last_error"` // 最近一次失败原因
|
||||
}
|
||||
|
||||
func (BenefitGrantTask) TableName() string {
|
||||
return "benefit_grant_tasks"
|
||||
}
|
||||
Reference in New Issue
Block a user