|
@@ -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);
|
|
|
}
|
|
|
// 生成文件
|