feat: 方案100%匹配 — RBAC动态权限+Grafana监控+目录库独立微服务+全国目录中心+标识同步

This commit is contained in:
selfrelease
2026-06-30 13:42:11 +08:00
parent 96e2393c50
commit 29a6b57533
40 changed files with 4159 additions and 7 deletions
+86
View File
@@ -60,6 +60,13 @@ func (h *Handler) Register(rg *gin.RouterGroup) {
rg.GET("/regulatory/national-stats", h.nationalStats) // 全国监管统计(三期F.2
rg.GET("/regulatory/daily-report", h.dailyReport) // 监管数据上报日报(三期A.2
rg.GET("/admin/segments", h.listSegments) // 号段管理(三期B.1
// ---- 多维度标识查询(方案第一阶段标识查询接口补足)----
rg.GET("/content/query-by-hash", h.queryByHash) // 按 Hash 反查标识信息
rg.GET("/content/query-by-provincial-code", h.queryByProvincialCode) // 按省级内容编码反查
rg.GET("/content/query-by-library-id", h.queryByLibraryID) // 按片库文件ID反查
// ---- MA 合并/拆分(方案 MA 管理模块补足)----
rg.POST("/content/merge", h.mergeMA) // MA 码合并(仅监管)
rg.POST("/content/split", h.splitMA) // MA 码拆分(仅监管)
// ---- 四期:大小屏融合(跨域解析/扫码验真/跨屏权益)----
rg.GET("/content/resolve", h.resolve) // MA 跨域解析网关(C.1/C.2
rg.POST("/content/scan-verify", h.scanVerify) // 用户扫码验真(B.2
@@ -744,3 +751,82 @@ func (h *Handler) verifyRights(c *gin.Context) {
}
httpx.OK(c, h.svc.VerifyCrossScreenRights(req.MACode, req.UserHash, model.ScreenType(req.Screen)))
}
// ---- 多维度标识查询 handlers ----
// queryByHash 按内容哈希反查标识信息。
func (h *Handler) queryByHash(c *gin.Context) {
fileHash := c.Query("file_hash")
if fileHash == "" {
httpx.Error(c, http.StatusBadRequest, "INVALID_REQUEST", "缺少 file_hash 参数")
return
}
res, err := h.svc.QueryByHash(fileHash)
if err != nil {
httpx.Error(c, http.StatusNotFound, "NOT_FOUND", err.Error())
return
}
httpx.OK(c, res)
}
// queryByProvincialCode 按省级内容编码反查标识信息。
func (h *Handler) queryByProvincialCode(c *gin.Context) {
code := c.Query("provincial_code")
if code == "" {
httpx.Error(c, http.StatusBadRequest, "INVALID_REQUEST", "缺少 provincial_code 参数")
return
}
res, err := h.svc.QueryByProvincialCode(code)
if err != nil {
httpx.Error(c, http.StatusNotFound, "NOT_FOUND", err.Error())
return
}
httpx.OK(c, res)
}
// queryByLibraryID 按片库文件 ID 反查标识信息。
func (h *Handler) queryByLibraryID(c *gin.Context) {
libraryID := c.Query("library_file_id")
if libraryID == "" {
httpx.Error(c, http.StatusBadRequest, "INVALID_REQUEST", "缺少 library_file_id 参数")
return
}
res, err := h.svc.QueryByLibraryFileID(libraryID)
if err != nil {
httpx.Error(c, http.StatusNotFound, "NOT_FOUND", err.Error())
return
}
httpx.OK(c, res)
}
// ---- MA 合并/拆分 handlers ----
// mergeMA MA 码合并(仅监管主体)。
func (h *Handler) mergeMA(c *gin.Context) {
var req model.MergeRequest
if err := c.ShouldBindJSON(&req); err != nil {
httpx.Error(c, http.StatusBadRequest, "INVALID_REQUEST", err.Error())
return
}
res, err := h.svc.MergeMACodes(roleOf(c), req)
if err != nil {
httpx.Error(c, http.StatusBadRequest, "MERGE_FAILED", err.Error())
return
}
httpx.OK(c, res)
}
// splitMA MA 码拆分(仅监管主体)。
func (h *Handler) splitMA(c *gin.Context) {
var req model.SplitRequest
if err := c.ShouldBindJSON(&req); err != nil {
httpx.Error(c, http.StatusBadRequest, "INVALID_REQUEST", err.Error())
return
}
res, err := h.svc.SplitMACode(roleOf(c), req)
if err != nil {
httpx.Error(c, http.StatusBadRequest, "SPLIT_FAILED", err.Error())
return
}
httpx.OK(c, res)
}