Browse Source

修改聊天

zs 1 year ago
parent
commit
8115419b1e
1 changed files with 2 additions and 6 deletions
  1. 2 6
      src/service/platform/chat.service.ts

+ 2 - 6
src/service/platform/chat.service.ts

@@ -17,11 +17,10 @@ export class ChatService extends BaseService<modelType> {
   // 聊天
   async chat(filter) {
     const user = this.ctx.user;
-    const { skip = 0, limit = 0, ...condition } = filter;
     const list = await this.model.aggregate([
       {
         $match: {
-          ...condition,
+          ...filter,
           $or: [{ sender_id: get(user, '_id') }, { receiver_id: get(user, '_id') }],
         },
       },
@@ -30,9 +29,7 @@ export class ChatService extends BaseService<modelType> {
         $replaceRoot: {
           newRoot: '$other',
         },
-      },
-      { $skip: parseInt(skip) },
-      { $limit: parseInt(limit) },
+      }
     ]);
     const data = [];
     for (const val of list) {
@@ -61,7 +58,6 @@ export class ChatService extends BaseService<modelType> {
       })
       .skip(skip)
       .limit(limit)
-      .sort({ send_time: 1 })
       .lean();
     const data = [];
     for (const val of list) {