lrf402788946 4 年之前
父节点
当前提交
d7cc41ffb4
共有 3 个文件被更改,包括 6 次插入15 次删除
  1. 1 0
      app/model/student.js
  2. 1 1
      app/service/student.js
  3. 4 14
      app/service/util.js

+ 1 - 0
app/model/student.js

@@ -10,6 +10,7 @@ const StudentSchema = {
   phone: { type: String, required: true, maxLength: 200, zh: '手机号' }, // 手机号
   gender: { type: String, required: false, maxLength: 200, zh: '性别' }, // 性别
   nation: { type: String, required: false, maxLength: 200, zh: '民族' }, // 民族
+  insurance: { type: String, required: false, maxLength: 200, zh: '拓训时间' }, // 拓训时间
   school_name: { type: String, required: false, maxLength: 200, zh: '学校名称' }, // 学校名称
   schid: { type: String, required: false, maxLength: 200, zh: '学校id' }, // 学校id
   faculty: { type: String, required: false, maxLength: 200, zh: '院系' }, // 院系

+ 1 - 1
app/service/student.js

@@ -498,7 +498,7 @@ class StudentService extends CrudService {
     for (const stu of studentList) {
       const { classid } = stu;
       if (!classid) continue;
-      const cla = classList.find(f => ObjectId(classid).equals(f._id));
+      const cla = await this.ctx.service.class.fetch({ id: classid });
       if (!cla) continue;
       const { startdate } = cla;
       if (!startdate) continue;

+ 4 - 14
app/service/util.js

@@ -76,15 +76,7 @@ class UtilService extends CrudService {
     return data;
   }
   async utilMethod(data, body) {
-    const output = fs.createWriteStream(__dirname + '/example.zip');
-    const archive = archiver('zip', {
-      zlib: { level: 9 },
-    });
-    archive.pipe(output);
-    const res = await this.ctx.curl('http://jytz.jilinjobs.cn/files/talented/337期/2班/朱凯英1602645545740.png');
-    archive.append(res.data, { name: '朱凯英1602645545740.png' });
-    archive.append(res.data, { name: '朱凯英1602645545740(1).png' });
-    archive.finalize();
+    console.log();
   }
 
   async teacherImport() {
@@ -132,9 +124,6 @@ class UtilService extends CrudService {
     // }
   }
 
-  async exportExcel(data) {
-    console.log(data);
-  }
 
   async toExcel(dataList, meta, fn = '导出结果') {
     // 导出excel
@@ -144,12 +133,13 @@ class UtilService extends CrudService {
     // 取出预设存储地址
     const rootPath = `${app.config.cdn.repos_root_path}`;
     const rooturl = `${app.config.cdn.repos_root_url_excel}`;
-    const path = `${rootPath}${rooturl}`;
+    let path = `${rootPath}${rooturl}`;
     if (!path) {
       throw new BusinessError(ErrorCode.BUSINESS, '服务端没有设置存储路径');
     }
-    // 如果不存在文件夹,就创建
+    if (process.env.NODE_ENV === 'development') path = 'E:\\exportFile\\';
     if (!fs.existsSync(path)) {
+      // 如果不存在文件夹,就创建
       fs.mkdirSync(path);
     }
     // 生成文件