06488f0237
功能: - Go后端 (Gin + GORM + PostgreSQL) - UniApp用户端 (iOS/Android/小程序) - DaisyUI5后台管理 - JWT认证 + 微信登录 - 盲选加权算法 - 会员系统 + 优惠券 - 打分评价 + 偏好学习
32 lines
1.1 KiB
Go
32 lines
1.1 KiB
Go
package model
|
|
|
|
import (
|
|
"time"
|
|
|
|
"gorm.io/gorm"
|
|
)
|
|
|
|
type Coupon struct {
|
|
ID uint `gorm:"primaryKey" json:"id"`
|
|
MerchantID uint `json:"merchant_id"`
|
|
PackageID uint `json:"package_id"`
|
|
UserID *uint `json:"user_id"`
|
|
Type string `gorm:"size:20" json:"type"` // discount/coupon/free/gift
|
|
Value float64 `json:"value"`
|
|
MinAmount int `json:"min_amount"`
|
|
TotalCount int `gorm:"default:100" json:"total_count"`
|
|
RemainCount int `gorm:"default:100" json:"remain_count"`
|
|
UserCode string `gorm:"size:50;uniqueIndex" json:"user_code"`
|
|
PoolCode string `gorm:"size:50" json:"pool_code"`
|
|
Status string `gorm:"size:20;default:available" json:"status"` // available/claimed/used/expired
|
|
UsedAt *time.Time `json:"used_at"`
|
|
ValidStart time.Time `json:"valid_start"`
|
|
ValidEnd time.Time `json:"valid_end"`
|
|
Commission float64 `gorm:"default:0" json:"commission"`
|
|
CreatedAt time.Time `json:"created_at"`
|
|
UpdatedAt time.Time `json:"updated_at"`
|
|
DeletedAt gorm.DeletedAt `gorm:"index" json:"-"`
|
|
}
|
|
|
|
func (Coupon) TableName() string { return "coupons" }
|