|
|
@ -2764,12 +2764,15 @@ namespace _24Hour.Controllers.Common |
|
|
|
} |
|
|
|
} |
|
|
|
var FileName = System.IO.Path.GetFileName(filename); |
|
|
|
var FileName = System.IO.Path.GetFileName(filename); |
|
|
|
var FilePath = filename; |
|
|
|
var FilePath = filename; |
|
|
|
|
|
|
|
|
|
|
|
return new FileStreamResult(new FileStream(FilePath, FileMode.Open), "application/octet-stream") { FileDownloadName = FileName }; |
|
|
|
return new FileStreamResult(new FileStream(FilePath, FileMode.Open), "application/octet-stream") { FileDownloadName = FileName }; |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
else |
|
|
|
else |
|
|
|
{ |
|
|
|
{ |
|
|
|
return BadRequest(); |
|
|
|
return BadRequest(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/// <summary> |
|
|
|
/// <summary> |
|
|
@ -2781,11 +2784,10 @@ namespace _24Hour.Controllers.Common |
|
|
|
[Route("RequestDeleteFile")] |
|
|
|
[Route("RequestDeleteFile")] |
|
|
|
public Result RequestDeleteFile(string filename) //[FromBody] dynamic Json |
|
|
|
public Result RequestDeleteFile(string filename) //[FromBody] dynamic Json |
|
|
|
{ |
|
|
|
{ |
|
|
|
|
|
|
|
|
|
|
|
if (System.IO.File.Exists(filename)) |
|
|
|
if (System.IO.File.Exists(filename)) |
|
|
|
{ |
|
|
|
{ |
|
|
|
filename = filename.Replace(@"\\", @"\"); |
|
|
|
filename = filename.Replace(@"\\", @"\"); |
|
|
|
var data = System.IO.Path.Combine(Environment.CurrentDirectory, "wwwroot","temp"); |
|
|
|
var data = System.IO.Path.Combine(Environment.CurrentDirectory, "wwwroot", "temp"); |
|
|
|
if (filename.Contains(data) == false) |
|
|
|
if (filename.Contains(data) == false) |
|
|
|
{ |
|
|
|
{ |
|
|
|
return Result.Error("操作失败" + "不可删除"); |
|
|
|
return Result.Error("操作失败" + "不可删除"); |
|
|
@ -2796,9 +2798,9 @@ namespace _24Hour.Controllers.Common |
|
|
|
{ |
|
|
|
{ |
|
|
|
System.IO.File.Delete(filename); |
|
|
|
System.IO.File.Delete(filename); |
|
|
|
} |
|
|
|
} |
|
|
|
catch(Exception ex) |
|
|
|
catch (Exception ex) |
|
|
|
{ |
|
|
|
{ |
|
|
|
return Result.Error("操作失败"+ex.Message); |
|
|
|
return Result.Error("操作失败" + ex.Message); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
return Result.Success("操作成功"); |
|
|
|
return Result.Success("操作成功"); |
|
|
@ -2919,7 +2921,7 @@ namespace _24Hour.Controllers.Common |
|
|
|
{ |
|
|
|
{ |
|
|
|
var urlpath = s.Split('/'); |
|
|
|
var urlpath = s.Split('/'); |
|
|
|
|
|
|
|
|
|
|
|
var path = Path.Combine(Environment.CurrentDirectory, "wwwroot" , Path.Combine(urlpath)); |
|
|
|
var path = Path.Combine(Environment.CurrentDirectory, "wwwroot", Path.Combine(urlpath)); |
|
|
|
if (System.IO.File.Exists(path)) |
|
|
|
if (System.IO.File.Exists(path)) |
|
|
|
{ |
|
|
|
{ |
|
|
|
return Elight.Utility.Encrypt.DataEncryption.Decryptiones(path); |
|
|
|
return Elight.Utility.Encrypt.DataEncryption.Decryptiones(path); |
|
|
|