|
@@ -570,8 +570,8 @@ module.exports = app => {
|
|
|
const stream = await ctx.getFileStream();
|
|
|
const create_time = Date.parse(new Date()) / 1000;
|
|
|
const fileInfo = path.parse(stream.filename);
|
|
|
- const fileName = path.join('upload', this.ctx.tender.id.toString(), 'im', 'calcImg_' + create_time + fileInfo.ext);
|
|
|
- await ctx.helper.saveStreamFile(stream, path.join(this.app.config.filePath, fileName));
|
|
|
+ const fileName = path.join('public/upload', this.ctx.tender.id.toString(), 'im', 'calcImg_' + create_time + fileInfo.ext);
|
|
|
+ await ctx.helper.saveStreamFile(stream, path.join(this.app.baseDir, fileName));
|
|
|
ctx.body = {err: 0, msg: '', data: fileName};
|
|
|
} catch(err) {
|
|
|
this.log(err);
|
|
@@ -592,10 +592,10 @@ module.exports = app => {
|
|
|
|
|
|
if (data.updateType === 'update') {
|
|
|
const create_time = Date.parse(new Date()) / 1000;
|
|
|
- const fileName = path.join('upload', this.ctx.tender.id.toString(), 'im', 'calcImg_' + create_time + '.jpg');
|
|
|
+ const fileName = path.join('public/upload', this.ctx.tender.id.toString(), 'im', 'calcImg_' + create_time + '.jpg');
|
|
|
const base64Data = data.img.replace(/^data:image\/\w+;base64,/, "");
|
|
|
const dataBuffer = new Buffer(base64Data, 'base64');
|
|
|
- await this.ctx.helper.saveBufferFile(dataBuffer, path.join(this.app.config.filePath, fileName));
|
|
|
+ await this.ctx.helper.saveBufferFile(dataBuffer, path.join(this.app.baseDir, 'app', fileName));
|
|
|
data.calc_img = fileName;
|
|
|
data.calc_img_org = JSON.stringify(data.imgInfo);
|
|
|
delete data.updateType;
|