gemercheung %!s(int64=3) %!d(string=hai) anos
pai
achega
e66e3649ca
Modificáronse 1 ficheiros con 4 adicións e 2 borrados
  1. 4 2
      src/service/msgService.js

+ 4 - 2
src/service/msgService.js

@@ -9,11 +9,13 @@ const getInKey = (realKey) => {
 const createMessage = (roomId, user, msg) => {
   const msgConfigKey = `msg:${roomId}`;
   const msgObj = {
-    ...user,
+    userId: user.userId,
+    nickname: user.nickname,
+    roomId: roomId,
     msg: msg,
     createTime: Math.floor(Date.now() / 1000),
   };
-  return pubClient.hSet(getInKey(msgConfigKey), msgObj);
+  return pubClient.hSet(getInKey(msgConfigKey), user.userId, JSON.stringify(msgObj));
 };
 
 export { createMessage };