Pārlūkot izejas kodu

total定义更改

reloaded 5 gadi atpakaļ
vecāks
revīzija
a7637c80b1
1 mainītis faili ar 3 papildinājumiem un 2 dzēšanām
  1. 3 2
      app/service/student.js

+ 3 - 2
app/service/student.js

@@ -15,8 +15,9 @@ class StudentService extends CrudService {
 
   // 查询
   async seek({ termid, skip, limit }) {
-    const data = await this.model.find({ termid, classid: null }).skip(Number(skip)).limit(Number(limit));
-    const total = await data.length;
+    const students = await this.model.find({ termid, classid: null });
+    const total = await students.length;
+    const data = students.skip(Number(skip)).limit(Number(limit));
     const result = { total, data };
     return result;
   }