|
@@ -112,6 +112,9 @@ namespace GxPress.Service.Implement.Topic
|
|
|
public async Task<PagedList<TopicListPageResult>> GetGroupTopicPageAsync(TopicDetailListRequest request)
|
|
|
{
|
|
|
var result = new PagedList<TopicListPageResult>();
|
|
|
+ //判断是否小组成员
|
|
|
+ if (request.GroupIds.Count == 1)
|
|
|
+ result.IsUser = await _groupUserRepository.ExistsAsync(request.UserId, request.GroupIds[0]);
|
|
|
if (request.UserId <= 0)
|
|
|
result = await _topicRepository.GetAnonymousGroupTopicPageAsync(request);
|
|
|
else
|
|
@@ -837,10 +840,16 @@ namespace GxPress.Service.Implement.Topic
|
|
|
/// <returns></returns>
|
|
|
public async Task<PagedList<TopicListPageResult>> FindTopicByGroupIdAsync(TopicDetailListRequest request)
|
|
|
{
|
|
|
+ var query = Q.NewQuery();
|
|
|
+ query.Where(nameof(Entity.Topic.Topic.GroupId), request.GroupId);
|
|
|
+ query.Where(nameof(Entity.Topic.Topic.IsDraft), false);
|
|
|
//根据groupID查询话题
|
|
|
- var topics = await _topicRepository.GetAllAsync(Q.Where(nameof(Entity.Topic.Topic.GroupId), request.GroupId));
|
|
|
+ var topics = await _topicRepository.GetAllAsync(query);
|
|
|
+ query = Q.NewQuery();
|
|
|
+ query.WhereIn(nameof(Entity.Topic.TopicAddressee.TopicId), topics.Select(n => n.Id).ToList());
|
|
|
+ query.Where(nameof(Entity.Topic.TopicAddressee.UserId), request.UserId).Set(nameof(Entity.Topic.TopicAddressee.IsRead), true);
|
|
|
//根据话题ID修改用户的阅读
|
|
|
- await _topicAddresseeRepository.UpdateAsync(Q.WhereIn(nameof(Entity.Topic.TopicAddressee.TopicId), topics.Select(n => n.Id).ToList()).Where(nameof(Entity.Topic.TopicAddressee.UserId), request.UserId).Set(nameof(Entity.Topic.TopicAddressee.IsRead), true));
|
|
|
+ await _topicAddresseeRepository.UpdateAsync(query);
|
|
|
var topicListPageResults = await _topicRepository.FindTopicByGroupIdAsync(request);
|
|
|
foreach (var item in topicListPageResults.Items)
|
|
|
{
|