From 92fe3231ad3e7040b39c4508f491a22b0c2ea87f Mon Sep 17 00:00:00 2001 From: dev02 Date: Thu, 23 Nov 2023 17:13:24 +0800 Subject: [PATCH] =?UTF-8?q?[=E5=BE=8C=E7=AB=AF]=20=E4=BF=AE=E6=94=B9?= =?UTF-8?q?=E4=B8=8A=E5=82=B3=E8=B7=AF=E5=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Backend/Controllers/BuildInfoController.cs | 28 ++++++++----------- Backend/Controllers/DeviceManageController.cs | 18 ++++++------ .../54ca9e34-9dca-410a-a8fb-69d2b026faf7.svg | 0 3 files changed, 20 insertions(+), 26 deletions(-) create mode 100644 Backend/wwwroot/upload/floor_map/54ca9e34-9dca-410a-a8fb-69d2b026faf7.svg diff --git a/Backend/Controllers/BuildInfoController.cs b/Backend/Controllers/BuildInfoController.cs index f0786fa..0234f57 100644 --- a/Backend/Controllers/BuildInfoController.cs +++ b/Backend/Controllers/BuildInfoController.cs @@ -20,8 +20,6 @@ namespace Backend.Controllers private readonly IBackendRepository backendRepository; private string mapFileSaveAsPath = ""; private string buildMapFileSaveAsPath = ""; - private string tempMapFileSaveAsPath = ""; - private string tempBuildMapFileSaveAsPath = ""; public BuildInfoController(IBackendRepository backendRepository) { @@ -29,8 +27,6 @@ namespace Backend.Controllers mapFileSaveAsPath = Path.Combine(Directory.GetCurrentDirectory(), "wwwroot", "upload", "floor_map"); buildMapFileSaveAsPath = Path.Combine(Directory.GetCurrentDirectory(), "wwwroot", "upload", "build_map"); - tempMapFileSaveAsPath = Path.Combine("wwwroot", "upload", "floor_map"); - tempBuildMapFileSaveAsPath = Path.Combine("wwwroot", "upload", "build_map"); } public IActionResult Index() @@ -180,9 +176,9 @@ namespace Backend.Controllers post.Map3dFile.CopyTo(stream); } - var frontendPath = await backendRepository.GetOneAsync("select system_value from variable where system_type = 'directory' and system_key = 'frontend'"); + var frontendPath = await backendRepository.GetOneAsync("select system_value from variable where system_type = 'directory_build_map' and system_key = 'frontend'"); - fullPath = Path.Combine(Path.GetDirectoryName(Directory.GetCurrentDirectory()), frontendPath, tempBuildMapFileSaveAsPath); + fullPath = frontendPath; if (!System.IO.Directory.Exists(fullPath)) System.IO.Directory.CreateDirectory(fullPath); @@ -306,9 +302,9 @@ namespace Backend.Controllers post.Map3dFile.CopyTo(stream); } - var frontendPath = await backendRepository.GetOneAsync("select system_value from variable where system_type = 'directory' and system_key = 'frontend'"); + var frontendPath = await backendRepository.GetOneAsync("select system_value from variable where system_type = 'directory_build_map' and system_key = 'frontend'"); - fullPath = Path.Combine(Path.GetDirectoryName(Directory.GetCurrentDirectory()), frontendPath, tempBuildMapFileSaveAsPath); + fullPath = frontendPath; if (!System.IO.Directory.Exists(fullPath)) System.IO.Directory.CreateDirectory(fullPath); @@ -571,17 +567,17 @@ namespace Backend.Controllers var fullPath = Path.Combine(mapFileSaveAsPath, fileName); - if (!System.IO.Directory.Exists(buildMapFileSaveAsPath)) - System.IO.Directory.CreateDirectory(buildMapFileSaveAsPath); + if (!System.IO.Directory.Exists(mapFileSaveAsPath)) + System.IO.Directory.CreateDirectory(mapFileSaveAsPath); using (var stream = new FileStream(fullPath, FileMode.Create)) { post.MapFile.CopyTo(stream); } - var frontendPath = await backendRepository.GetOneAsync("select system_value from variable where system_type = 'directory' and system_key = 'frontend'"); + var frontendPath = await backendRepository.GetOneAsync("select system_value from variable where system_type = 'directory_floor_map' and system_key = 'frontend'"); - fullPath = Path.Combine(Path.GetDirectoryName(Directory.GetCurrentDirectory()), frontendPath, tempMapFileSaveAsPath); + fullPath = frontendPath; if (!System.IO.Directory.Exists(fullPath)) System.IO.Directory.CreateDirectory(fullPath); @@ -626,17 +622,17 @@ namespace Backend.Controllers var fullPath = Path.Combine(mapFileSaveAsPath, fileName); - if (!System.IO.Directory.Exists(buildMapFileSaveAsPath)) - System.IO.Directory.CreateDirectory(buildMapFileSaveAsPath); + if (!System.IO.Directory.Exists(mapFileSaveAsPath)) + System.IO.Directory.CreateDirectory(mapFileSaveAsPath); using (var stream = new FileStream(fullPath, FileMode.Create)) { post.MapFile.CopyTo(stream); } - var frontendPath = await backendRepository.GetOneAsync("select system_value from variable where system_type = 'directory' and system_key = 'frontend'"); + var frontendPath = await backendRepository.GetOneAsync("select system_value from variable where system_type = 'directory_floor_map' and system_key = 'frontend'"); + fullPath = frontendPath; - fullPath = Path.Combine(Path.GetDirectoryName(Directory.GetCurrentDirectory()), frontendPath, tempMapFileSaveAsPath); if (!System.IO.Directory.Exists(fullPath)) System.IO.Directory.CreateDirectory(fullPath); diff --git a/Backend/Controllers/DeviceManageController.cs b/Backend/Controllers/DeviceManageController.cs index f660ee5..b96ea21 100644 --- a/Backend/Controllers/DeviceManageController.cs +++ b/Backend/Controllers/DeviceManageController.cs @@ -17,7 +17,6 @@ namespace Backend.Controllers private readonly IDeviceManageRepository deviceManageRepository; private string deviceKindFileSaveAsPath = ""; private string deviceKindFilePath = "upload/device_icon/"; - private string tempDeviceKindFileSaveAsPath = ""; public DeviceManageController(IBackendRepository backendRepository, IDeviceManageRepository deviceManageRepository) @@ -26,7 +25,6 @@ namespace Backend.Controllers this.deviceManageRepository = deviceManageRepository; deviceKindFileSaveAsPath = Path.Combine(Directory.GetCurrentDirectory(), "wwwroot", "upload", "device_icon"); - tempDeviceKindFileSaveAsPath = Path.Combine("wwwroot", "upload", "device_icon"); } public IActionResult Index() @@ -1214,9 +1212,9 @@ namespace Backend.Controllers post.Device_image_file.CopyTo(stream); } - var frontendPath = await backendRepository.GetOneAsync("select system_value from variable where system_type = 'directory' and system_key = 'frontend'"); + var frontendPath = await backendRepository.GetOneAsync("select system_value from variable where system_type = 'directory_device_icon' and system_key = 'frontend'"); - fullPath = Path.Combine(Path.GetDirectoryName(Directory.GetCurrentDirectory()), frontendPath, tempDeviceKindFileSaveAsPath); + fullPath = frontendPath; if (!System.IO.Directory.Exists(fullPath)) System.IO.Directory.CreateDirectory(fullPath); @@ -1326,9 +1324,9 @@ namespace Backend.Controllers post.Device_image_file.CopyTo(stream); } - var frontendPath = await backendRepository.GetOneAsync("select system_value from variable where system_type = 'directory' and system_key = 'frontend'"); + var frontendPath = await backendRepository.GetOneAsync("select system_value from variable where system_type = 'directory_device_icon' and system_key = 'frontend'"); - fullPath = Path.Combine(Path.GetDirectoryName(Directory.GetCurrentDirectory()), frontendPath, tempDeviceKindFileSaveAsPath); + fullPath = frontendPath; if (!System.IO.Directory.Exists(fullPath)) System.IO.Directory.CreateDirectory(fullPath); @@ -1591,9 +1589,9 @@ namespace Backend.Controllers post.Device_master_icon_file.CopyTo(stream); } - var frontendPath = await backendRepository.GetOneAsync("select system_value from variable where system_type = 'directory' and system_key = 'frontend'"); + var frontendPath = await backendRepository.GetOneAsync("select system_value from variable where system_type = 'directory_device_master' and system_key = 'frontend'"); - fullPath = Path.Combine(Path.GetDirectoryName(Directory.GetCurrentDirectory()), frontendPath, tempDeviceKindFileSaveAsPath); + fullPath = frontendPath; if (!System.IO.Directory.Exists(fullPath)) System.IO.Directory.CreateDirectory(fullPath); @@ -1668,9 +1666,9 @@ namespace Backend.Controllers post.Device_master_icon_file.CopyTo(stream); } - var frontendPath = await backendRepository.GetOneAsync("select system_value from variable where system_type = 'directory' and system_key = 'frontend'"); + var frontendPath = await backendRepository.GetOneAsync("select system_value from variable where system_type = 'directory_device_master' and system_key = 'frontend'"); - fullPath = Path.Combine(Path.GetDirectoryName(Directory.GetCurrentDirectory()), frontendPath, tempDeviceKindFileSaveAsPath); + fullPath = frontendPath; if (!System.IO.Directory.Exists(fullPath)) System.IO.Directory.CreateDirectory(fullPath); diff --git a/Backend/wwwroot/upload/floor_map/54ca9e34-9dca-410a-a8fb-69d2b026faf7.svg b/Backend/wwwroot/upload/floor_map/54ca9e34-9dca-410a-a8fb-69d2b026faf7.svg new file mode 100644 index 0000000..e69de29