fix: 修复收入统计 404,并隔离支付测试/生产配置
Dashboard 收入接口路径对齐;登录页去掉「授权管理平台」;Waffo 测试/生产密钥与 Product 映射分环境保存。 Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
1 parent
76bba729f1
commit
9b79eabd34
9 files changed
+391
-80
No files matched your search
@@ -49,6 +49,7 @@ type WaffoPublicMeta struct {
|
||||
ProductIDPerpetual string `json:"product_id_perpetual"`
|
||||
ProductIDs map[string]string `json:"product_ids,omitempty"` // 可扩展映射,兼容旧字段 // Logan.Li
|
||||
ProductMappings []WaffoProductMapping `json:"product_mappings,omitempty"` // 前端表格(含 label) // Logan.Li
|
||||
EnvProfiles map[string]WaffoEnvProfile `json:"env_profiles,omitempty"` // test/live 隔离映射 // Logan.Li
|
||||
SuccessURL string `json:"success_url"`
|
||||
Currency string `json:"currency"`
|
||||
CurrencyYearly string `json:"currency_yearly"`
|
||||
@@ -193,11 +194,40 @@ func mergeWaffoFromDB(db *gorm.DB, cfg *WaffoConfig) {
|
||||
} else {
|
||||
cfg.Environment = "live"
|
||||
}
|
||||
cfg.Environment = NormalizeWaffoEnvironment(cfg.Environment)
|
||||
meta.ApplyEnvProfile(cfg.Environment)
|
||||
// ApplyEnvProfile 后同步产品字段到 cfg // Logan.Li
|
||||
if meta.ProductID != "" {
|
||||
cfg.ProductID = meta.ProductID
|
||||
}
|
||||
if meta.ProductIDYearly != "" {
|
||||
cfg.ProductIDYearly = meta.ProductIDYearly
|
||||
}
|
||||
if meta.ProductIDPerpetual != "" {
|
||||
cfg.ProductIDPerpetual = meta.ProductIDPerpetual
|
||||
}
|
||||
if len(meta.ProductIDs) > 0 {
|
||||
cfg.ProductIDs = cloneStringMap(meta.ProductIDs)
|
||||
}
|
||||
if len(meta.ProductMappings) > 0 {
|
||||
if cfg.ProductIDs == nil {
|
||||
cfg.ProductIDs = map[string]string{}
|
||||
}
|
||||
for _, m := range meta.ProductMappings {
|
||||
k := strings.TrimSpace(strings.ToLower(m.PlanKey))
|
||||
v := strings.TrimSpace(m.ProductID)
|
||||
if k == "" || v == "" {
|
||||
continue
|
||||
}
|
||||
cfg.ProductIDs[k] = v
|
||||
}
|
||||
}
|
||||
if strings.TrimSpace(gw.Currency) != "" && cfg.Currency == "" {
|
||||
cfg.Currency = gw.Currency
|
||||
}
|
||||
if strings.TrimSpace(gw.SecretKey) != "" {
|
||||
cfg.PrivateKey = strings.TrimSpace(gw.SecretKey)
|
||||
bag := ParseWaffoSecretBag(gw.SecretKey, cfg.Environment)
|
||||
if pk := bag.SecretForEnv(cfg.Environment); pk != "" {
|
||||
cfg.PrivateKey = pk
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user