|
@@ -1,4 +1,5 @@
|
|
|
-using Hotline.File;
|
|
|
+using Hotline.Caching.Interfaces;
|
|
|
+using Hotline.File;
|
|
|
using Hotline.Repository.SqlSugar.Extensions;
|
|
|
using Hotline.Share.Dtos;
|
|
|
using Hotline.Share.Dtos.Snapshot;
|
|
@@ -19,11 +20,13 @@ public class IndustryApplication : IIndustryApplication, IScopeDependency
|
|
|
{
|
|
|
private readonly IIndustryRepository _industryRepository;
|
|
|
private readonly IFileRepository _fileRepository;
|
|
|
+ private readonly ISystemSettingCacheManager _sysSetting;
|
|
|
|
|
|
- public IndustryApplication(IIndustryRepository industryRepository, IFileRepository fileRepository)
|
|
|
+ public IndustryApplication(IIndustryRepository industryRepository, IFileRepository fileRepository, ISystemSettingCacheManager sysSetting)
|
|
|
{
|
|
|
_industryRepository = industryRepository;
|
|
|
_fileRepository = fileRepository;
|
|
|
+ _sysSetting = sysSetting;
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
@@ -55,4 +58,23 @@ public class IndustryApplication : IIndustryApplication, IScopeDependency
|
|
|
|
|
|
return query;
|
|
|
}
|
|
|
+
|
|
|
+ public async Task<IndustryDetailOutDto> GetIndustryDetailAsync(string id)
|
|
|
+ {
|
|
|
+ var fileServiceUrl = _sysSetting.FileServerUrl;
|
|
|
+ var fileDownloadApi = fileServiceUrl + _sysSetting.FileDownloadApi;
|
|
|
+ var industry = await _industryRepository.GetAsync(id);
|
|
|
+ var files = await _fileRepository.GetByKeyAsync(id, CancellationToken.None);
|
|
|
+ var outDto = industry.Adapt<IndustryDetailOutDto>();
|
|
|
+ outDto.Files = files.Adapt<IList<IndustryFileDto>>();
|
|
|
+ if (outDto.BackgroundImgUrl.NotNullOrEmpty())
|
|
|
+ outDto.BackgroundImgUrl = fileDownloadApi + outDto.BackgroundImgUrl;
|
|
|
+ if (outDto.BannerImgUrl.NotNullOrEmpty())
|
|
|
+ outDto.BannerImgUrl = fileDownloadApi + outDto.BannerImgUrl;
|
|
|
+ if (outDto.CareCellImgUrl.NotNullOrEmpty())
|
|
|
+ outDto.CareCellImgUrl = fileDownloadApi + outDto.CareCellImgUrl;
|
|
|
+ if (outDto.CellImgUrl.NotNullOrEmpty())
|
|
|
+ outDto.CellImgUrl = fileDownloadApi + outDto.CellImgUrl;
|
|
|
+ return outDto;
|
|
|
+ }
|
|
|
}
|