Răsfoiți Sursa

websocket相关

sunkean 3 ani în urmă
părinte
comite
8184a9bc79
1 a modificat fișierele cu 1 adăugiri și 1 ștergeri
  1. 1 1
      src/main/java/com/izouma/nineth/websocket/WebSocket.java

+ 1 - 1
src/main/java/com/izouma/nineth/websocket/WebSocket.java

@@ -100,7 +100,7 @@ public class WebSocket {
         MetaMMOLoginInfo metaMMOLoginInfo = (MetaMMOLoginInfo) redisTemplate.opsForValue().get(REDIS_PREFIX.concat(userId));
         MetaMMOLoginInfo metaMMOLoginInfo = (MetaMMOLoginInfo) redisTemplate.opsForValue().get(REDIS_PREFIX.concat(userId));
         if (Objects.isNull(metaMMOLoginInfo)) {
         if (Objects.isNull(metaMMOLoginInfo)) {
             // 如果缓存中玩家信息为空,根据userId和sessionId查询数据库
             // 如果缓存中玩家信息为空,根据userId和sessionId查询数据库
-            MetaMMOLoginInfo dbMetaMMOLoginInfo = metaMMOLoginInfoRepo.findByUserIdAndSessionIdAndDel(Long.parseLong(userId), clients.get(userId).getId(), false);
+            MetaMMOLoginInfo dbMetaMMOLoginInfo = metaMMOLoginInfoRepo.findByUserIdAndSessionIdAndDel(Long.parseLong(userId), clients.get(REDIS_PREFIX.concat(userId)).getId(), false);
             dbMetaMMOLoginInfo.setOffLineTime(LocalDateTime.now());
             dbMetaMMOLoginInfo.setOffLineTime(LocalDateTime.now());
             // 更新离线时间
             // 更新离线时间
             metaMMOLoginInfoRepo.save(dbMetaMMOLoginInfo);
             metaMMOLoginInfoRepo.save(dbMetaMMOLoginInfo);