31 lines
1.3 KiB
Go
31 lines
1.3 KiB
Go
|
|
package entity
|
|||
|
|
|
|||
|
|
import "github.com/gogf/gf/v2/os/gtime"
|
|||
|
|
|
|||
|
|
// PromoCodes 优惠码(免单/固定价档位,独立于优惠券)。
|
|||
|
|
//
|
|||
|
|
// 语义:
|
|||
|
|
// - Code 唯一(大写字母+数字,排除易混字符),下单时由用户输入;
|
|||
|
|
// - ProductId / PriceCents 决定「用码后」实际走支付的道具与价格(单位:分);
|
|||
|
|
// - Scope 0 全部 / 1 指定会员套餐 / 2 指定次数包,ScopeKeys 为 JSON 数组;
|
|||
|
|
// - MaxUses 0=不限;PerUserLimit 单人限用次数;
|
|||
|
|
// - UsedCount 在「下单事务内」自增(并发安全依赖行锁)。
|
|||
|
|
type PromoCodes struct {
|
|||
|
|
Id int64 `json:"id"`
|
|||
|
|
Code string `json:"code"`
|
|||
|
|
ProductId string `json:"product_id"`
|
|||
|
|
PriceCents int64 `json:"price_cents"`
|
|||
|
|
Scope int `json:"scope"`
|
|||
|
|
ScopeKeys string `json:"scope_keys"`
|
|||
|
|
MaxUses int `json:"max_uses"`
|
|||
|
|
UsedCount int `json:"used_count"`
|
|||
|
|
PerUserLimit int `json:"per_user_limit"`
|
|||
|
|
ValidFrom *gtime.Time `json:"valid_from"`
|
|||
|
|
ValidTo *gtime.Time `json:"valid_to"`
|
|||
|
|
Status int `json:"status"`
|
|||
|
|
Remark string `json:"remark"`
|
|||
|
|
CreatedBy string `json:"created_by"`
|
|||
|
|
CreatedAt *gtime.Time `json:"created_at"`
|
|||
|
|
UpdatedAt *gtime.Time `json:"updated_at"`
|
|||
|
|
}
|