package entity import "github.com/gogf/gf/v2/os/gtime" // UserCoupons 用户持有的优惠券(含券面快照 + 占用/核销记录)。 // // 快照:CouponTitle / CouponType / Kind / Value / ThresholdCents 在发放时从模板复制, // 之后模板改名/改型/改面额**不影响已发券**(约定 S8)。 // // 状态(Status):0 未使用 / 1 已使用(占用或核销)/ 2 已过期 / 3 已作废。 // 来源(Source):1 后台发放 / 2 活动领取 / 3 系统赠送。 // // 占用语义(免单券):下单时在同一事务内把 Status 置 1、写 UsedOrderNo / UsedBy='system' / // LockAt;订单取消/超时由 gcron 释放(清 UsedOrderNo、Status 回 0)。 type UserCoupons struct { Id int64 `json:"id"` CouponId int64 `json:"coupon_id"` UserId int64 `json:"user_id"` CouponTitle string `json:"coupon_title"` CouponType int `json:"coupon_type"` Kind int `json:"kind"` Value int `json:"value"` ThresholdCents int `json:"threshold_cents"` Status int `json:"status"` Source int `json:"source"` GrantedBy string `json:"granted_by"` GrantedAt *gtime.Time `json:"granted_at"` UsedAt *gtime.Time `json:"used_at"` ExpireAt *gtime.Time `json:"expire_at"` UsedOrderNo string `json:"used_order_no"` UsedBy string `json:"used_by"` LockAt *gtime.Time `json:"lock_at"` Remark string `json:"remark"` CreatedAt *gtime.Time `json:"created_at"` UpdatedAt *gtime.Time `json:"updated_at"` }