|
@@ -276,6 +276,10 @@ namespace GxPress.Repository.Implement.Media
|
|
|
sql = $@"SELECT count(1) FROM tede_media WHERE id IN ({str})";
|
|
|
result.Total = await connection.ExecuteScalarAsync<int>(sql);
|
|
|
}
|
|
|
+ foreach (var item in result.Items)
|
|
|
+ {
|
|
|
+ item.ImageUrls = StringUtils.AddDomain(item.ImageUrls);
|
|
|
+ }
|
|
|
return result;
|
|
|
}
|
|
|
public async Task<bool> UpdateAsync(MediaResult result)
|
|
@@ -794,5 +798,63 @@ namespace GxPress.Repository.Implement.Media
|
|
|
resut.Items = await _repository.GetAllAsync<MediaCathedraResult>(query);
|
|
|
return resut;
|
|
|
}
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 明栏分页
|
|
|
+ /// </summary>
|
|
|
+ /// <returns></returns>
|
|
|
+ public async Task<PagedList<MediaCathedraResult>> GetStarLablePageAsync(MediaStarLableRequest request)
|
|
|
+ {
|
|
|
+ var resut = new PagedList<MediaCathedraResult>();
|
|
|
+ var query = Q.NewQuery();
|
|
|
+ query.Select(nameof(Entity.tede2.Media.Media.Id));
|
|
|
+ query.Select(nameof(Entity.tede2.Media.Media.ImageUrls));
|
|
|
+ query.Select(nameof(Entity.tede2.Media.Media.Title));
|
|
|
+ query.Select(nameof(Entity.tede2.Media.Media.Author));
|
|
|
+ query.Select(nameof(Entity.tede2.Media.Media.MediaType));
|
|
|
+ query.Select(nameof(Entity.tede2.Media.Media.ReadCount));
|
|
|
+ query.Select(nameof(Entity.tede2.Media.Media.CreatedDate));
|
|
|
+ if (!string.IsNullOrEmpty(request.KeyWord))
|
|
|
+ query.WhereLike(nameof(Entity.tede2.Media.Media.Title), $"%{request.KeyWord}%");
|
|
|
+ query.Where(nameof(Entity.tede2.Media.Media.AttachId), request.AttachId);
|
|
|
+ resut.Total = await _repository.CountAsync(query);
|
|
|
+ if (!string.IsNullOrEmpty(request.Sort))
|
|
|
+ {
|
|
|
+ query.OrderByDesc(nameof(Entity.tede2.Media.Media.IsTop));
|
|
|
+ query.OrderByDesc(nameof(Entity.tede2.Media.Media.IsRecommend));
|
|
|
+ }
|
|
|
+ else
|
|
|
+ query.OrderByDesc(nameof(Entity.tede2.Media.Media.CreatedDate));
|
|
|
+ query.ForPage(request.Page, request.PerPage);
|
|
|
+ resut.Items = await _repository.GetAllAsync<MediaCathedraResult>(query);
|
|
|
+ return resut;
|
|
|
+ }
|
|
|
+ /// <summary>
|
|
|
+ /// 明栏分页
|
|
|
+ /// </summary>
|
|
|
+ /// <returns></returns>
|
|
|
+ public async Task<IEnumerable<MediaCathedraResult>> GetStarLablesAsync(MediaStarLableRequest request)
|
|
|
+ {
|
|
|
+ var query = Q.NewQuery();
|
|
|
+ query.Select(nameof(Entity.tede2.Media.Media.Id));
|
|
|
+ query.Select(nameof(Entity.tede2.Media.Media.ImageUrls));
|
|
|
+ query.Select(nameof(Entity.tede2.Media.Media.Title));
|
|
|
+ query.Select(nameof(Entity.tede2.Media.Media.Author));
|
|
|
+ query.Select(nameof(Entity.tede2.Media.Media.MediaType));
|
|
|
+ query.Select(nameof(Entity.tede2.Media.Media.ReadCount));
|
|
|
+ query.Select(nameof(Entity.tede2.Media.Media.CreatedDate));
|
|
|
+ if (!string.IsNullOrEmpty(request.KeyWord))
|
|
|
+ query.WhereLike(nameof(Entity.tede2.Media.Media.Title), $"%{request.KeyWord}%");
|
|
|
+ query.Where(nameof(Entity.tede2.Media.Media.AttachId), request.AttachId);
|
|
|
+ if (!string.IsNullOrEmpty(request.Sort))
|
|
|
+ {
|
|
|
+ query.OrderByDesc(nameof(Entity.tede2.Media.Media.IsTop));
|
|
|
+ query.OrderByDesc(nameof(Entity.tede2.Media.Media.IsRecommend));
|
|
|
+ }
|
|
|
+ else
|
|
|
+ query.OrderByDesc(nameof(Entity.tede2.Media.Media.CreatedDate));
|
|
|
+ query.ForPage(request.Page, request.PerPage);
|
|
|
+ return await _repository.GetAllAsync<MediaCathedraResult>(query); ;
|
|
|
+ }
|
|
|
}
|
|
|
}
|