[後端] 修改上傳路徑
This commit is contained in:
parent
e505d7c722
commit
92fe3231ad
@ -20,8 +20,6 @@ namespace Backend.Controllers
|
|||||||
private readonly IBackendRepository backendRepository;
|
private readonly IBackendRepository backendRepository;
|
||||||
private string mapFileSaveAsPath = "";
|
private string mapFileSaveAsPath = "";
|
||||||
private string buildMapFileSaveAsPath = "";
|
private string buildMapFileSaveAsPath = "";
|
||||||
private string tempMapFileSaveAsPath = "";
|
|
||||||
private string tempBuildMapFileSaveAsPath = "";
|
|
||||||
|
|
||||||
public BuildInfoController(IBackendRepository backendRepository)
|
public BuildInfoController(IBackendRepository backendRepository)
|
||||||
{
|
{
|
||||||
@ -29,8 +27,6 @@ namespace Backend.Controllers
|
|||||||
|
|
||||||
mapFileSaveAsPath = Path.Combine(Directory.GetCurrentDirectory(), "wwwroot", "upload", "floor_map");
|
mapFileSaveAsPath = Path.Combine(Directory.GetCurrentDirectory(), "wwwroot", "upload", "floor_map");
|
||||||
buildMapFileSaveAsPath = Path.Combine(Directory.GetCurrentDirectory(), "wwwroot", "upload", "build_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()
|
public IActionResult Index()
|
||||||
@ -180,9 +176,9 @@ namespace Backend.Controllers
|
|||||||
post.Map3dFile.CopyTo(stream);
|
post.Map3dFile.CopyTo(stream);
|
||||||
}
|
}
|
||||||
|
|
||||||
var frontendPath = await backendRepository.GetOneAsync<string>("select system_value from variable where system_type = 'directory' and system_key = 'frontend'");
|
var frontendPath = await backendRepository.GetOneAsync<string>("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))
|
if (!System.IO.Directory.Exists(fullPath))
|
||||||
System.IO.Directory.CreateDirectory(fullPath);
|
System.IO.Directory.CreateDirectory(fullPath);
|
||||||
|
|
||||||
@ -306,9 +302,9 @@ namespace Backend.Controllers
|
|||||||
post.Map3dFile.CopyTo(stream);
|
post.Map3dFile.CopyTo(stream);
|
||||||
}
|
}
|
||||||
|
|
||||||
var frontendPath = await backendRepository.GetOneAsync<string>("select system_value from variable where system_type = 'directory' and system_key = 'frontend'");
|
var frontendPath = await backendRepository.GetOneAsync<string>("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))
|
if (!System.IO.Directory.Exists(fullPath))
|
||||||
System.IO.Directory.CreateDirectory(fullPath);
|
System.IO.Directory.CreateDirectory(fullPath);
|
||||||
|
|
||||||
@ -571,17 +567,17 @@ namespace Backend.Controllers
|
|||||||
|
|
||||||
var fullPath = Path.Combine(mapFileSaveAsPath, fileName);
|
var fullPath = Path.Combine(mapFileSaveAsPath, fileName);
|
||||||
|
|
||||||
if (!System.IO.Directory.Exists(buildMapFileSaveAsPath))
|
if (!System.IO.Directory.Exists(mapFileSaveAsPath))
|
||||||
System.IO.Directory.CreateDirectory(buildMapFileSaveAsPath);
|
System.IO.Directory.CreateDirectory(mapFileSaveAsPath);
|
||||||
|
|
||||||
using (var stream = new FileStream(fullPath, FileMode.Create))
|
using (var stream = new FileStream(fullPath, FileMode.Create))
|
||||||
{
|
{
|
||||||
post.MapFile.CopyTo(stream);
|
post.MapFile.CopyTo(stream);
|
||||||
}
|
}
|
||||||
|
|
||||||
var frontendPath = await backendRepository.GetOneAsync<string>("select system_value from variable where system_type = 'directory' and system_key = 'frontend'");
|
var frontendPath = await backendRepository.GetOneAsync<string>("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))
|
if (!System.IO.Directory.Exists(fullPath))
|
||||||
System.IO.Directory.CreateDirectory(fullPath);
|
System.IO.Directory.CreateDirectory(fullPath);
|
||||||
|
|
||||||
@ -626,17 +622,17 @@ namespace Backend.Controllers
|
|||||||
|
|
||||||
var fullPath = Path.Combine(mapFileSaveAsPath, fileName);
|
var fullPath = Path.Combine(mapFileSaveAsPath, fileName);
|
||||||
|
|
||||||
if (!System.IO.Directory.Exists(buildMapFileSaveAsPath))
|
if (!System.IO.Directory.Exists(mapFileSaveAsPath))
|
||||||
System.IO.Directory.CreateDirectory(buildMapFileSaveAsPath);
|
System.IO.Directory.CreateDirectory(mapFileSaveAsPath);
|
||||||
|
|
||||||
using (var stream = new FileStream(fullPath, FileMode.Create))
|
using (var stream = new FileStream(fullPath, FileMode.Create))
|
||||||
{
|
{
|
||||||
post.MapFile.CopyTo(stream);
|
post.MapFile.CopyTo(stream);
|
||||||
}
|
}
|
||||||
|
|
||||||
var frontendPath = await backendRepository.GetOneAsync<string>("select system_value from variable where system_type = 'directory' and system_key = 'frontend'");
|
var frontendPath = await backendRepository.GetOneAsync<string>("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))
|
if (!System.IO.Directory.Exists(fullPath))
|
||||||
System.IO.Directory.CreateDirectory(fullPath);
|
System.IO.Directory.CreateDirectory(fullPath);
|
||||||
|
|
||||||
|
@ -17,7 +17,6 @@ namespace Backend.Controllers
|
|||||||
private readonly IDeviceManageRepository deviceManageRepository;
|
private readonly IDeviceManageRepository deviceManageRepository;
|
||||||
private string deviceKindFileSaveAsPath = "";
|
private string deviceKindFileSaveAsPath = "";
|
||||||
private string deviceKindFilePath = "upload/device_icon/";
|
private string deviceKindFilePath = "upload/device_icon/";
|
||||||
private string tempDeviceKindFileSaveAsPath = "";
|
|
||||||
|
|
||||||
|
|
||||||
public DeviceManageController(IBackendRepository backendRepository, IDeviceManageRepository deviceManageRepository)
|
public DeviceManageController(IBackendRepository backendRepository, IDeviceManageRepository deviceManageRepository)
|
||||||
@ -26,7 +25,6 @@ namespace Backend.Controllers
|
|||||||
this.deviceManageRepository = deviceManageRepository;
|
this.deviceManageRepository = deviceManageRepository;
|
||||||
|
|
||||||
deviceKindFileSaveAsPath = Path.Combine(Directory.GetCurrentDirectory(), "wwwroot", "upload", "device_icon");
|
deviceKindFileSaveAsPath = Path.Combine(Directory.GetCurrentDirectory(), "wwwroot", "upload", "device_icon");
|
||||||
tempDeviceKindFileSaveAsPath = Path.Combine("wwwroot", "upload", "device_icon");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public IActionResult Index()
|
public IActionResult Index()
|
||||||
@ -1214,9 +1212,9 @@ namespace Backend.Controllers
|
|||||||
post.Device_image_file.CopyTo(stream);
|
post.Device_image_file.CopyTo(stream);
|
||||||
}
|
}
|
||||||
|
|
||||||
var frontendPath = await backendRepository.GetOneAsync<string>("select system_value from variable where system_type = 'directory' and system_key = 'frontend'");
|
var frontendPath = await backendRepository.GetOneAsync<string>("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))
|
if (!System.IO.Directory.Exists(fullPath))
|
||||||
System.IO.Directory.CreateDirectory(fullPath);
|
System.IO.Directory.CreateDirectory(fullPath);
|
||||||
|
|
||||||
@ -1326,9 +1324,9 @@ namespace Backend.Controllers
|
|||||||
post.Device_image_file.CopyTo(stream);
|
post.Device_image_file.CopyTo(stream);
|
||||||
}
|
}
|
||||||
|
|
||||||
var frontendPath = await backendRepository.GetOneAsync<string>("select system_value from variable where system_type = 'directory' and system_key = 'frontend'");
|
var frontendPath = await backendRepository.GetOneAsync<string>("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))
|
if (!System.IO.Directory.Exists(fullPath))
|
||||||
System.IO.Directory.CreateDirectory(fullPath);
|
System.IO.Directory.CreateDirectory(fullPath);
|
||||||
|
|
||||||
@ -1591,9 +1589,9 @@ namespace Backend.Controllers
|
|||||||
post.Device_master_icon_file.CopyTo(stream);
|
post.Device_master_icon_file.CopyTo(stream);
|
||||||
}
|
}
|
||||||
|
|
||||||
var frontendPath = await backendRepository.GetOneAsync<string>("select system_value from variable where system_type = 'directory' and system_key = 'frontend'");
|
var frontendPath = await backendRepository.GetOneAsync<string>("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))
|
if (!System.IO.Directory.Exists(fullPath))
|
||||||
System.IO.Directory.CreateDirectory(fullPath);
|
System.IO.Directory.CreateDirectory(fullPath);
|
||||||
|
|
||||||
@ -1668,9 +1666,9 @@ namespace Backend.Controllers
|
|||||||
post.Device_master_icon_file.CopyTo(stream);
|
post.Device_master_icon_file.CopyTo(stream);
|
||||||
}
|
}
|
||||||
|
|
||||||
var frontendPath = await backendRepository.GetOneAsync<string>("select system_value from variable where system_type = 'directory' and system_key = 'frontend'");
|
var frontendPath = await backendRepository.GetOneAsync<string>("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))
|
if (!System.IO.Directory.Exists(fullPath))
|
||||||
System.IO.Directory.CreateDirectory(fullPath);
|
System.IO.Directory.CreateDirectory(fullPath);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user