lrf 2 년 전
부모
커밋
1ba39d21b1
1개의 변경된 파일2개의 추가작업 그리고 3개의 파일을 삭제
  1. 2 3
      src/controller/chatRecord.controller.ts

+ 2 - 3
src/controller/chatRecord.controller.ts

@@ -68,11 +68,10 @@ export class ChatRecordController extends BaseController {
     }
     const rd = { last_chat: get(result, '_id') };
     await this.roomService.updateOne(data.room, rd);
-    // mq 发送消息
     const room = await this.roomService.fetch(data.room);
     let receiver;
-    if (get(room, 'customer') === get(data, 'speaker')) receiver = get(room, 'shop');
-    else receiver = get(room, 'customer');
+    if (get(room, 'customer') === get(data, 'speaker')) receiver = get(room, 'shop._id');
+    else receiver = get(room, 'customer._id');
     await this.ws.toSend({ ...result, type: 'chat' }, receiver);
     return result;
   }