From 578d410b777149f4edcf9659233cbba04de01513 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E6=A9=99=E5=AD=90?= <454313500@qq.com>
Date: Wed, 7 Aug 2024 00:01:44 +0800
Subject: [PATCH] =?UTF-8?q?feat:=20=E4=BC=98=E5=8C=96=EF=BC=8C=E6=94=B9?=
=?UTF-8?q?=E9=80=A0=E9=80=9A=E7=9F=A5=E6=A8=A1=E5=9D=97?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../Dtos/Notice/BbsNoticeGetListOutputDto.cs | 2 +-
.../Consts/DiscussConst.cs | 32 +++++++++++++++++--
.../Entities/BbsNoticeAggregateRoot.cs | 1 +
.../EventHandlers/AgreeChangedEventHandler.cs | 3 +-
.../BbsNoticeSendEventHandler.cs | 4 +--
.../CommentCreatedEventHandler.cs | 7 ++--
6 files changed, 40 insertions(+), 9 deletions(-)
diff --git a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application.Contracts/Dtos/Notice/BbsNoticeGetListOutputDto.cs b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application.Contracts/Dtos/Notice/BbsNoticeGetListOutputDto.cs
index c464ab0b..fe3aea20 100644
--- a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application.Contracts/Dtos/Notice/BbsNoticeGetListOutputDto.cs
+++ b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application.Contracts/Dtos/Notice/BbsNoticeGetListOutputDto.cs
@@ -32,6 +32,6 @@ namespace Yi.Framework.Bbs.Application.Contracts.Dtos.Notice
///
/// 消息创建时间
///
- public DateTime CreationTime { get; }
+ public DateTime CreationTime { get; set; }
}
}
diff --git a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain.Shared/Consts/DiscussConst.cs b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain.Shared/Consts/DiscussConst.cs
index c7dc524f..29103247 100644
--- a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain.Shared/Consts/DiscussConst.cs
+++ b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain.Shared/Consts/DiscussConst.cs
@@ -16,8 +16,34 @@ namespace Yi.Framework.Bbs.Domain.Shared.Consts
public const string Privacy = "【私密】您无该主题权限,可联系作者申请开放";
- public const string AgreeNotice = "您的主题[{0}]被[{1}]用户点赞!得到一致认可,发现宝藏内容!";
-
- public const string CommentNotice = "您的主题[{0}]被[{1}]用户评论!评论内容:[{2}]";
+ public const string AgreeNotice = """
+
+ """;
+ public const string CommentNotice = """
+
+ """;
+ public const string CommentNoticeToReply= """
+
+ """;
}
}
diff --git a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain/Entities/BbsNoticeAggregateRoot.cs b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain/Entities/BbsNoticeAggregateRoot.cs
index cf6180c3..707187ea 100644
--- a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain/Entities/BbsNoticeAggregateRoot.cs
+++ b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain/Entities/BbsNoticeAggregateRoot.cs
@@ -34,6 +34,7 @@ namespace Yi.Framework.Bbs.Domain.Entities
///
/// 消息,支持html
///
+ [SugarColumn(ColumnDataType = StaticConfig.CodeFirst_BigString)]
public string Message { get; set; }
///
diff --git a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain/EventHandlers/AgreeChangedEventHandler.cs b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain/EventHandlers/AgreeChangedEventHandler.cs
index 58a0cb2d..573ce9c5 100644
--- a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain/EventHandlers/AgreeChangedEventHandler.cs
+++ b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain/EventHandlers/AgreeChangedEventHandler.cs
@@ -38,6 +38,7 @@ namespace Yi.Framework.Bbs.Domain.EventHandlers
.Select((agree, discuss) =>
new
{
+ DiscussId=discuss.Id,
DiscussTitle = discuss.Title,
DiscussCreatorId = discuss.CreatorId,
})
@@ -53,7 +54,7 @@ namespace Yi.Framework.Bbs.Domain.EventHandlers
.ExecuteCommandAsync();
//通知主题作者,有人点赞
- await _localEventBus.PublishAsync(new BbsNoticeEventArgs(discussAndAgreeDto.DiscussCreatorId!.Value, string.Format(DiscussConst.AgreeNotice, discussAndAgreeDto.DiscussTitle, agreeUser.UserName)), false);
+ await _localEventBus.PublishAsync(new BbsNoticeEventArgs(discussAndAgreeDto.DiscussCreatorId!.Value, string.Format(DiscussConst.AgreeNotice, discussAndAgreeDto.DiscussTitle, agreeUser.UserName,discussAndAgreeDto.DiscussId)), false);
}
}
diff --git a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain/EventHandlers/BbsNoticeSendEventHandler.cs b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain/EventHandlers/BbsNoticeSendEventHandler.cs
index 3067ad17..6336e260 100644
--- a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain/EventHandlers/BbsNoticeSendEventHandler.cs
+++ b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain/EventHandlers/BbsNoticeSendEventHandler.cs
@@ -26,13 +26,13 @@ namespace Yi.Framework.Bbs.Domain.EventHandlers
public async Task HandleEventAsync(BbsNoticeEventArgs eventData)
{
//离线存储
- await _repository.InsertAsync(new BbsNoticeAggregateRoot(eventData.NoticeType, eventData.Message, eventData.AcceptUserId));
+ var entity= await _repository.InsertReturnEntityAsync(new BbsNoticeAggregateRoot(eventData.NoticeType, eventData.Message, eventData.AcceptUserId));
switch (eventData.NoticeType)
{
case Shared.Enums.NoticeTypeEnum.Personal:
if (BbsNoticeHub.HubUserModels.TryGetValue(eventData.AcceptUserId.ToString(), out var hubUserModel))
{
- _hubContext.Clients.Client(hubUserModel.ConnnectionId).SendAsync(NoticeTypeEnum.Personal.ToString(), eventData.Message);
+ _hubContext.Clients.Client(hubUserModel.ConnnectionId).SendAsync(NoticeTypeEnum.Personal.ToString(), eventData.Message,entity.CreationTime);
}
break;
case Shared.Enums.NoticeTypeEnum.Broadcast:
diff --git a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain/EventHandlers/CommentCreatedEventHandler.cs b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain/EventHandlers/CommentCreatedEventHandler.cs
index 0be15463..d257cab7 100644
--- a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain/EventHandlers/CommentCreatedEventHandler.cs
+++ b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain/EventHandlers/CommentCreatedEventHandler.cs
@@ -42,7 +42,7 @@ namespace Yi.Framework.Bbs.Domain.EventHandlers
.Select((dicuss, user) =>
new
{
- DiscussId = user.Id,
+ DiscussUserId = user.Id,
DiscussTitle = dicuss.Title,
})
@@ -53,7 +53,10 @@ namespace Yi.Framework.Bbs.Domain.EventHandlers
//截取30个长度
var content = commentEntity.Content.Length >= 30 ? commentEntity.Content.Substring(0, 30)+"..." : commentEntity.Content;
//通知主题作者,有人评论
- await _localEventBus.PublishAsync(new BbsNoticeEventArgs(disucssDto.DiscussId, string.Format(DiscussConst.CommentNotice, disucssDto.DiscussTitle, commentUser.UserName, content)), false);
+ await _localEventBus.PublishAsync(new BbsNoticeEventArgs(disucssDto.DiscussUserId, string.Format(DiscussConst.CommentNotice, disucssDto.DiscussTitle, commentUser.UserName, content,commentEntity.DiscussId)), false);
+ //通知回复者,有人评论
+ await _localEventBus.PublishAsync(new BbsNoticeEventArgs(commentEntity.ParentId, string.Format(DiscussConst.CommentNotice, disucssDto.DiscussTitle, commentUser.UserName, content,commentEntity.DiscussId)), false);
+
}
}
}