超时退出
This commit is contained in:
@@ -640,6 +640,8 @@ public class JDUtil {
|
||||
UserInteractionState state = objectMapper.readValue(stateJson, UserInteractionState.class);
|
||||
LocalDateTime lastInteractionTime = LocalDateTime.parse(state.getLastInteractionTime(), DATE_TIME_FORMATTER);
|
||||
if (ChronoUnit.MINUTES.between(lastInteractionTime, now) > TIMEOUT_MINUTES) {
|
||||
String wxid = key.replace(INTERACTION_STATE_PREFIX, "");
|
||||
wxUtil.sendTextMessage(wxid, "长时间未操作,已退出会话", 1, wxid, false);
|
||||
redisTemplate.delete(key);
|
||||
logger.debug("Deleted timeout state for key: {}", key);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user