v0.0.7 消息

This commit is contained in:
zpc 2025-11-17 21:40:25 +08:00
parent 835ff6e899
commit 2d645dd699
8 changed files with 63 additions and 32 deletions

View File

@ -3,7 +3,7 @@ using ZR.LiveForum.Model.Liveforum.Dto;
using ZR.LiveForum.Model.Liveforum; using ZR.LiveForum.Model.Liveforum;
using ZR.Service.Liveforum.ILiveforumService; using ZR.Service.Liveforum.ILiveforumService;
//创建时间2025-11-16 //创建时间2025-11-17
namespace ZR.Admin.WebApi.Controllers.Liveforum namespace ZR.Admin.WebApi.Controllers.Liveforum
{ {
/// <summary> /// <summary>

View File

@ -6,6 +6,8 @@ namespace ZR.LiveForum.Model.Liveforum.Dto
/// </summary> /// </summary>
public class T_MessagesQueryDto : PagerInfo public class T_MessagesQueryDto : PagerInfo
{ {
public long ? ReceiverId { get; set; }
public int ? MessageType { get; set; }
} }
/// <summary> /// <summary>

View File

@ -1,4 +1,4 @@

namespace ZR.LiveForum.Model.Liveforum namespace ZR.LiveForum.Model.Liveforum
{ {
/// <summary> /// <summary>
@ -22,7 +22,7 @@ namespace ZR.LiveForum.Model.Liveforum
/// <summary> /// <summary>
/// 发送用户ID /// 发送用户ID
/// </summary> /// </summary>
public long SenderId { get; set; } public long? SenderId { get; set; }
/// <summary> /// <summary>
/// 消息类型 /// 消息类型

View File

@ -1,4 +1,4 @@
using ZR.LiveForum.Model.Liveforum.Dto; using ZR.LiveForum.Model.Liveforum.Dto;
using ZR.LiveForum.Model.Liveforum; using ZR.LiveForum.Model.Liveforum;
namespace ZR.Service.Liveforum.ILiveforumService namespace ZR.Service.Liveforum.ILiveforumService
@ -16,6 +16,14 @@ namespace ZR.Service.Liveforum.ILiveforumService
T_Messages AddT_Messages(T_Messages parm); T_Messages AddT_Messages(T_Messages parm);
int UpdateT_Messages(T_Messages parm); int UpdateT_Messages(T_Messages parm);
/// <summary>
/// 发送系统通知消息
/// </summary>
/// <param name="receiverId">接收者用户ID</param>
/// <param name="messageContent">消息内容</param>
/// <param name="contentId">关联的内容ID可选</param>
/// <returns></returns>
T_Messages SendSystemNotification(long receiverId, string messageContent, long? contentId = null);
} }
} }

View File

@ -1,4 +1,4 @@
using Infrastructure.Attribute; using Infrastructure.Attribute;
using Infrastructure.Extensions; using Infrastructure.Extensions;
using ZR.LiveForum.Model.Liveforum.Dto; using ZR.LiveForum.Model.Liveforum.Dto;
using ZR.LiveForum.Model.Liveforum; using ZR.LiveForum.Model.Liveforum;
@ -74,7 +74,32 @@ namespace ZR.Service.Liveforum
{ {
var predicate = Expressionable.Create<T_Messages>(); var predicate = Expressionable.Create<T_Messages>();
predicate = predicate.AndIF(parm.ReceiverId != null, it => it.ReceiverId == parm.ReceiverId);
predicate = predicate.AndIF(parm.MessageType != null, it => it.MessageType == parm.MessageType);
return predicate; return predicate;
} }
/// <summary>
/// 发送系统通知消息
/// </summary>
/// <param name="receiverId">接收者用户ID</param>
/// <param name="messageContent">消息内容</param>
/// <param name="contentId">关联的内容ID可选</param>
/// <returns></returns>
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);
}
} }
} }

View File

