Prechádzať zdrojové kódy

Merge branch 'master' of http://git.cc-lotus.info/new_train/service-center

reloaded 4 rokov pred
rodič
commit
292bfdeca0

+ 6 - 0
app/controller/.attendance.js

@@ -1,11 +1,14 @@
 module.exports = {
   create: {
     requestBody: [
+      'planid',
       'termid',
       'batchid',
       'classid',
       'studentid',
       'schid',
+      'schname',
+      'stuname',
       'attend'
     ]
   },
@@ -16,11 +19,14 @@ module.exports = {
   update: {
     params: ['!id'],
     requestBody: [
+      'planid',
       'termid',
       'batchid',
       'classid',
       'studentid',
       'schid',
+      'schname',
+      'stuname',
       'attend'
     ]
   },

+ 3 - 0
app/model/attendance.js

@@ -12,11 +12,14 @@ const attendInfo = new Schema({
 
 // 考勤表
 const AttendanceSchema = {
+  planid: { type: String, required: false, maxLength: 200 }, // 计划id
   termid: { type: String, required: false, maxLength: 200 }, // 期id
   batchid: { type: String, required: false, maxLength: 200 }, // 批次id
   classid: { type: String, required: false, maxLength: 200 }, // 班级id
   schid: { type: String, required: false, maxLength: 200 }, // 学校id
+  schname: { type: String, required: false, maxLength: 200 }, // 学校名称
   studentid: { type: String, required: false, maxLength: 200 }, // 学生id
+  stuname: { type: String, required: false, maxLength: 200 }, // 学生姓名
   attend: { type: [ attendInfo ], select: true }, // 考勤信息
 };
 

+ 8 - 4
app/service/attendance.js

@@ -77,14 +77,16 @@ class AttendanceService extends CrudService {
           await attendance.save();
         }
       } else {
-        const newdata = { termid: student.termid,
+        const newdatastu = { termid: student.termid,
           batchid: student.batchid,
           classid: student.classid,
           studentid: student.id,
+          stuname: student.name,
+          schname: student.school_name,
           schid: student.schid,
           attend: [ newData ],
         };
-        await this.model.create(newdata);
+        await this.model.create(newdatastu);
       }
     } else if (type === '1') {
       console.log('寝室考勤');
@@ -120,14 +122,16 @@ class AttendanceService extends CrudService {
           await attendance.save();
         }
       } else {
-        const newdata = { termid: student.termid,
+        const newdatastu = { termid: student.termid,
           batchid: student.batchid,
           classid: student.classid,
           studentid: student.id,
           schid: student.schid,
+          stuname: student.name,
+          schname: student.school_name,
           attend: [ newData ],
         };
-        await this.model.create(newdata);
+        await this.model.create(newdatastu);
       }
 
     }