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 * * * ?",