package model import ( "time" "gorm.io/gorm" ) // 充值申请状态 const ( RechargeStatusPending = "pending" RechargeStatusApproved = "approved" RechargeStatusRejected = "rejected" ) // RechargeApplication 商户提交的人民币充值申请,凭证图片必填,由平台管理员审核后入账。 type RechargeApplication struct { ID uint `gorm:"primarykey" json:"id"` CreatedAt time.Time `json:"created_at"` UpdatedAt time.Time `json:"updated_at"` DeletedAt gorm.DeletedAt `gorm:"index" json:"-"` MerchantID uint `gorm:"not null;index" json:"merchant_id"` ApplicationNo string `gorm:"uniqueIndex;size:64;not null" json:"application_no"` AmountCNY int64 `gorm:"not null" json:"amount_cny"` // 人民币金额,单位:分 PointsAmount int64 `gorm:"not null" json:"points_amount"` Status string `gorm:"size:16;not null;default:pending;index" json:"status"` Vouchers []string `gorm:"type:text;serializer:json" json:"vouchers"` // 打款凭证图片 URL Note string `gorm:"size:512" json:"note"` ReviewNote string `gorm:"size:512" json:"review_note"` ReviewedAt *time.Time `json:"reviewed_at"` ReviewedBy *uint `json:"reviewed_by"` Merchant *Merchant `gorm:"foreignKey:MerchantID" json:"merchant,omitempty"` } // MerchantAlertConfig 低余额 Webhook 告警配置(每商户一份)。 type MerchantAlertConfig struct { ID uint `gorm:"primarykey" json:"id"` CreatedAt time.Time `json:"created_at"` UpdatedAt time.Time `json:"updated_at"` MerchantID uint `gorm:"not null;uniqueIndex" json:"merchant_id"` Enabled bool `gorm:"not null;default:false" json:"enabled"` ThresholdPoints int64 `gorm:"not null;default:0" json:"threshold_points"` WebhookURL string `gorm:"size:1024" json:"webhook_url"` }