From 2d645dd69993eb6fffb24c9ece7769b915f5c7dc Mon Sep 17 00:00:00 2001 From: zpc Date: Mon, 17 Nov 2025 21:40:25 +0800 Subject: [PATCH] =?UTF-8?q?v0.0.7=20=E6=B6=88=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Liveforum/T_MessagesController.cs | 2 +- .../Liveforum/Dto/T_MessagesDto.cs | 2 ++ ZR.LiveForum.Model/Liveforum/T_Messages.cs | 4 +-- .../ILiveforumService/IT_MessagesService.cs | 10 ++++++- ZR.Service/Liveforum/T_MessagesService.cs | 27 ++++++++++++++++++- .../Liveforum/T_UserCertificationsService.cs | 10 ++++++- ZR.Vue/src/views/index.vue | 25 ----------------- ZR.Vue/src/views/liveforum/tmessages.vue | 15 ++++++++++- 8 files changed, 63 insertions(+), 32 deletions(-) diff --git a/ZR.Admin.WebApi/Controllers/Liveforum/T_MessagesController.cs b/ZR.Admin.WebApi/Controllers/Liveforum/T_MessagesController.cs index 4685d6b..4c5a2ae 100644 --- a/ZR.Admin.WebApi/Controllers/Liveforum/T_MessagesController.cs +++ b/ZR.Admin.WebApi/Controllers/Liveforum/T_MessagesController.cs @@ -3,7 +3,7 @@ using ZR.LiveForum.Model.Liveforum.Dto; using ZR.LiveForum.Model.Liveforum; using ZR.Service.Liveforum.ILiveforumService; -//创建时间:2025-11-16 +//创建时间:2025-11-17 namespace ZR.Admin.WebApi.Controllers.Liveforum { /// diff --git a/ZR.LiveForum.Model/Liveforum/Dto/T_MessagesDto.cs b/ZR.LiveForum.Model/Liveforum/Dto/T_MessagesDto.cs index 846a2fd..4824be4 100644 --- a/ZR.LiveForum.Model/Liveforum/Dto/T_MessagesDto.cs +++ b/ZR.LiveForum.Model/Liveforum/Dto/T_MessagesDto.cs @@ -6,6 +6,8 @@ namespace ZR.LiveForum.Model.Liveforum.Dto /// public class T_MessagesQueryDto : PagerInfo { + public long ? ReceiverId { get; set; } + public int ? MessageType { get; set; } } /// diff --git a/ZR.LiveForum.Model/Liveforum/T_Messages.cs b/ZR.LiveForum.Model/Liveforum/T_Messages.cs index 7a27f0d..ae1c806 100644 --- a/ZR.LiveForum.Model/Liveforum/T_Messages.cs +++ b/ZR.LiveForum.Model/Liveforum/T_Messages.cs @@ -1,4 +1,4 @@ - + namespace ZR.LiveForum.Model.Liveforum { /// @@ -22,7 +22,7 @@ namespace ZR.LiveForum.Model.Liveforum /// /// 发送用户ID /// - public long SenderId { get; set; } + public long? SenderId { get; set; } /// /// 消息类型 diff --git a/ZR.Service/Liveforum/ILiveforumService/IT_MessagesService.cs b/ZR.Service/Liveforum/ILiveforumService/IT_MessagesService.cs index cc5064d..7de5012 100644 --- a/ZR.Service/Liveforum/ILiveforumService/IT_MessagesService.cs +++ b/ZR.Service/Liveforum/ILiveforumService/IT_MessagesService.cs @@ -1,4 +1,4 @@ -using ZR.LiveForum.Model.Liveforum.Dto; +using ZR.LiveForum.Model.Liveforum.Dto; using ZR.LiveForum.Model.Liveforum; namespace ZR.Service.Liveforum.ILiveforumService @@ -16,6 +16,14 @@ namespace ZR.Service.Liveforum.ILiveforumService T_Messages AddT_Messages(T_Messages parm); int UpdateT_Messages(T_Messages parm); + /// + /// 发送系统通知消息 + /// + /// 接收者用户ID + /// 消息内容 + /// 关联的内容ID(可选) + /// + T_Messages SendSystemNotification(long receiverId, string messageContent, long? contentId = null); } } diff --git a/ZR.Service/Liveforum/T_MessagesService.cs b/ZR.Service/Liveforum/T_MessagesService.cs index a13db3b..5666921 100644 --- a/ZR.Service/Liveforum/T_MessagesService.cs +++ b/ZR.Service/Liveforum/T_MessagesService.cs @@ -1,4 +1,4 @@ -using Infrastructure.Attribute; +using Infrastructure.Attribute; using Infrastructure.Extensions; using ZR.LiveForum.Model.Liveforum.Dto; using ZR.LiveForum.Model.Liveforum; @@ -74,7 +74,32 @@ namespace ZR.Service.Liveforum { var predicate = Expressionable.Create(); + predicate = predicate.AndIF(parm.ReceiverId != null, it => it.ReceiverId == parm.ReceiverId); + predicate = predicate.AndIF(parm.MessageType != null, it => it.MessageType == parm.MessageType); return predicate; } + + /// + /// 发送系统通知消息 + /// + /// 接收者用户ID + /// 消息内容 + /// 关联的内容ID(可选) + /// + public T_Messages SendSystemNotification(long receiverId, string messageContent, long? contentId = null) + { + var message = new T_Messages + { + ReceiverId = receiverId, + SenderId = null, // 系统消息 + MessageType = 4, // 系统通知 + ContentType = 3, // 用户 + ContentId = contentId, + MessageContent = messageContent, + IsRead = false, + CreatedAt = DateTime.Now + }; + return AddT_Messages(message); + } } } \ No newline at end of file diff --git a/ZR.Service/Liveforum/T_UserCertificationsService.cs b/ZR.Service/Liveforum/T_UserCertificationsService.cs index 35b2baa..f3d1cfe 100644 --- a/ZR.Service/Liveforum/T_UserCertificationsService.cs +++ b/ZR.Service/Liveforum/T_UserCertificationsService.cs @@ -16,10 +16,12 @@ namespace ZR.Service.Liveforum public class T_UserCertificationsService : BaseService, IT_UserCertificationsService { private readonly IT_UsersService _usersService; + private readonly IT_MessagesService _messagesService; - public T_UserCertificationsService(IT_UsersService usersService) + public T_UserCertificationsService(IT_UsersService usersService, IT_MessagesService messagesService) { _usersService = usersService; + _messagesService = messagesService; } /// /// 查询认证申请记录列表 @@ -133,6 +135,12 @@ namespace ZR.Service.Liveforum _usersService.UpdateT_Users(user); } + // 创建消息记录(审核通过或拒绝都需要发送消息) + var messageContent = parm.Status == 1 + ? "您的认证申请已通过审核" + : $"您的认证申请未通过审核,原因:{parm.RejectReason}"; + _messagesService.SendSystemNotification(certification.UserId, messageContent, certification.Id); + return 1; }).IsSuccess ? 1 : 0; } diff --git a/ZR.Vue/src/views/index.vue b/ZR.Vue/src/views/index.vue index e1c2bd6..88ab912 100644 --- a/ZR.Vue/src/views/index.vue +++ b/ZR.Vue/src/views/index.vue @@ -53,33 +53,8 @@ - - - -
- -
-
-
- - -
- -
-
- -
- -
-
- -
- -
-
-