appsetting新增圖片位置

This commit is contained in:
張家睿 2024-01-30 11:13:46 +08:00
parent 34635571a9
commit 3de2b9da17
2 changed files with 15 additions and 12 deletions

View File

@ -29,8 +29,8 @@ namespace FrontendWebApi.ApiControllers
{ {
//[Route("api/[controller]")] //[Route("api/[controller]")]
//[ApiController] //[ApiController]
public class TenantBillController //public class TenantBillController
//public class TenantBillController : MyBaseApiController<TenantBillController> public class TenantBillController : MyBaseApiController<TenantBillController>
{ {
private readonly IBackendRepository backendRepository; private readonly IBackendRepository backendRepository;
private readonly ILogger<TenantBillController> _logger; private readonly ILogger<TenantBillController> _logger;
@ -76,7 +76,7 @@ namespace FrontendWebApi.ApiControllers
{ {
apiResult.Code = "9999"; apiResult.Code = "9999";
apiResult.Msg = "系統內部錯誤,請聯絡管理者。"; apiResult.Msg = "系統內部錯誤,請聯絡管理者。";
//Logger.LogError("【" + controllerName + "/" + actionName + "】" + exception.Message); Logger.LogError("【" + controllerName + "/" + actionName + "】" + exception.Message);
} }
return apiResult; return apiResult;
@ -111,7 +111,7 @@ namespace FrontendWebApi.ApiControllers
{ {
apiResult.Msg = "已有相同使用者。"; apiResult.Msg = "已有相同使用者。";
} }
//Logger.LogError("【" + controllerName + "/" + actionName + "】" + exception.Message); Logger.LogError("【" + controllerName + "/" + actionName + "】" + exception.Message);
} }
return apiResult; return apiResult;
@ -145,7 +145,7 @@ namespace FrontendWebApi.ApiControllers
{ {
apiResult.Msg = "水電報表仍有該用戶,無法修改名稱。"; apiResult.Msg = "水電報表仍有該用戶,無法修改名稱。";
} }
//Logger.LogError("【" + controllerName + "/" + actionName + "】" + exception.Message); Logger.LogError("【" + controllerName + "/" + actionName + "】" + exception.Message);
} }
return apiResult; return apiResult;
@ -172,7 +172,7 @@ namespace FrontendWebApi.ApiControllers
{ {
apiResult.Msg = "水電報表仍有該用戶,無法刪除。"; apiResult.Msg = "水電報表仍有該用戶,無法刪除。";
} }
//Logger.LogError("【" + controllerName + "/" + actionName + "】" + exception.Message); Logger.LogError("【" + controllerName + "/" + actionName + "】" + exception.Message);
} }
return apiResult; return apiResult;
@ -223,7 +223,7 @@ namespace FrontendWebApi.ApiControllers
{ {
apiResult.Code = "9999"; apiResult.Code = "9999";
apiResult.Msg = "系統內部錯誤,請聯絡管理者。"; apiResult.Msg = "系統內部錯誤,請聯絡管理者。";
//Logger.LogError("【" + controllerName + "/" + actionName + "】" + exception.Message); Logger.LogError("【" + controllerName + "/" + actionName + "】" + exception.Message);
} }
return apiResult; return apiResult;
@ -310,7 +310,7 @@ namespace FrontendWebApi.ApiControllers
{ {
apiResult.Code = "9999"; apiResult.Code = "9999";
apiResult.Msg = "系統內部錯誤,請聯絡管理者。"; apiResult.Msg = "系統內部錯誤,請聯絡管理者。";
//Logger.LogError("【" + controllerName + "/" + actionName + "】" + exception.Message); Logger.LogError("【" + controllerName + "/" + actionName + "】" + exception.Message);
} }
return apiResult; return apiResult;
@ -350,7 +350,7 @@ namespace FrontendWebApi.ApiControllers
} }
catch (Exception exception) catch (Exception exception)
{ {
//Logger.LogError("【" + controllerName + "/" + actionName + "】" + exception.Message); Logger.LogError("【" + controllerName + "/" + actionName + "】" + exception.Message);
} }
return new FileContentResult(new byte[0], "application/pdf") return new FileContentResult(new byte[0], "application/pdf")
{ {
@ -432,6 +432,8 @@ namespace FrontendWebApi.ApiControllers
try try
{ {
string path = Configuration.GetValue<string>("FilePath:OutputFormTemplate"); string path = Configuration.GetValue<string>("FilePath:OutputFormTemplate");
string image = Configuration.GetValue<string>("FilePath:Image");
//string path = _webHostEnvironment.ContentRootPath + "\\StaticFiles\\import.html"; //string path = _webHostEnvironment.ContentRootPath + "\\StaticFiles\\import.html";
if (!System.IO.File.Exists(path)) if (!System.IO.File.Exists(path))
{ {
@ -447,7 +449,7 @@ namespace FrontendWebApi.ApiControllers
{ {
bill += $" <div class=\"container a4-page\"> " + bill += $" <div class=\"container a4-page\"> " +
$" <div class=\"header\"> " + $" <div class=\"header\"> " +
$" <img src=\"C:\\jay.chang\\ibms\\FrontendWebApi\\wwwroot\\img\\dome.png\" alt=\"Taipei Dome Logo\" width=\"200\"> " + $" <img src=\"{image}\" alt=\"Taipei Dome Logo\" width=\"150\"> " +
$" <h2>水電費用明細</h2> " + $" <h2>水電費用明細</h2> " +
$" </div> " + $" </div> " +
$" <div class=\"statistics\"> " + $" <div class=\"statistics\"> " +

View File

@ -13,8 +13,9 @@
"JwtLifeSeconds": 3600 "JwtLifeSeconds": 3600
}, },
"FilePath": { "FilePath": {
"OutputForm": "C:\\jay.chang\\ibms\\FrontendWebApi\\wwwroot\\upload\\OutputForm\\", // "OutputForm": "D:\\jay.chang\\dome\\FrontendWebApi\\wwwroot\\upload\\OutputForm\\", //
"OutputFormTemplate": "C:\\jay.chang\\ibms\\FrontendWebApi\\wwwroot\\upload\\OutputFormTemplate\\import.html" // "OutputFormTemplate": "D:\\jay.chang\\dome\\FrontendWebApi\\wwwroot\\upload\\OutputFormTemplate\\import.html", //
"Image": "D:\\jay.chang\\dome\\FrontendWebApi\\wwwroot\\upload\\OutputFormTemplate\\dome.png" //
}, },
"DBConfig": { "DBConfig": {
"MySqlDBConfig": { "MySqlDBConfig": {