Files
qitongxue-api/internal/model/entity/entity_promo_codes.go
2026-09-29 10:57:01 +08:00

31 lines
1.3 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 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"`
}