30 lines
1.0 KiB
Go
30 lines
1.0 KiB
Go
|
|
package models
|
|||
|
|
|
|||
|
|
import (
|
|||
|
|
"platform/web/core"
|
|||
|
|
"time"
|
|||
|
|
|
|||
|
|
"github.com/shopspring/decimal"
|
|||
|
|
)
|
|||
|
|
|
|||
|
|
// Coupon 优惠券表
|
|||
|
|
type Coupon struct {
|
|||
|
|
core.Model
|
|||
|
|
UserID *int32 `json:"user_id" gorm:"column:user_id"` // 用户ID
|
|||
|
|
Code string `json:"code" gorm:"column:code"` // 优惠券代码
|
|||
|
|
Remark *string `json:"remark" gorm:"column:remark"` // 优惠券备注
|
|||
|
|
Amount decimal.Decimal `json:"amount" gorm:"column:amount"` // 优惠券金额
|
|||
|
|
MinAmount decimal.Decimal `json:"min_amount" gorm:"column:min_amount"` // 最低消费金额
|
|||
|
|
Status CouponStatus `json:"status" gorm:"column:status"` // 优惠券状态:0-未使用,1-已使用,2-已过期
|
|||
|
|
ExpireAt *time.Time `json:"expire_at" gorm:"column:expire_at"` // 过期时间
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// CouponStatus 优惠券状态枚举
|
|||
|
|
type CouponStatus int
|
|||
|
|
|
|||
|
|
const (
|
|||
|
|
CouponStatusUnused CouponStatus = 0 // 未使用
|
|||
|
|
CouponStatusUsed CouponStatus = 1 // 已使用
|
|||
|
|
CouponStatusExpired CouponStatus = 2 // 已过期
|
|||
|
|
)
|