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