新功能(#77): 套餐列表返回促销信息
- 新增 SubscribePromo 响应结构,套餐列表每项追加 promo 字段 - 新增 promo.go 促销候选规则查询与资格评估逻辑 - 重构 authMiddleware 提取 authenticateRequest,新增 OptionalAuthMiddleware - /v1/public/subscribe/list 改为可选鉴权,未登录仅展示 campaign 类型促销 - /node/list、/group/list 保持强制鉴权不变 - 每个规格只返回最高优先级命中的规则,promo_price 为单价,expires_at 为秒级时间戳 - 新增单测覆盖 campaign/new_user 命中、活动窗口判定等场景 Co-authored-by: multica-agent <github@multica.ai>
This commit is contained in:
@@ -2785,6 +2785,13 @@ type StripePayment struct {
|
||||
PublishableKey string `json:"publishable_key"`
|
||||
}
|
||||
|
||||
type SubscribePromo struct {
|
||||
RuleName string `json:"rule_name"`
|
||||
RuleType string `json:"rule_type"`
|
||||
PromoPrice int64 `json:"promo_price"`
|
||||
ExpiresAt int64 `json:"expires_at"`
|
||||
}
|
||||
|
||||
type Subscribe struct {
|
||||
Id int64 `json:"id"`
|
||||
Name string `json:"name"`
|
||||
@@ -2793,6 +2800,7 @@ type Subscribe struct {
|
||||
UnitPrice int64 `json:"unit_price"`
|
||||
UnitTime string `json:"unit_time"`
|
||||
Discount []SubscribeDiscount `json:"discount"`
|
||||
Promo *SubscribePromo `json:"promo"`
|
||||
NodeCount int64 `json:"node_count"`
|
||||
Replacement int64 `json:"replacement"`
|
||||
Inventory int64 `json:"inventory"`
|
||||
|
||||
Reference in New Issue
Block a user