feat: 实现工位终端滑动续签机制,强化安全与身份追溯
- 新增滑动续签功能:人工触屏触发本地心跳 + 30秒节流刷新JWT,避免作业中令牌过期 - 拆分质量检验权限:过程检/完工检使用不同权限码,细化权限粒度 - 新增操作人用户ID字段:报工、拧紧记录落库时携带可信用户ID,解决身份追溯问题 - 移除编译期默认密钥,启动期校验所有必要密钥非空,防止密钥泄露风险 - 修复WMS附件越权遍历问题:使用UUID文件名替代顺序ID访问附件 - 实现登录态过期数据隔离:仅返回当前操作人的待同步数据,避免身份混淆
This commit is contained in:
@@ -17,18 +17,23 @@ func syncFlushHandler(ctx *svc.ServiceContext) http.HandlerFunc {
|
||||
}
|
||||
}
|
||||
|
||||
// syncStatsHandler GET /api/sync/stats 返回待同步条数统计。
|
||||
// syncStatsHandler GET /api/sync/stats 返回「当前登录人」尚未成功上报的本地数据(失败列表),
|
||||
// 供前端在「同一人重新登录」时仅展示失败信息(不自动打开页面)。他人数据不被返回、不可见。
|
||||
func syncStatsHandler(ctx *svc.ServiceContext) http.HandlerFunc {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
pendingTorque, err1 := ctx.Store.PendingTorqueCount()
|
||||
pendingQueue, err2 := ctx.Store.PendingQueueCount()
|
||||
if err1 != nil || err2 != nil {
|
||||
fail(w, http.StatusInternalServerError, "查询待同步统计失败")
|
||||
ss, err := ctx.Store.GetStationSession()
|
||||
if err != nil || ss == nil {
|
||||
ok(w, map[string]any{"pendingTorque": 0, "pendingQueue": 0, "pendingTotal": 0, "queue": []any{}, "torque": []any{}})
|
||||
return
|
||||
}
|
||||
queue, _ := ctx.Store.PendingQueueItemsForOperator(ss.UserID, 200)
|
||||
torque, _ := ctx.Store.PendingTorqueResultsForOperator(ss.UserID, 200)
|
||||
ok(w, map[string]any{
|
||||
"pendingTorque": pendingTorque,
|
||||
"pendingQueue": pendingQueue,
|
||||
"pendingQueue": len(queue),
|
||||
"pendingTorque": len(torque),
|
||||
"pendingTotal": len(queue) + len(torque),
|
||||
"queue": queue,
|
||||
"torque": torque,
|
||||
})
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user