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