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