fix(路由): 修正套餐真流量预警与资产自动续费的超管/平台 gate 作用域
Some checks failed
构建并部署到测试环境(无 SSH) / build-and-deploy (push) Has been cancelled

Fiber 组中间件按路径前缀生效,两处 gate 挂在空路径组上实际落到 /api/admin 前缀,
注册顺序在其之后的后台接口对代理与企业账号一律返回 403(含代理充值、代理自充
支付方式与订单等)。gate 改为挂在各自功能路径组上,代理与企业仅被拒绝这两组功能入口。
This commit is contained in:
2026-09-17 17:49:33 +08:00
parent d52be16802
commit 398a5e4282
2 changed files with 9 additions and 5 deletions

View File

@@ -13,8 +13,10 @@ import (
// registerAssetAutoRenewalRoutes 注册资产钱包自动续费配置的读写路由。
// 沿用超管/平台路由组级 gate 先例:代理、企业与个人客户账号一律 403无任何读取或修改入口。
// gate 必须挂在功能路径组上Fiber 的组中间件按路径前缀生效,挂在空路径组上会落到
// /api/admin 前缀,从而拦截该层其余全部接口。
func registerAssetAutoRenewalRoutes(router fiber.Router, handler *admin.AssetAutoRenewalConfigHandler, doc *openapi.Generator, basePath string) {
group := router.Group("", func(c *fiber.Ctx) error {
group := router.Group("/asset-auto-renewal-config", func(c *fiber.Ctx) error {
userType := middleware.GetUserTypeFromContext(c.UserContext())
if userType != constants.UserTypeSuperAdmin && userType != constants.UserTypePlatform {
return errors.New(errors.CodeForbidden, constants.PlatformManagementForbiddenMessage)