ruifeng_liu 3 年之前
父節點
當前提交
ff7f1bb625
共有 1 個文件被更改,包括 4 次插入5 次删除
  1. 4 5
      app/service/patent/patentnotice.js

+ 4 - 5
app/service/patent/patentnotice.js

@@ -16,16 +16,15 @@ class PatentnoticeService extends CrudService {
   }
 
   async query(query, { skip = 0, limit = 0 } = {}) {
-    query = await this.resetQuery(query);
-    console.log(query);
-    const data = await this.model.find(query).skip(parseInt(skip)).limit(parseInt(limit))
+    const nq = await this.resetQuery(_.cloneDeep(query));
+    const data = await this.model.find(nq).skip(parseInt(skip)).limit(parseInt(limit))
       .sort({ 'meta.createdAt': -1 });
     return data;
   }
 
   async count(query) {
-    query = await this.resetQuery(query);
-    const res = await this.model.countDocuments(trimData(query)).exec();
+    const nq = await this.resetQuery(_.cloneDeep(query));
+    const res = await this.model.count(nq);
     return res;
   }