package models import ( "platform/web/core" "time" "github.com/shopspring/decimal" ) // Coupon 优惠券表 type Coupon struct { core.Model Name string `json:"name" gorm:"column:name"` // 优惠券名称 Amount decimal.Decimal `json:"amount" gorm:"column:amount"` // 优惠券金额 MinAmount decimal.Decimal `json:"min_amount" gorm:"column:min_amount"` // 最低消费金额 Count int32 `json:"count" gorm:"column:count"` // 优惠券数量 Status CouponStatus `json:"status" gorm:"column:status"` // 优惠券状态:0-禁用,1-正常 ExpireType CouponExpireType `json:"expire_type" gorm:"column:expire_type"` // 过期类型:0-不过期,1-固定日期,2-相对日期(从发放时间算起) ExpireAt *time.Time `json:"expire_at,omitempty" gorm:"column:expire_at"` // 过期时间,固定日期必填 ExpireIn *int `json:"expire_in,omitempty" gorm:"column:expire_in"` // 过期时长(天),相对日期必填 } // CouponStatus 优惠券使用状态枚举 type CouponStatus int const ( CouponStatusDisabled CouponStatus = 0 // 禁用 CouponStatusEnabled CouponStatus = 1 // 正常 ) // CouponExpireType 优惠券过期类型枚举 type CouponExpireType int const ( CouponExpireTypeNever CouponExpireType = 0 // 不过期 CouponExpireTypeFixed CouponExpireType = 1 // 固定日期 CouponExpireTypeRelative CouponExpireType = 2 // 相对日期 )