@ -16,10 +16,12 @@ namespace ZR.Service.Liveforum
public class T_UserCertificationsService : BaseService<T_UserCertifications>, IT_UserCertificationsService public class T_UserCertificationsService : BaseService<T_UserCertifications>, IT_UserCertificationsService
{ {
private readonly IT_UsersService _usersService; 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; _usersService = usersService;
_messagesService = messagesService;
} }
/// <summary> /// <summary>
/// 查询认证申请记录列表 /// 查询认证申请记录列表
@ -133,6 +135,12 @@ namespace ZR.Service.Liveforum
_usersService.UpdateT_Users(user); _usersService.UpdateT_Users(user);
} }
// 创建消息记录(审核通过或拒绝都需要发送消息)
var messageContent = parm.Status == 1
? "您的认证申请已通过审核"
: $"您的认证申请未通过审核,原因:{parm.RejectReason}";
_messagesService.SendSystemNotification(certification.UserId, messageContent, certification.Id);
return 1; return 1;
}).IsSuccess ? 1 : 0; }).IsSuccess ? 1 : 0;
} }

View File

@ -53,33 +53,8 @@
</el-card> </el-card>
</el-col> </el-col>
</el-row> </el-row>
<panel-group @handleSetLineChartData="handleSetLineChartData" />
<el-row :gutter="32">
<el-col :xs="24" :sm="24" :lg="24">
<div class="chart-wrapper">
<line-chart :chart-data="lineChartData" :key="dataType" />
</div>
</el-col>
</el-row>
<el-row :gutter="32">
<el-col :xs="24" :sm="24" :lg="8">
<div class="chart-wrapper">
<raddar-chart />
</div>
</el-col>
<el-col :xs="24" :sm="24" :lg="8">
<div class="chart-wrapper">
<pie-chart />
</div>
</el-col>
<el-col :xs="24" :sm="24" :lg="8">
<div class="chart-wrapper">
<bar-chart />
</div>
</el-col>
</el-row>
<!-- <el-row :gutter="32"> <!-- <el-row :gutter="32">
<el-col :xs="24" :sm="24" :lg="24"> <el-col :xs="24" :sm="24" :lg="24">
<div class="chart-wrapper"> <div class="chart-wrapper">

View File

@ -1,11 +1,22 @@
<!-- <!--
* @Descripttion: (消息记录/T_Messages) * @Descripttion: (消息记录/T_Messages)
* @Author: (admin) * @Author: (admin)
* @Date: (2025-11-16) * @Date: (2025-11-17)
--> -->
<template> <template>
<div> <div>
<el-form :model="queryParams" label-position="right" inline ref="queryRef" v-show="showSearch" @submit.prevent> <el-form :model="queryParams" label-position="right" inline ref="queryRef" v-show="showSearch" @submit.prevent>
<el-form-item label="用户ID" prop="receiverId">
<el-input v-model.number="queryParams.receiverId" placeholder="请输入用户ID" />
</el-form-item>
<el-form-item label="消息类型" prop="messageType">
<el-select clearable v-model="queryParams.messageType" placeholder="请选择消息类型">
<el-option v-for="item in options.liveforum_messages_type " :key="item.dictValue" :label="item.dictLabel" :value="item.dictValue">
<span class="fl">{{ item.dictLabel }}</span>
<span class="fr" style="color: var(--el-text-color-secondary);">{{ item.dictValue }}</span>
</el-option>
</el-select>
</el-form-item>
<el-form-item> <el-form-item>
<el-button icon="search" type="primary" @click="handleQuery">{{ $t('btn.search') }}</el-button> <el-button icon="search" type="primary" @click="handleQuery">{{ $t('btn.search') }}</el-button>
<el-button icon="refresh" @click="resetQuery">{{ $t('btn.reset') }}</el-button> <el-button icon="refresh" @click="resetQuery">{{ $t('btn.reset') }}</el-button>
@ -151,6 +162,8 @@ const queryParams = reactive({
pageSize: 10, pageSize: 10,
sort: 'Id', sort: 'Id',
sortType: 'desc', sortType: 'desc',
receiverId: undefined,
messageType: undefined,
}) })
const columns = ref([ const columns = ref([
{ visible: true, align: 'center', type: '', prop: 'id', label: 'id' }, { visible: true, align: 'center', type: '', prop: 'id', label: 'id' },