Browse Source

增加2期临时登陆接入

v5
庄锐波 3 months ago
parent
commit
2a2bd24e45
  1. 14
      lib/EmergencyService/zdxtEmergencyAuthService/src/main/java/com/zdxt/auth/project/system/user/controller/LoginByUserIdController.java

14
lib/EmergencyService/zdxtEmergencyAuthService/src/main/java/com/zdxt/auth/project/system/user/controller/LoginByUserIdController.java

@ -95,13 +95,13 @@ public class LoginByUserIdController extends BaseController {
}
// 3. 验证时间戳是否与当前系统时间偏移在±20秒内
long currentTimeMillis = System.currentTimeMillis();
long diffSeconds = Math.abs(currentTimeMillis - ts) / 1000;
if (diffSeconds > ALLOWED_TIME_OFFSET_SECONDS) {
log.warn("通过userId登录失败, 时间戳偏移超过{}秒, ts: {}, 当前时间: {}, 偏移: {}秒",
ALLOWED_TIME_OFFSET_SECONDS, ts, currentTimeMillis, diffSeconds);
throw new ResponseStatusException(HttpStatus.NOT_FOUND);
}
// long currentTimeMillis = System.currentTimeMillis();
// long diffSeconds = Math.abs(currentTimeMillis - ts) / 1000;
// if (diffSeconds > ALLOWED_TIME_OFFSET_SECONDS) {
// log.warn("通过userId登录失败, 时间戳偏移超过{}秒, ts: {}, 当前时间: {}, 偏移: {}秒",
// ALLOWED_TIME_OFFSET_SECONDS, ts, currentTimeMillis, diffSeconds);
// throw new ResponseStatusException(HttpStatus.NOT_FOUND);
// }
// 4. 根据userId查询用户
User sysUser = userService.selectUserById(userId);

Loading…
Cancel
Save