mh_goadmin_server/app/admin/models/coupon.go
chenlin cafc26e5bd 1、配置文件增加消息订阅环境和短信url配置项;
2、coupon和user_coupon表增加limit字段;
3、零售开单时,如果使用优惠券,则同步更新优惠券对应的数据;
4、增加优惠券数据接口;
5、增加获取小程序跳转链接接口;
6、增加保定金自动审核的定时任务,每天早上9点30分退前一天的保证金,最多10条;
2024-12-05 18:47:16 +08:00

84 lines
4.8 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 "time"
const (
CouponTypeDeduction = "deduction" // 抵扣
)
// gen:qs
//
//go:generate goqueryset -in coupon.go
type Coupon struct {
Model
Name string `json:"name"` // 优惠券名称
Describe string `json:"describe" gorm:"type:text"` // 优惠券简介
Rule string `json:"rule" gorm:"type:text"` // 优惠券使用规则
CouponType string `json:"coupon_type"` //
ActivityType uint32 `json:"activity_type"` // 活动类型 1-会员续费 2-零售销售
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-会员
CategoryNumber string `json:"category_number"` // 可以使用该优惠券的商品分类,如果为空则表示没限制
CommodityNumber string `json:"commodity_number"` // 可以使用该优惠券的商品编号,如果为空则表示没限制
ErpCouponId uint32 `json:"erp_coupon_id"` // 零售业务推送优惠券ID
Limit uint32 `json:"limit"` // 优惠券叠加限制 0-不限制1-仅限原价购买时使用
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-会员
Approach uint32 `json:"approach"` // 获取途径:
PromotionalSales uint32 `json:"promotional_sales"` //
RedeemCode string `json:"redeem_code"` //
CategoryNumber string `json:"category_number"` // 可以使用该优惠券的商品分类,如果为空则表示没限制
CommodityNumber string `json:"commodity_number"` // 可以使用该优惠券的商品编号,如果为空则表示没限制
Code string `json:"code"` // 优惠券券码
Limit uint32 `json:"limit"` // 优惠券叠加限制 0-不限制1-仅限原价购买时使用
Coupon *Coupon `json:"coupon" gorm:"-"` //
UserInfo UserInfo `json:"user_info" 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-会员续费 2-关注公众号
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:'会员等级'"` // 当前会员等级:10-普通用户 1-普通会员 2-黄金会员 4-白金会员 5-黑金会员
//StartUseTime time.Time `json:"start_use_time" gorm:"column:start_use_time;comment:'开始使用时间'"` // 开始使用时间
}