Files
Yi.Admin/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application/Services/Forum/CommentService.cs

86 lines
3.0 KiB
C#
Raw Normal View History

2023-12-22 16:46:39 +08:00
using Mapster;
2023-12-24 11:45:43 +08:00
using Microsoft.AspNetCore.Authorization;
2023-12-11 09:55:12 +08:00
using Microsoft.AspNetCore.Mvc;
2023-04-15 22:44:33 +08:00
using SqlSugar;
2023-12-11 09:55:12 +08:00
using Volo.Abp;
using Volo.Abp.Application.Dtos;
2024-10-26 15:11:45 +08:00
using Volo.Abp.Application.Services;
using Volo.Abp.Domain.Repositories;
2023-12-22 16:46:39 +08:00
using Yi.Framework.Bbs.Application.Contracts.Dtos.BbsUser;
2023-12-11 09:55:12 +08:00
using Yi.Framework.Bbs.Application.Contracts.Dtos.Comment;
using Yi.Framework.Bbs.Application.Contracts.IServices;
2024-01-11 18:51:53 +08:00
using Yi.Framework.Bbs.Domain.Entities.Forum;
2023-12-11 09:55:12 +08:00
using Yi.Framework.Bbs.Domain.Managers;
using Yi.Framework.Bbs.Domain.Shared.Consts;
using Yi.Framework.Ddd.Application;
2023-12-24 11:45:43 +08:00
using Yi.Framework.Rbac.Domain.Authorization;
2024-01-18 16:28:09 +08:00
using Yi.Framework.Rbac.Domain.Extensions;
2023-12-24 11:45:43 +08:00
using Yi.Framework.Rbac.Domain.Shared.Consts;
2023-12-11 09:55:12 +08:00
using Yi.Framework.SqlSugarCore.Abstractions;
2024-01-11 18:51:53 +08:00
namespace Yi.Framework.Bbs.Application.Services.Forum
2023-04-15 22:44:33 +08:00
{
/// <summary>
/// 评论
/// </summary>
2024-10-26 15:11:45 +08:00
public class CommentService : ApplicationService,
2023-12-11 09:55:12 +08:00
ICommentService
2023-04-15 22:44:33 +08:00
{
2024-05-22 14:35:08 +08:00
private readonly ISqlSugarRepository<CommentAggregateRoot, Guid> _repository;
2023-12-22 16:46:39 +08:00
private readonly BbsUserManager _bbsUserManager;
2023-04-15 22:44:33 +08:00
private ForumManager _forumManager { get; set; }
2024-05-22 14:35:08 +08:00
private ISqlSugarRepository<DiscussAggregateRoot> _discussRepository { get; set; }
2023-04-15 22:44:33 +08:00
private IDiscussService _discussService { get; set; }
2023-12-24 13:16:18 +08:00
2024-10-26 15:11:45 +08:00
public async Task<CommentGetOutputDto> Create2Async(CommentCreateInputVo input)
{
var entity = new CommentAggregateRoot(Guid.Empty);
return new CommentGetOutputDto();
2023-04-15 22:44:33 +08:00
}
2024-10-26 15:11:45 +08:00
[HttpGet("Create22")]
public async Task<CommentGetOutputDto> Create22Async(CommentCreateInputVo input)
{
var entity = new CommentAggregateRoot(Guid.Empty);
return new CommentGetOutputDto();
}
2023-04-15 22:44:33 +08:00
/// <summary>
/// 发表评论
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
/// <exception cref="UserFriendlyException"></exception>
2024-10-26 00:40:43 +08:00
// [Permission("bbs:comment:add")]
// [Authorize]
2024-10-26 15:11:45 +08:00
public async Task<CommentGetOutputDto> CreateAsync(CommentCreateInputVo input)
2023-04-15 22:44:33 +08:00
{
2024-10-26 15:11:45 +08:00
// var discuess = await _discussRepository.GetFirstAsync(x => x.Id == input.DiscussId);
// if (discuess is null)
// {
// throw new UserFriendlyException(DiscussConst.No_Exist);
// }
2023-12-24 11:45:43 +08:00
//不是超级管理员,且主题开启禁止评论
2023-12-19 13:05:03 +08:00
2024-10-26 15:11:45 +08:00
// if (discuess.IsDisableCreateComment == true && !CurrentUser.GetPermissions().Contains(UserConst.AdminPermissionCode))
// {
// throw new UserFriendlyException("该主题已禁止评论功能");
// }
2023-12-24 11:45:43 +08:00
2024-10-26 15:11:45 +08:00
// var entity = await _forumManager.CreateCommentAsync(input.DiscussId, input.ParentId, input.RootId, input.Content);
var entity = new CommentAggregateRoot(Guid.Empty);
return new CommentGetOutputDto();
2023-04-15 22:44:33 +08:00
}
2024-10-26 15:11:45 +08:00
public CommentService(IRepository<CommentAggregateRoot, Guid> repository)
{
}
2023-04-15 22:44:33 +08:00
}
}