完善主题内容
This commit is contained in:
@@ -6,6 +6,10 @@ using Yi.Framework.Ddd.Services;
|
||||
using Yi.BBS.Application.Contracts.Forum.Dtos.Discuss;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Yi.Framework.Ddd.Dtos;
|
||||
using Yi.BBS.Domain.Forum;
|
||||
using AutoMapper;
|
||||
using SqlSugar;
|
||||
using Microsoft.AspNetCore.Routing;
|
||||
|
||||
namespace Yi.BBS.Application.Forum
|
||||
{
|
||||
@@ -16,12 +20,43 @@ namespace Yi.BBS.Application.Forum
|
||||
public class DiscussService : CrudAppService<DiscussEntity, DiscussGetOutputDto, DiscussGetListOutputDto, long, DiscussGetListInputVo, DiscussCreateInputVo, DiscussUpdateInputVo>,
|
||||
IDiscussService, IAutoApiService
|
||||
{
|
||||
private readonly ForumManager _forumManager;
|
||||
public DiscussService(ForumManager forumManager)
|
||||
{
|
||||
_forumManager = forumManager;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取改板块下的主题
|
||||
/// </summary>
|
||||
/// <param name="plateId"></param>
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
|
||||
public async Task<PagedResultDto<DiscussGetListOutputDto>> GetPlateIdAsync([FromRoute] long plateId, [FromQuery] DiscussGetListInputVo input)
|
||||
{
|
||||
var entities = await _repository.GetPageListAsync(x => x.PlateId == plateId, input);
|
||||
var items= await MapToGetListOutputDtosAsync(entities);
|
||||
var total = await _repository.CountAsync(x=>x.IsDeleted==false);
|
||||
var items = await MapToGetListOutputDtosAsync(entities);
|
||||
var total = await _repository.CountAsync(x => x.IsDeleted == false);
|
||||
return new PagedResultDto<DiscussGetListOutputDto>(total, items);
|
||||
}
|
||||
|
||||
[AutoApi(false)]
|
||||
public override Task<DiscussGetOutputDto> CreateAsync(DiscussCreateInputVo input)
|
||||
{
|
||||
return base.CreateAsync(input);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 创建主题
|
||||
/// </summary>
|
||||
/// <param name="plateId"></param>
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<DiscussGetOutputDto> CreatePlateIdAsync([FromRoute] long plateId, DiscussCreateInputVo input)
|
||||
{
|
||||
var entity = await _forumManager.CreateDiscussAsync(plateId, input.Title, input.Types, input.Content, input.Introduction);
|
||||
return await MapToGetOutputDtoAsync(entity);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user