|  | @@ -216,6 +216,40 @@ module.exports = app => {
 | 
												
													
														
															|  |                  ctx.ajaxErrorBody(error, '编辑附件失败');
 |  |                  ctx.ajaxErrorBody(error, '编辑附件失败');
 | 
												
													
														
															|  |              }
 |  |              }
 | 
												
													
														
															|  |          }
 |  |          }
 | 
												
													
														
															|  | 
 |  | +        async uploadBigFile(ctx) {
 | 
												
													
														
															|  | 
 |  | +            try {
 | 
												
													
														
															|  | 
 |  | +                await this.checkCanUpload(ctx);
 | 
												
													
														
															|  | 
 |  | +                const data = JSON.parse(ctx.request.body.data);
 | 
												
													
														
															|  | 
 |  | +                if (!data.type || !data.filing_id || !data.fileInfo) throw '缺少参数';
 | 
												
													
														
															|  | 
 |  | +                const filing = await ctx.service.filing.getDataById(data.filing_id);
 | 
												
													
														
															|  | 
 |  | +                if (!filing || filing.is_deleted) throw '分类不存在,请刷新页面后重试';
 | 
												
													
														
															|  | 
 |  | +
 | 
												
													
														
															|  | 
 |  | +                let result;
 | 
												
													
														
															|  | 
 |  | +                switch(data.type) {
 | 
												
													
														
															|  | 
 |  | +                    case 'begin':
 | 
												
													
														
															|  | 
 |  | +                        const create_time = Date.parse(new Date()) / 1000;
 | 
												
													
														
															|  | 
 |  | +                        const fileInfo = path.parse(data.fileInfo.filename);
 | 
												
													
														
															|  | 
 |  | +                        result = {
 | 
												
													
														
															|  | 
 |  | +                            filepath: `sp/file/${filing.spid}/${ctx.moment().format('YYYYMMDD')}/${create_time + '_' + fileInfo.ext}`
 | 
												
													
														
															|  | 
 |  | +                        };
 | 
												
													
														
															|  | 
 |  | +                        // todo 写入ossToken
 | 
												
													
														
															|  | 
 |  | +                        result.oss = await ctx.helper.getOssToken(ctx.app.fujianOss);
 | 
												
													
														
															|  | 
 |  | +                        break;
 | 
												
													
														
															|  | 
 |  | +                    case 'end':
 | 
												
													
														
															|  | 
 |  | +                        const user = await ctx.service.projectAccount.getDataById(ctx.session.sessionUser.accountId);
 | 
												
													
														
															|  | 
 |  | +                        const uploadFiles = [{
 | 
												
													
														
															|  | 
 |  | +                            filepath: data.filepath,
 | 
												
													
														
															|  | 
 |  | +                            filename: data.filename, fileext: data.fileext, filesize: data.fileInfo.size,
 | 
												
													
														
															|  | 
 |  | +                        }];
 | 
												
													
														
															|  | 
 |  | +                        result = await ctx.service.file.addFiles(filing, uploadFiles, user);
 | 
												
													
														
															|  | 
 |  | +                        break;
 | 
												
													
														
															|  | 
 |  | +                }
 | 
												
													
														
															|  | 
 |  | +                ctx.body = {err: 0, msg: '', data: result };
 | 
												
													
														
															|  | 
 |  | +            } catch (error) {
 | 
												
													
														
															|  | 
 |  | +                ctx.log(error);
 | 
												
													
														
															|  | 
 |  | +                ctx.body = this.ajaxErrorBody(error, '上传附件失败,请重试');
 | 
												
													
														
															|  | 
 |  | +            }
 | 
												
													
														
															|  | 
 |  | +        }
 | 
												
													
														
															|  |  
 |  |  
 | 
												
													
														
															|  |          async loadValidRelaTender(ctx) {
 |  |          async loadValidRelaTender(ctx) {
 | 
												
													
														
															|  |              try {
 |  |              try {
 |