ruifeng_liu 3 years ago
parent
commit
143dfe6d94
2 changed files with 17 additions and 1 deletions
  1. 2 1
      app/controller/patent/.patentchat.js
  2. 15 0
      app/service/patent/patentchat.js

+ 2 - 1
app/controller/patent/.patentchat.js

@@ -34,7 +34,8 @@ module.exports = {
       query: {
         sender_id: "sender_id",
         receiver_id: "receiver_id",
-        is_read:"is_read",
+        is_read: "is_read",
+        id: "id",
         "create_time@start": "create_time@start",
         "create_time@end": "create_time@end",
       },

+ 15 - 0
app/service/patent/patentchat.js

@@ -12,6 +12,21 @@ class PatentchatService extends CrudService {
     super(ctx, 'patentchat');
     this.model = this.ctx.model.Patent.Patentchat;
   }
+
+  async query({ id }) {
+    assert(id, '缺少用户信息');
+    const data = await this.model.find({ $or: [{ sender_id: id }, { receiver_id: id }] });
+    return data;
+  }
+  async count({ id }) {
+    assert(id, '缺少用户信息');
+    const data = await this.model.count({ $or: [{ sender_id: id }, { receiver_id: id }] });
+    return data;
+  }
+
+  async getChatList({ id }) {
+
+  }
 }
 
 module.exports = PatentchatService;