74 lines
3.2 KiB
Go
74 lines
3.2 KiB
Go
package model
|
|
|
|
import "time"
|
|
|
|
const (
|
|
CouponTypeDeduction = "deduction" // 抵扣
|
|
)
|
|
const (
|
|
MemberRenewalExpiration = 7
|
|
)
|
|
|
|
//go:generate goqueryset -in coupon.go
|
|
// gen:qs
|
|
type Coupon struct {
|
|
Model
|
|
|
|
Name string `json:"name"`
|
|
Describe string `json:"describe" gorm:"type:text;"` // 描述
|
|
CouponType string `json:"coupon_type"`
|
|
ActivityType uint32 `json:"activity_type"` // 活动类型 1-会员续费
|
|
ActivityId uint32 `json:"activity_id" gorm:"index"`
|
|
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"` // 有效期结束 零值永不结束
|
|
MemberLevel uint32 `json:"member_level"` // 会员等级 1-用户 2-会员
|
|
IsDraw bool `json:"is_draw" gorm:"-"`
|
|
}
|
|
|
|
// gen:qs
|
|
type UserCoupon struct {
|
|
Model
|
|
|
|
Uid uint32 `json:"uid" gorm:"index"`
|
|
CouponId uint32 `json:"coupon_id" gorm:"index"`
|
|
CouponType string `json:"coupon_type"`
|
|
ActivityType uint32 `json:"activity_type"` // 活动类型 1-会员续费
|
|
ActivityId uint32 `json:"activity_id" gorm:"index"`
|
|
Value uint32 `json:"value"`
|
|
State uint32 `json:"state"` // 1-未使用 2-已使用 3-已过期
|
|
ActiveStart time.Time `json:"active_start"` // 有效期开始
|
|
ActiveEnd time.Time `json:"active_end"` // 有效期结束 零值永不结束
|
|
UseTime time.Time `json:"use_time"` //
|
|
MemberLevel uint32 `json:"member_level"` // 会员等级 1-用户 2-会员
|
|
Coupon *Coupon `json:"coupon" gorm:"-"`
|
|
}
|
|
|
|
// gen:qs
|
|
type Activity struct {
|
|
Model
|
|
|
|
Name string `json:"name" gorm:"column:name;comment:'活动名称'"` // 活动名称
|
|
ActivityType uint32 `json:"activity_type" gorm:"column:activity_type;comment:'活动类型'"` // 活动类型 1-会员续费
|
|
State uint32 `json:"state" gorm:"column:state;comment:'状态'"` // 1-未开启 2-进行中 3-已结束
|
|
StartTime time.Time `json:"start_time" gorm:"column:start_time;comment:'开始时间'"` // 开始时间
|
|
EndTime time.Time `json:"end_time" gorm:"column:end_time;comment:'结束时间'"` // 结束时间 零值永不结束
|
|
}
|
|
|
|
// gen:qs
|
|
type ActivityMemberRenewal struct {
|
|
Model
|
|
|
|
ActivityId uint32 `json:"activity_id" gorm:"index"`
|
|
Uid uint32 `json:"uid"`
|
|
State uint32 `json:"state" gorm:"column:state;comment:'状态'"` // 1-进行中 2-已完成 3-已过期
|
|
StartTime time.Time `json:"start_time" gorm:"column:start_time;comment:'开始时间'"` // 开始时间
|
|
IsPop bool `json:"is_pop" gorm:"column:is_pop;comment:'是否弹窗'"` // 是否弹窗
|
|
MemberLevel uint32 `json:"member_level" gorm:"column:member_level;comment:'会员等级'"` // 会员等级
|
|
MemberSerial uint32 `json:"member_serial"` // 会员有效
|
|
//StartUseTime time.Time `json:"start_use_time" gorm:"column:start_use_time;comment:'开始使用时间'"` // 开始使用时间
|
|
|
|
}
|