|
@@ -1304,8 +1304,8 @@ module.exports = app => {
|
|
|
// }
|
|
|
const fileInfo = path.parse(stream.filename);
|
|
|
const create_time = Date.parse(new Date()) / 1000;
|
|
|
- const filepath = `public/upload/${this.ctx.tender.id}/stage/fujian_${create_time + index.toString() + fileInfo.ext}`;
|
|
|
- await ctx.helper.saveStreamFile(stream, path.resolve(this.app.baseDir, 'app', filepath));
|
|
|
+ const filepath = `app/public/upload/${this.ctx.tender.id}/stage/fujian_${create_time + index.toString() + fileInfo.ext}`;
|
|
|
+ await ctx.helper.saveStreamFile(stream, path.resolve(this.app.baseDir, filepath));
|
|
|
// console.log(await fs.existsSync(path.resolve(this.app.baseDir, 'app', filepath)));
|
|
|
// const fileInfo = path.parse(stream.filename);
|
|
|
// const fileName = 'stage' + create_time + '_' + index + fileInfo.ext;
|
|
@@ -1363,7 +1363,7 @@ module.exports = app => {
|
|
|
try {
|
|
|
const fileInfo = await ctx.service.stageAtt.getDataById(id);
|
|
|
if (fileInfo !== undefined && fileInfo !== '') {
|
|
|
- const fileName = path.join(this.app.baseDir, 'app', fileInfo.filepath);
|
|
|
+ const fileName = path.join(this.app.baseDir, fileInfo.filepath);
|
|
|
// 解决中文无法下载问题
|
|
|
const userAgent = (ctx.request.header['user-agent'] || '').toLowerCase();
|
|
|
let disposition = '';
|
|
@@ -1407,7 +1407,7 @@ module.exports = app => {
|
|
|
if (!ctx.helper.canPreview(fileInfo.fileext)) {
|
|
|
filepath = `/tender/${ctx.tender.id}/measure/stage/${ctx.params.order}/download/file/${fileInfo.id}`;
|
|
|
} else {
|
|
|
- filepath = '/' + filepath;
|
|
|
+ filepath = filepath.replace(/^app/, '');
|
|
|
}
|
|
|
fileInfo.filepath && (responseData.data = { filepath });
|
|
|
}
|