package model import "time" const ( CouponTypeDeduction = "deduction" ) type Coupon struct { Model Name string `json:"name"` Describe string `json:"describe" gorm:"type:text;"` // 描述 CouponType string `json:"coupon_type"` Value uint32 `json:"value"` OutCount uint32 `json:"out_count"` // 用户已领取数量 UsedCount uint32 `json:"used_count"` // 用户已使用数量 ActiveStart time.Time `json:"active_start"` // 有效期开始 ActiveEnd time.Time `json:"active_end"` // 有效期结束 零值永不结束 } type UserCoupon struct { Model Uid uint32 `json:"uid"` CouponId uint32 `json:"coupon_id"` CouponType string `json:"coupon_type"` Value uint32 `json:"value"` State uint32 `json:"state"` // ActiveStart time.Time `json:"active_start"` // 有效期开始 ActiveEnd time.Time `json:"active_end"` // 有效期结束 零值永不结束 }