lrf402788946 %!s(int64=4) %!d(string=hai) anos
pai
achega
ee20c3ef95
Modificáronse 1 ficheiros con 8 adicións e 0 borrados
  1. 8 0
      app/service/student.js

+ 8 - 0
app/service/student.js

@@ -51,6 +51,14 @@ class StudentService extends CrudService {
     await this.leavemodel.deleteMany({ studentid: id });
     await this.attendmodel.deleteMany({ studentid: id });
   }
+  async update({ id }, data) {
+    const student = await this.model.findByIdAndUpdate(id, data);
+    if (student) {
+      const { phone, name } = data;
+      const r = await this.umodel.findOneAndUpdate({ uid: id }, { mobile: phone, name });
+    }
+    return student;
+  }
 
   // 查询
   async query({ skip, limit, ...info }) {