Files
platform/web/models/coupon.go

30 lines
1.0 KiB
Go
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
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 // 已过期
)