|
@@ -12,6 +12,7 @@ const sendToWormhole = require('stream-wormhole');
|
|
const path = require('path');
|
|
const path = require('path');
|
|
const moment = require('moment');
|
|
const moment = require('moment');
|
|
const fs = require('fs');
|
|
const fs = require('fs');
|
|
|
|
+const PermissionCheck = require('../const/account_permission').PermissionCheck;
|
|
|
|
|
|
module.exports = app => {
|
|
module.exports = app => {
|
|
|
|
|
|
@@ -94,6 +95,7 @@ module.exports = app => {
|
|
jsFiles: this.app.jsFiles.common.concat(this.app.jsFiles.stageExtra.bonus),
|
|
jsFiles: this.app.jsFiles.common.concat(this.app.jsFiles.stageExtra.bonus),
|
|
auditConst,
|
|
auditConst,
|
|
stage: ctx.stage,
|
|
stage: ctx.stage,
|
|
|
|
+ deleteFilePermission: PermissionCheck.delFile(this.ctx.session.sessionUser.permission),
|
|
};
|
|
};
|
|
await this.layout('stage_extra/bonus.ejs', renderData, 'stage_extra/bonus_modal.ejs');
|
|
await this.layout('stage_extra/bonus.ejs', renderData, 'stage_extra/bonus_modal.ejs');
|
|
} catch (err) {
|
|
} catch (err) {
|
|
@@ -417,7 +419,8 @@ module.exports = app => {
|
|
const fileInfo = bonus.proof_file[data.index];
|
|
const fileInfo = bonus.proof_file[data.index];
|
|
if (fileInfo.uid !== ctx.session.sessionUser.accountId) throw '您无权删除该文件';
|
|
if (fileInfo.uid !== ctx.session.sessionUser.accountId) throw '您无权删除该文件';
|
|
|
|
|
|
- if (ctx.stage.status === auditConst.status.checked && !fileInfo.renew) throw '不可删除该文件';
|
|
|
|
|
|
+ const deleteFilePermission = PermissionCheck.delFile(this.ctx.session.sessionUser.permission);
|
|
|
|
+ if (ctx.stage.status === auditConst.status.checked && !fileInfo.renew && !deleteFilePermission) throw '不可删除该文件';
|
|
|
|
|
|
// 先删除文件
|
|
// 先删除文件
|
|
await fs.unlinkSync(path.join(this.app.baseDir, fileInfo.filepath));
|
|
await fs.unlinkSync(path.join(this.app.baseDir, fileInfo.filepath));
|
|
@@ -435,7 +438,7 @@ module.exports = app => {
|
|
ctx.body = {err: 0, msg: '', data: bonus.proof_file};
|
|
ctx.body = {err: 0, msg: '', data: bonus.proof_file};
|
|
} catch (err) {
|
|
} catch (err) {
|
|
this.log(err);
|
|
this.log(err);
|
|
- this.postError(err, '删除文件失败');
|
|
|
|
|
|
+ this.ctx.ajaxErrorBody(err, '删除文件失败');
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|