|
|
|
@ -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); |
|
|
|
|