liuyu 4 years ago
parent
commit
6b3be9526b
1 changed files with 4 additions and 2 deletions
  1. 4 2
      app/service/teacher.js

+ 4 - 2
app/service/teacher.js

@@ -82,8 +82,10 @@ class TeacherService extends CrudService {
     // 将数据存入数据库中
     for (const tea of teadatas) {
       const res = await this.model.findOne({ idnumber: tea.idnumber, name: tea.name });
-      res.xsscore = tea.xsscore;
-      await res.save();
+      if (res) {
+        res.xsscore = tea.xsscore;
+        await res.save();
+      }
     }
     return datacheck;
   }