新功能(#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:
@@ -230,6 +230,12 @@ type (
|
||||
Discount float64 `json:"discount"`
|
||||
MapApple string `json:"map_apple"`
|
||||
}
|
||||
SubscribePromo {
|
||||
RuleName string `json:"rule_name"`
|
||||
RuleType string `json:"rule_type"`
|
||||
PromoPrice int64 `json:"promo_price"`
|
||||
ExpiresAt int64 `json:"expires_at"`
|
||||
}
|
||||
TrafficLimit {
|
||||
StatType string `json:"stat_type"`
|
||||
StatValue int64 `json:"stat_value"`
|
||||
@@ -244,6 +250,7 @@ type (
|
||||
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