Ver código fonte

证书打印状态

lrf402788946 4 anos atrás
pai
commit
3fa813473a
4 arquivos alterados com 17 adições e 0 exclusões
  1. 4 0
      app/controller/.student.js
  2. 1 0
      app/model/student.js
  3. 5 0
      app/router.js
  4. 7 0
      app/service/student.js

+ 4 - 0
app/controller/.student.js

@@ -150,4 +150,8 @@ module.exports = {
     },
     service: "arrangeNumber",
   },
+  printCert: {
+    requestBody: ['ids'],
+    service: "printCert",
+  },
 };

+ 1 - 0
app/model/student.js

@@ -41,6 +41,7 @@ const StudentSchema = {
   isComming: { type: String, default: '0', zh: '签到' }, // 是否签到0否,1是
   type: { type: String, required: false, maxLength: 200, default: '0' }, // 类型:0-正常,1-特殊
   status: { type: String, required: false, maxLength: 200, default: '1' }, // 0:待确定。1:确定,2:失败
+  cert: { type: String, required: false, default: '0' }, // 证书状态,0=>未打印;1=已打印
 };
 
 

+ 5 - 0
app/router.js

@@ -671,4 +671,9 @@ module.exports = app => {
 
   // 问卷导出
   router.post('questionnaire', '/api/train/questionnaire/export', controller.questionnaire.export);
+  // 作业导出
+  // router.post('task', '/api/train/task/export', controller.task.export);
+  // 学生证书打印状态更改
+  router.post('student', '/api/train/student/printcert', controller.student.printCert);
+
 };

+ 7 - 0
app/service/student.js

@@ -565,6 +565,13 @@ class StudentService extends CrudService {
     return await this.ctx.service.util.toExcel(studentList, model, fn);
   }
 
+  // 确认学生打印证书
+  async printCert({ ids }) {
+    console.log(ids);
+    const res = await this.model.updateMany({ _id: { $in: ids.map(i => ObjectId(i)) } }, { cert: '1' });
+    return res;
+  }
+
 
   // excel导出表头设置
   metaBx(type) {