gemercheung 3 năm trước cách đây
mục cha
commit
e66e3649ca
1 tập tin đã thay đổi với 4 bổ sung2 xóa
  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 };