Some checks failed
构建并部署到测试环境(无 SSH) / build-and-deploy (push) Has been cancelled
- 新增六对成对迁移 000232–000237:H5 弹窗类型、退款结算标识与申请人备注、优先轮询事实字段与两个新终态、通道阈值命中留痕、手机号最近解绑人、提现资格校验留痕 - 退款:原因必填与申请人备注、来源支付与渠道流水冻结、线下处理流水号补录审计、按订单查询可选退款方式、企微审批材料补齐且新增字段缺失映射即明确失败 - 优先轮询:人工关闭、有效期到期独立周期任务、失败与过期人工重触发、事实字段与异常重试查询、资产解析端点只读投影 - 通道阈值:命中事实同事务留痕与命中记录查询;员工账单:列表筛选与详情投影;商户池:列表投影与统计周期语义;H5:弹窗类型与类别排序 - 手机号:有效关联数量与最近解绑人、短信验证码失败次数限制;导出:佣金明细十五列与报表序号列 - 时间筛选:三处新增筛选纳入统一严格解析契约,员工账单产生时间参数改名 - 同步 12 份主 Spec 需求、两端点与异步任务证据链,门禁 context-health 与 OpenSpec 校验通过
95 lines
3.8 KiB
Go
95 lines
3.8 KiB
Go
package routes
|
||
|
||
import (
|
||
"github.com/gofiber/fiber/v2"
|
||
|
||
"github.com/break/junhong_cmp_fiber/internal/handler/admin"
|
||
"github.com/break/junhong_cmp_fiber/internal/model/dto"
|
||
"github.com/break/junhong_cmp_fiber/pkg/constants"
|
||
"github.com/break/junhong_cmp_fiber/pkg/errors"
|
||
"github.com/break/junhong_cmp_fiber/pkg/middleware"
|
||
"github.com/break/junhong_cmp_fiber/pkg/openapi"
|
||
)
|
||
|
||
func registerCarrierRoutes(router fiber.Router, handler *admin.CarrierHandler, doc *openapi.Generator, basePath string) {
|
||
// 通道阈值命中记录使用顶层路径,避免与 /carriers/:id 的参数路由冲突;
|
||
// 门禁沿用超管/平台路由组级 gate 先例(代理、企业与其他账号统一 403),
|
||
// 并挂在功能路径组上:Fiber 的组中间件按路径前缀生效。
|
||
hitGate := func(c *fiber.Ctx) error {
|
||
userType := middleware.GetUserTypeFromContext(c.UserContext())
|
||
if userType != constants.UserTypeSuperAdmin && userType != constants.UserTypePlatform {
|
||
return errors.New(errors.CodeForbidden, constants.PlatformManagementForbiddenMessage)
|
||
}
|
||
return c.Next()
|
||
}
|
||
|
||
hits := router.Group("/carrier-traffic-threshold-hits", hitGate)
|
||
hitsPath := basePath + "/carrier-traffic-threshold-hits"
|
||
|
||
Register(hits, doc, hitsPath, "GET", "", handler.ListThresholdHits, RouteSpec{
|
||
Summary: "查询通道阈值命中记录",
|
||
Description: "返回达量停机时冻结的数字证据:命中时该卡当前周期的累计流量读数、本次判定实际生效的阈值与单位、" +
|
||
"计费周期起点、判定时间与触发来源,以及周期恢复的解锁时间与复机结果;" +
|
||
"阈值与读数为命中时值,之后修改通道阈值不改写历史命中;" +
|
||
"本次上线前的历史行读数为空按「无」返回,判定时间取既有创建时间,不阻断查询。" +
|
||
"支持按运营商通道、卡、计费周期起点精确匹配与判定时间闭区间(start_time/end_time,带时区 RFC3339 秒级)筛选," +
|
||
"按判定时间倒序分页;仅超级管理员与平台账号可访问,并按卡数据范围过滤,越权与不存在不可区分," +
|
||
"不返回凭证或上游响应原文",
|
||
Tags: []string{"运营商管理"},
|
||
Input: new(dto.CarrierThresholdHitListRequest),
|
||
Output: new(dto.CarrierThresholdHitPageResult),
|
||
Auth: true,
|
||
})
|
||
|
||
carriers := router.Group("/carriers")
|
||
groupPath := basePath + "/carriers"
|
||
|
||
Register(carriers, doc, groupPath, "GET", "", handler.List, RouteSpec{
|
||
Summary: "运营商列表",
|
||
Tags: []string{"运营商管理"},
|
||
Input: new(dto.CarrierListRequest),
|
||
Output: new(dto.CarrierPageResult),
|
||
Auth: true,
|
||
})
|
||
|
||
Register(carriers, doc, groupPath, "POST", "", handler.Create, RouteSpec{
|
||
Summary: "创建运营商",
|
||
Tags: []string{"运营商管理"},
|
||
Input: new(dto.CreateCarrierRequest),
|
||
Output: new(dto.CarrierResponse),
|
||
Auth: true,
|
||
})
|
||
|
||
Register(carriers, doc, groupPath, "GET", "/:id", handler.Get, RouteSpec{
|
||
Summary: "获取运营商详情",
|
||
Tags: []string{"运营商管理"},
|
||
Input: new(dto.IDReq),
|
||
Output: new(dto.CarrierResponse),
|
||
Auth: true,
|
||
})
|
||
|
||
Register(carriers, doc, groupPath, "PUT", "/:id", handler.Update, RouteSpec{
|
||
Summary: "更新运营商",
|
||
Tags: []string{"运营商管理"},
|
||
Input: new(dto.UpdateCarrierParams),
|
||
Output: new(dto.CarrierResponse),
|
||
Auth: true,
|
||
})
|
||
|
||
Register(carriers, doc, groupPath, "DELETE", "/:id", handler.Delete, RouteSpec{
|
||
Summary: "删除运营商",
|
||
Tags: []string{"运营商管理"},
|
||
Input: new(dto.IDReq),
|
||
Output: nil,
|
||
Auth: true,
|
||
})
|
||
|
||
Register(carriers, doc, groupPath, "PUT", "/:id/status", handler.UpdateStatus, RouteSpec{
|
||
Summary: "更新运营商状态",
|
||
Tags: []string{"运营商管理"},
|
||
Input: new(dto.UpdateCarrierStatusParams),
|
||
Output: nil,
|
||
Auth: true,
|
||
})
|
||
}
|