From 068977a5c89a98aa10d09da7c70cba048567ece9 Mon Sep 17 00:00:00 2001 From: Kai Date: Tue, 7 Sep 2021 09:47:04 +0800 Subject: [PATCH] =?UTF-8?q?1.=20=E4=BF=AE=E6=94=B9=E9=81=B8=E5=96=AElogo?= =?UTF-8?q?=20=E9=A0=90=E8=A8=AD=E5=9C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- SolarPower/Controllers/MyBaseController.cs | 19 +++++++++++++++++++ SolarPower/Models/MyBaseModel.cs | 2 +- SolarPower/appsettings.Development.json | 2 +- 3 files changed, 21 insertions(+), 2 deletions(-) diff --git a/SolarPower/Controllers/MyBaseController.cs b/SolarPower/Controllers/MyBaseController.cs index 8804bb1..bd9f96e 100644 --- a/SolarPower/Controllers/MyBaseController.cs +++ b/SolarPower/Controllers/MyBaseController.cs @@ -87,6 +87,25 @@ namespace SolarPower.Controllers //取得當前登入使用者資訊 myUser = userRepository.GetMyUserInfoByAccount(myAccount); myUser.Company = companyRepository.GetMyCompanyInfoById(myUser.CompanyId); + + //判斷該檔案是否存在 + if (!string.IsNullOrEmpty(myUser.Company.Logo)) + { + var fullFilePath = Directory.GetCurrentDirectory() + "/wwwroot/" + Path.Combine("upload", "company_logo", myUser.Company.Logo); + if (!System.IO.File.Exists(fullFilePath)) + { + myUser.Company.Logo = "/img/logo.png"; + } + else + { + myUser.Company.Logo = Path.Combine("upload", "company_logo", myUser.Company.Logo); + } + } + else + { + myUser.Company.Logo = "/img/logo.png"; + } + myUser.Role = roleRepository.GetMyRoleInfoById(myUser.RoleId); List auth_arr = new List(); diff --git a/SolarPower/Models/MyBaseModel.cs b/SolarPower/Models/MyBaseModel.cs index d84959e..b176946 100644 --- a/SolarPower/Models/MyBaseModel.cs +++ b/SolarPower/Models/MyBaseModel.cs @@ -63,7 +63,7 @@ namespace SolarPower.Models public int Id { get; set; } public byte Status { get; set; } //狀態 public string Name { get; set; } //名稱 - public string Logo { get { return "/upload/company_logo/" + logo; } set { logo = value; } } + public string Logo { get; set; } } //當前登入使用者的角色權限 diff --git a/SolarPower/appsettings.Development.json b/SolarPower/appsettings.Development.json index 1322378..a4eacb3 100644 --- a/SolarPower/appsettings.Development.json +++ b/SolarPower/appsettings.Development.json @@ -25,7 +25,7 @@ //}, "BackgroundServiceCron": { "CalcPowerStationJob": "0 5 * * * ?", - "CalcAvgPowerStationJob": "0/10 * * * * ?", + "CalcAvgPowerStationJob": "0 0 2 * * ?", "OperationScheduleJob": "0 0 2 * * ?", "CalcInverter15minJob": "0 2/15 * * * ?", "SendEmailJob": "0 0/5 * * * ?",