|  | @@ -59,9 +59,6 @@ module.exports = app => {
 | 
	
		
			
				|  |  |              const datas = data instanceof Array ? data : [data];
 | 
	
		
			
				|  |  |              for (const a of datas) {
 | 
	
		
			
				|  |  |                  a.attachment = a.attachment ? JSON.parse(a.attachment) : [];
 | 
	
		
			
				|  |  | -                for (const aa of a.attachment) {
 | 
	
		
			
				|  |  | -                    if (this.ctx.helper.canPreview(aa.fileext)) aa.viewpath = aa.filepath.replace(/^app|\/app/, '');
 | 
	
		
			
				|  |  | -                }
 | 
	
		
			
				|  |  |              }
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |  
 | 
	
	
		
			
				|  | @@ -75,6 +72,7 @@ module.exports = app => {
 | 
	
		
			
				|  |  |              const datas = data instanceof Array ? data : [data];
 | 
	
		
			
				|  |  |              for (const d of datas) {
 | 
	
		
			
				|  |  |                  for (const a of d.attachment) {
 | 
	
		
			
				|  |  | +                    if (this.ctx.helper.canPreview(a.fileext)) a.viewpath = a.filepath.replace(/^app|\/app/, '');
 | 
	
		
			
				|  |  |                      delete a.filepath;
 | 
	
		
			
				|  |  |                      a.username = (await this.getUserTemp(a.uid)).name;
 | 
	
		
			
				|  |  |                  }
 | 
	
	
		
			
				|  | @@ -122,8 +120,8 @@ module.exports = app => {
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |              const index = detailAtt.attachment.findIndex(x => { return x.file_id === fileId });
 | 
	
		
			
				|  |  |              if (index < 0) throw '不存在改文件';
 | 
	
		
			
				|  |  | -            const att = detailAtt[index];
 | 
	
		
			
				|  |  | -            if (detailAtt.attachment[index].uid !== this.ctx.session.sessionUser.accountId) throw '您无权删除该文件';
 | 
	
		
			
				|  |  | +            const att = detailAtt.attachment[index];
 | 
	
		
			
				|  |  | +            if (att.uid !== this.ctx.session.sessionUser.accountId) throw '您无权删除该文件';
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |              detailAtt.attachment.splice(index, 1);
 | 
	
		
			
				|  |  |              await this.db.update(this.tableName, { id: detailAtt.id, attachment: JSON.stringify(detailAtt.attachment) });
 | 
	
	
		
			
				|  | @@ -131,6 +129,7 @@ module.exports = app => {
 | 
	
		
			
				|  |  |              if (fs.existsSync(path.join(this.ctx.app.baseDir, att.filepath))) {
 | 
	
		
			
				|  |  |                  await fs.unlinkSync(path.join(this.ctx.app.baseDir, att.filepath));
 | 
	
		
			
				|  |  |              }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |              await this._complete4Output(detailAtt);
 | 
	
		
			
				|  |  |              return detailAtt;
 | 
	
		
			
				|  |  |          }
 |