feat:完成底部
This commit is contained in:
@@ -94,6 +94,11 @@
|
||||
Discuss输入创建对象
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Yi.BBS.Application.Contracts.Forum.Dtos.Discuss.DiscussGetListOutputDto.IsAgree">
|
||||
<summary>
|
||||
是否已点赞
|
||||
</summary>
|
||||
</member>
|
||||
<member name="T:Yi.BBS.Application.Contracts.Forum.Dtos.MyTypeCreateInputVo">
|
||||
<summary>
|
||||
Label输入创建对象
|
||||
|
||||
@@ -6,12 +6,12 @@ using System.Threading.Tasks;
|
||||
|
||||
namespace Yi.BBS.Application.Contracts.Exhibition.Dtos.Argee
|
||||
{
|
||||
public class ArgeeDto
|
||||
public class AgreeDto
|
||||
{
|
||||
public ArgeeDto(bool isArgee)
|
||||
public AgreeDto(bool isAgree)
|
||||
{
|
||||
IsArgee = isArgee;
|
||||
if (isArgee)
|
||||
IsAgree = isAgree;
|
||||
if (isAgree)
|
||||
{
|
||||
|
||||
Message = "点赞成功,点赞+1";
|
||||
@@ -24,7 +24,7 @@ namespace Yi.BBS.Application.Contracts.Exhibition.Dtos.Argee
|
||||
|
||||
}
|
||||
|
||||
public bool IsArgee { get; set; }
|
||||
public bool IsAgree { get; set; }
|
||||
public string Message { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -37,7 +37,7 @@ namespace Yi.BBS.Application.Exhibition
|
||||
/// 点赞,返回true为点赞+1,返回false为点赞-1
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public async Task<ArgeeDto> PostOperateAsync(long discussId)
|
||||
public async Task<AgreeDto> PostOperateAsync(long discussId)
|
||||
{
|
||||
var entity = await _repository.GetFirstAsync(x => x.DiscussId == discussId && x.CreatorId == _currentUser.Id);
|
||||
//判断是否已经点赞过
|
||||
@@ -56,7 +56,7 @@ namespace Yi.BBS.Application.Exhibition
|
||||
await _discssRepository.UpdateAsync(discussEntity);
|
||||
uow.Commit();
|
||||
}
|
||||
return new ArgeeDto(true);
|
||||
return new AgreeDto(true);
|
||||
|
||||
}
|
||||
else
|
||||
@@ -75,7 +75,7 @@ namespace Yi.BBS.Application.Exhibition
|
||||
uow.Commit();
|
||||
}
|
||||
|
||||
return new ArgeeDto(false);
|
||||
return new AgreeDto(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Binary file not shown.
@@ -94,6 +94,11 @@
|
||||
Discuss输入创建对象
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Yi.BBS.Application.Contracts.Forum.Dtos.Discuss.DiscussGetListOutputDto.IsAgree">
|
||||
<summary>
|
||||
是否已点赞
|
||||
</summary>
|
||||
</member>
|
||||
<member name="T:Yi.BBS.Application.Contracts.Forum.Dtos.MyTypeCreateInputVo">
|
||||
<summary>
|
||||
Label输入创建对象
|
||||
|
||||
@@ -1,30 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Yi.BBS.Application.Contracts.Exhibition.Dtos.Argee
|
||||
{
|
||||
public class ArgeeDto
|
||||
{
|
||||
public ArgeeDto(bool isArgee)
|
||||
{
|
||||
IsArgee = isArgee;
|
||||
if (isArgee)
|
||||
{
|
||||
|
||||
Message = "点赞成功,点赞+1";
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
Message = "取消点赞,点赞-1";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public bool IsArgee { get; set; }
|
||||
public string Message { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -11,7 +11,10 @@ namespace Yi.BBS.Application.Contracts.Forum.Dtos.Discuss
|
||||
{
|
||||
public class DiscussGetListOutputDto : IEntityDto<long>
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// <20>Ƿ<EFBFBD><C7B7>ѵ<EFBFBD><D1B5><EFBFBD>
|
||||
/// </summary>
|
||||
public bool IsAgree { get; set; }
|
||||
public long Id { get; set; }
|
||||
public string Title { get; set; }
|
||||
public string Types { get; set; }
|
||||
|
||||
@@ -37,7 +37,7 @@ namespace Yi.BBS.Application.Exhibition
|
||||
/// 点赞,返回true为点赞+1,返回false为点赞-1
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public async Task<ArgeeDto> PostOperateAsync(long discussId)
|
||||
public async Task<AgreeDto> PostOperateAsync(long discussId)
|
||||
{
|
||||
var entity = await _repository.GetFirstAsync(x => x.DiscussId == discussId && x.CreatorId == _currentUser.Id);
|
||||
//判断是否已经点赞过
|
||||
@@ -56,7 +56,7 @@ namespace Yi.BBS.Application.Exhibition
|
||||
await _discssRepository.UpdateAsync(discussEntity);
|
||||
uow.Commit();
|
||||
}
|
||||
return new ArgeeDto(true);
|
||||
return new AgreeDto(true);
|
||||
|
||||
}
|
||||
else
|
||||
@@ -75,7 +75,7 @@ namespace Yi.BBS.Application.Exhibition
|
||||
uow.Commit();
|
||||
}
|
||||
|
||||
return new ArgeeDto(false);
|
||||
return new AgreeDto(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,6 +17,8 @@ using Yi.RBAC.Application.Contracts.Identity.Dtos;
|
||||
using Cike.EventBus.DistributedEvent;
|
||||
using Yi.BBS.Domain.Shared.Forum.Etos;
|
||||
using Yi.BBS.Domain.Shared.Forum.EnumClasses;
|
||||
using Yi.Framework.Core.CurrentUsers;
|
||||
using Yi.BBS.Domain.Exhibition.Entities;
|
||||
|
||||
namespace Yi.BBS.Application.Forum
|
||||
{
|
||||
@@ -36,6 +38,8 @@ namespace Yi.BBS.Application.Forum
|
||||
[Autowired]
|
||||
private IDistributedEventBus _distributedEventBus { get; set; }
|
||||
|
||||
[Autowired]
|
||||
private ICurrentUser _currentUser { get; set; }
|
||||
/// <summary>
|
||||
/// 单查
|
||||
/// </summary>
|
||||
@@ -47,10 +51,13 @@ namespace Yi.BBS.Application.Forum
|
||||
var item = await _DbQueryable.LeftJoin<UserEntity>((discuss, user) => discuss.CreatorId == user.Id)
|
||||
.Select((discuss, user) => new DiscussGetOutputDto
|
||||
{
|
||||
User = new UserGetListOutputDto() { UserName = user.UserName, Nick = user.Nick,Icon=user.Icon }
|
||||
}, true).SingleAsync(discuss => discuss.Id==id);
|
||||
|
||||
_distributedEventBus.PublishAsync(new SeeDiscussEventArgs { DiscussId= item.Id, OldSeeNum= item .SeeNum});
|
||||
User = new UserGetListOutputDto() { UserName = user.UserName, Nick = user.Nick, Icon = user.Icon }
|
||||
}, true).SingleAsync(discuss => discuss.Id == id);
|
||||
if (item is not null)
|
||||
{
|
||||
_distributedEventBus.PublishAsync(new SeeDiscussEventArgs { DiscussId = item.Id, OldSeeNum = item.SeeNum });
|
||||
}
|
||||
|
||||
return item;
|
||||
}
|
||||
|
||||
@@ -61,21 +68,24 @@ namespace Yi.BBS.Application.Forum
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
|
||||
public override async Task<PagedResultDto<DiscussGetListOutputDto>> GetListAsync( [FromQuery] DiscussGetListInputVo input)
|
||||
public override async Task<PagedResultDto<DiscussGetListOutputDto>> GetListAsync([FromQuery] DiscussGetListInputVo input)
|
||||
{
|
||||
//需要关联创建者用户
|
||||
RefAsync<int> total = 0;
|
||||
var items = await _DbQueryable
|
||||
.WhereIF(!string.IsNullOrEmpty(input.Title), x => x.Title.Contains(input.Title))
|
||||
.WhereIF(input.PlateId is not null, x => x.PlateId == input.PlateId)
|
||||
.Where(x=>x.IsTop==input.IsTop)
|
||||
.OrderByIF(input.Type==QueryDiscussTypeEnum.New, x =>x.CreationTime,OrderByType.Desc )
|
||||
.Where(x => x.IsTop == input.IsTop)
|
||||
.OrderByIF(input.Type == QueryDiscussTypeEnum.New, x => x.CreationTime, OrderByType.Desc)
|
||||
.OrderByIF(input.Type == QueryDiscussTypeEnum.Host, x => x.SeeNum, OrderByType.Desc)
|
||||
.OrderByIF(input.Type == QueryDiscussTypeEnum.Suggest, x => x.AgreeNum, OrderByType.Desc)
|
||||
.LeftJoin<UserEntity>((discuss, user) => discuss.CreatorId==user.Id)
|
||||
.Select((discuss,user) =>new DiscussGetListOutputDto {
|
||||
User=new UserGetListOutputDto() { UserName=user.UserName,Nick=user.Nick, Icon = user.Icon }
|
||||
},true)
|
||||
.LeftJoin<UserEntity>((discuss, user) => discuss.CreatorId == user.Id)
|
||||
.Select((discuss, user) => new DiscussGetListOutputDto
|
||||
{
|
||||
Id=discuss.Id,
|
||||
IsAgree = SqlFunc.Subqueryable<AgreeEntity>().Where(x => x.CreatorId == _currentUser.Id && x.DiscussId == discuss.Id).Any(),
|
||||
User = new UserGetListOutputDto() { UserName = user.UserName, Nick = user.Nick, Icon = user.Icon }
|
||||
}, true)
|
||||
.ToPageListAsync(input.PageNum, input.PageSize, total);
|
||||
return new PagedResultDto<DiscussGetListOutputDto>(total, items);
|
||||
}
|
||||
|
||||
Binary file not shown.
Reference in New Issue
Block a user