feat: 全端体验与稳定性整改(帮助文档清理/收集式报错/操作列统一/托盘与WS通知/物料同步重推)
- 移除 bj_power_dashboard 旧 React 大屏源码(迁移至 2D SVG 方案) - MES/WMS/工位终端前端:清理 help.js 与 PageHelp 帮助文档,统一操作列与布局,接入请求拦截器 - 新增收集式校验错误弹窗(ErrorListDialog 统一拦截 3015,逐条列现象+建议) - 新增托盘程序(tray)与 WebSocket(ws) 实时通知模块(三端共用) - MES/WMS 物料档案新增同步状态字段,补齐双向失败重推与默认角色 seed - 工单/产能/产品工艺/日排产逻辑调整;拧紧枪按工位配置 - 新增迁移 SQL:扭矩按工位、sysconfig 序列修复 - 更新 技术约束/案例/部署手册/项目说明 等文档
This commit is contained in:
@@ -4,6 +4,7 @@ import (
|
||||
"net/http"
|
||||
|
||||
"bj_power_wms/internal/svc"
|
||||
"bj_power_wms/internal/ws"
|
||||
|
||||
"github.com/zeromicro/go-zero/rest"
|
||||
)
|
||||
@@ -23,7 +24,19 @@ func RegisterHandlers(server *rest.Server, ctx *svc.ServiceContext) {
|
||||
},
|
||||
)
|
||||
|
||||
server.Use(authInterceptor(ctx))
|
||||
// WebSocket 握手浏览器无法携带 Authorization 头,故 /api/todos/ws 跳过全局 JWT 中间件,
|
||||
// 改由 todoWebSocketHandler 内部用 query 中的 token 复用 ParseToken 校验(问题8)。
|
||||
jwtGuard := authInterceptor(ctx)
|
||||
server.Use(func(next http.HandlerFunc) http.HandlerFunc {
|
||||
guarded := jwtGuard(next)
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
if r.URL.Path == "/api/todos/ws" {
|
||||
next.ServeHTTP(w, r)
|
||||
return
|
||||
}
|
||||
guarded(w, r)
|
||||
}
|
||||
})
|
||||
|
||||
// 当前登录用户(JWT 鉴权)
|
||||
server.AddRoutes(
|
||||
@@ -386,4 +399,17 @@ func RegisterHandlers(server *rest.Server, ctx *svc.ServiceContext) {
|
||||
{Method: http.MethodGet, Path: "/api/internal/delivery/status", Handler: wrapInternal(ctx)(deliveryStatusInternalHandler(ctx))},
|
||||
},
|
||||
)
|
||||
|
||||
// 待办统计 + WebSocket 推送(问题8):菜单角标实时刷新 + 本机语音播报触发源
|
||||
todoHub := ws.NewTodoHub(ctx)
|
||||
todoHub.Start()
|
||||
server.AddRoutes(
|
||||
[]rest.Route{
|
||||
{Method: http.MethodGet, Path: "/api/todos/stats", Handler: todoStatsHandler(todoHub)},
|
||||
},
|
||||
)
|
||||
// WebSocket 长连接单独注册并放大超时,避免被全局超时掐断
|
||||
server.AddRoute(rest.Route{
|
||||
Method: http.MethodGet, Path: "/api/todos/ws", Handler: todoWebSocketHandler(ctx, todoHub),
|
||||
}, rest.WithTimeout(3600_000_000_000))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user