liuyu vor 4 Jahren
Ursprung
Commit
2521b5d897
3 geänderte Dateien mit 6 neuen und 2 gelöschten Zeilen
  1. 3 0
      app/controller/.leave.js
  2. 1 0
      app/model/leave.js
  3. 2 2
      app/service/leave.js

+ 3 - 0
app/controller/.leave.js

@@ -14,6 +14,7 @@ module.exports = {
       "status",
       "refcause",
       "type",
+      "schid",
     ],
   },
   destroy: {
@@ -36,6 +37,7 @@ module.exports = {
       "status",
       "refcause",
       "type",
+      "schid",
     ],
   },
   show: {
@@ -60,6 +62,7 @@ module.exports = {
         status: "status",
         refcause: "refcause",
         type: "type",
+        schid: "schid",
       },
     },
     service: "query",

+ 1 - 0
app/model/leave.js

@@ -6,6 +6,7 @@ const metaPlugin = require('naf-framework-mongoose/lib/model/meta-plugin');
 const LeaveSchema = {
   batchid: { type: String, required: false, maxLength: 200 }, // 批次
   termid: { type: String, required: false, maxLength: 200 }, // 期
+  schid: { type: String, required: false, maxLength: 200 }, // 学校id
   classid: { type: String, required: false, maxLength: 200 }, // 班级id
   planid: { type: String, required: false, maxLength: 200 }, // 计划
   planyearid: { type: String, required: false, maxLength: 200 }, // 大批次id

+ 2 - 2
app/service/leave.js

@@ -16,11 +16,11 @@ class LeaveService extends CrudService {
     this.cmodel = this.ctx.model.Class;
   }
   async create(data) {
-    const newdata = { ...data, status: '0' };
-    const entity = await this.model.create(newdata);
     const studentid = data.studentid;
     const student = await this.smodel.findById(studentid);
     const schid = student.schid;
+    const newdata = { ...data, status: '0', schid };
+    const entity = await this.model.create(newdata);
     const user = await this.umodel.findOne({ uid: schid, type: '2' });
     if (user) {
       const openid = user.openid;