超时退出

This commit is contained in:
Van0313
2025-04-29 01:12:10 +08:00
parent b804172a0d
commit f379fd65a8

View File

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