|
@@ -47,12 +47,17 @@ namespace GxPress.Repository.Implement.Media
|
|
|
//获取媒体
|
|
|
var media = await _repository.GetAsync(id);
|
|
|
result = _mapper.Map<MediaResult>(media);
|
|
|
+ result.ImageUrls = StringUtils.AddDomain(result.ImageUrls);
|
|
|
result.CategoryId = StringUtils.StringCollectionToStringList(media.CategoryId).ToList();
|
|
|
result.CategoryName = StringUtils.StringCollectionToStringList(media.CategoryName).ToList();
|
|
|
result.FullCategoryId = StringUtils.StringCollectionToStringList(media.FullCategoryId).ToList();
|
|
|
//获取媒体库资源
|
|
|
var mediaLibrarys = await mediaLibraryRepository.GetAllAsync(Q.Where(nameof(Entity.tede2.Media.MediaLibrary.MediaId), id));
|
|
|
result.MediaLibraryResults = mediaLibrarys.ToList().Select(n => _mapper.Map<MediaLibraryResult>(n)).ToList();
|
|
|
+ foreach (var item in result.MediaLibraryResults)
|
|
|
+ {
|
|
|
+ item.FileUrl = StringUtils.AddDomain(item.FileUrl);
|
|
|
+ }
|
|
|
//获取媒体标签
|
|
|
var mediaLables = await mediaLableRepository.GetAllAsync(Q.Where(nameof(Entity.tede2.Media.MediaLable.MediaId), id));
|
|
|
result.MediaLableResults = mediaLables.Select(n => _mapper.Map<MediaLableResult>(n)).ToList();
|
|
@@ -92,6 +97,7 @@ namespace GxPress.Repository.Implement.Media
|
|
|
public async Task<bool> InsertAsync(MediaResult result)
|
|
|
{
|
|
|
var model = _mapper.Map<Entity.tede2.Media.Media>(result);
|
|
|
+ model.ImageUrls = StringUtils.RemoveDomain(result.ImageUrls);
|
|
|
try
|
|
|
{
|
|
|
using (var transactionScope = new TransactionScope())
|
|
@@ -120,6 +126,7 @@ namespace GxPress.Repository.Implement.Media
|
|
|
{
|
|
|
var mediaLibrary = _mapper.Map<Entity.tede2.Media.MediaLibrary>(item);
|
|
|
mediaLibrary.MediaId = id;
|
|
|
+ mediaLibrary.FileUrl = StringUtils.RemoveDomain(item.FileUrl);
|
|
|
await mediaLibraryRepository.InsertAsync(mediaLibrary);
|
|
|
}
|
|
|
}
|