Files
bj_power/bj_power_workstation/internal/handler/routes.go
T
SunYF 6ee131a4bd feat: 新增装机绑定功能与权限、BOM工序配置
1.  新增装机绑定实体与相关CRUD逻辑,支持工件工序物料绑定/解绑
2.  为BOM物料新增装配工序字段,支持按工序校验绑定
3.  扩展权限表,新增父权限码字段支持菜单按钮关联
4.  统一各页面帮助弹窗参数,新增角色管理帮助文档
5.  新增公共格式化工具函数,优化侧边栏菜单展开逻辑
6.  新增工位终端绑定代理接口与MES内部绑定API
7.  修复主入口数据库连接与schema初始化逻辑,新增一键迁移工具
2026-09-07 11:58:19 +08:00

45 lines
2.1 KiB
Go

package handler
import (
"net/http"
"bj_power_workstation/internal/auth"
"bj_power_workstation/internal/svc"
"github.com/zeromicro/go-zero/rest"
)
func RegisterHandlers(server *rest.Server, ctx *svc.ServiceContext) {
// 免鉴权:健康检查 / 登录 / 工位配置
server.AddRoutes(
[]rest.Route{
{Method: http.MethodGet, Path: "/api/health", Handler: healthHandler(ctx)},
{Method: http.MethodPost, Path: "/api/auth/login", Handler: loginHandler(ctx)},
{Method: http.MethodGet, Path: "/api/config", Handler: configHandler(ctx)},
// 前端静态托管
{Method: http.MethodGet, Path: "/", Handler: indexHandler(ctx.WebFS)},
{Method: http.MethodGet, Path: "/assets/:file", Handler: assetHandler(ctx.WebFS)},
},
)
// 登录鉴权中间件:白名单 /api/health、/api/auth/login、/api/config、/pdfopen/*
server.Use(auth.Interceptor(ctx.Config.Auth.AccessSecret, ctx.Config.Auth.AccessExpire))
// 业务接口(均需登录 JWT;PDF 代理除外——原样转发文件流)
server.AddRoutes(
[]rest.Route{
{Method: http.MethodGet, Path: "/api/task/current", Handler: taskCurrentHandler(ctx)},
{Method: http.MethodGet, Path: "/api/bind/panel", Handler: bindPanelHandler(ctx)},
{Method: http.MethodPost, Path: "/api/bind/record", Handler: bindRecordHandler(ctx)},
{Method: http.MethodPost, Path: "/api/bind/remove", Handler: bindRemoveHandler(ctx)},
{Method: http.MethodGet, Path: "/api/workload", Handler: workloadHandler(ctx)},
{Method: http.MethodGet, Path: "/api/pdf", Handler: pdfQueryHandler(ctx)},
{Method: http.MethodGet, Path: "/pdfopen/:name", Handler: pdfOpenHandler(ctx)},
{Method: http.MethodGet, Path: "/api/tightening/list", Handler: tighteningListHandler(ctx)},
{Method: http.MethodPost, Path: "/api/report/process-done", Handler: processDoneHandler(ctx)},
{Method: http.MethodPost, Path: "/api/report/temp-store", Handler: tempStoreHandler(ctx)},
{Method: http.MethodPost, Path: "/api/sync/flush", Handler: syncFlushHandler(ctx)},
{Method: http.MethodGet, Path: "/api/sync/stats", Handler: syncStatsHandler(ctx)},
},
)
}