chore: 批量完成项目多模块迭代优化
1. 废弃半成品库存表并统一库存主表 2. 修复列表排序与搜索大小写不敏感问题 3. 新增用户最近登录时间、工单BOM名称字段 4. 完善角色管理、工位选择器功能 5. 增加拧紧数据补录、成品自动回流WMS能力 6. 统一导出时间范围校验规则 7. 丰富物料/备料单筛选条件 8. 调整菜单与权限命名适配产品型号业务
This commit is contained in:
@@ -89,6 +89,12 @@ func (s *Service) Login(ctx context.Context, req LoginReq) (LoginResp, error) {
|
||||
if bcrypt.CompareHashAndPassword([]byte(usr.Password), []byte(req.Password)) != nil {
|
||||
return resp, errors.New("用户名或密码错误")
|
||||
}
|
||||
// 记录最近登录时间(仅后台登录;工位终端 StationLogin 不计入)
|
||||
now := time.Now().Unix()
|
||||
if err := s.ctx.EntClient.User.UpdateOneID(usr.ID).SetLastLoginAt(now).Exec(ctx); err != nil {
|
||||
// 不阻塞登录,仅记日志
|
||||
}
|
||||
usr.LastLoginAt = &now
|
||||
roleEntity, _ := s.ctx.EntClient.Role.Get(ctx, usr.RoleId)
|
||||
return s.issueTokens(usr, roleEntity)
|
||||
}
|
||||
@@ -445,6 +451,7 @@ type UserVO struct {
|
||||
Status string `json:"status"`
|
||||
CanLoginWorkstation bool `json:"canLoginWorkstation"`
|
||||
Stations []int `json:"stations"` // 允许登录/操作的工位号(空=全部工位)
|
||||
LastLoginAt *int64 `json:"lastLoginAt"` // 最近登录时间(unix秒),null=从未登录
|
||||
}
|
||||
|
||||
func (s *Service) ListUsers(ctx context.Context) ([]UserVO, error) {
|
||||
@@ -462,6 +469,7 @@ func (s *Service) ListUsers(ctx context.Context) ([]UserVO, error) {
|
||||
Status: u.Status,
|
||||
CanLoginWorkstation: u.CanLoginWorkstation,
|
||||
Stations: s.UserStations(ctx, u.ID),
|
||||
LastLoginAt: u.LastLoginAt,
|
||||
})
|
||||
}
|
||||
return out, nil
|
||||
|
||||
Reference in New Issue
Block a user