/*********************************************************************** * Project: CoreCms * ProjectName: 核心内容管理系统 * Web: https://www.corecms.net * Author: 大灰灰 * Email: jianweie@163.com * CreateTime: 2025/12/7 * Description: 站内信消息服务接口 ***********************************************************************/ using System; using System.Collections.Generic; using System.Linq.Expressions; using System.Threading.Tasks; using CoreCms.Net.Model.Entities; using CoreCms.Net.Model.ViewModels.Basics; using CoreCms.Net.Model.ViewModels.UI; using SqlSugar; namespace CoreCms.Net.IServices { /// /// 站内信消息服务接口 /// public interface ISQMessageServices : IBaseServices { #region 前端API方法 /// /// 获取用户消息列表(包含指定用户消息和全员广播) /// /// 用户ID /// 消息类型:0=全部,1=私信 /// 页码 /// 每页数量 /// 消息列表 Task> GetUserMessageListAsync(int userId, int messageType = 0, int pageIndex = 1, int pageSize = 20); /// /// 获取用户未读消息数量 /// /// 用户ID /// 未读数量 Task GetUnreadCountAsync(int userId); /// /// 标记用户所有消息为已读 /// /// 用户ID /// 是否成功 Task MarkAllAsReadAsync(int userId); #endregion #region 后台管理方法 /// /// 发送消息给指定用户 /// /// 用户ID /// 标题 /// 内容 /// 消息类型 /// 发送者ID /// 是否成功 Task SendToUserAsync(int userId, string title, string content, int messageType = 1, int? senderId = null); /// /// 发送消息给多个用户 /// /// 用户ID列表 /// 标题 /// 内容 /// 消息类型 /// 发送者ID /// 是否成功 Task SendToUsersAsync(List userIds, string title, string content, int messageType = 1, int? senderId = null); /// /// 发送全员广播消息 /// /// 标题 /// 内容 /// 发送者ID /// 是否成功 Task SendBroadcastAsync(string title, string content, int? senderId = null); /// /// 发送系统通知(用于业务触发,如组局成功/失败) /// /// 用户ID /// 标题 /// 内容 /// 关联业务类型 /// 关联业务ID /// 是否成功 Task SendSystemNoticeAsync(int userId, string title, string content, int? relatedType = null, int? relatedId = null); #endregion #region 重写增删改查操作 /// /// 重写异步插入方法 /// new Task InsertAsync(SQMessage entity); /// /// 重写异步更新方法 /// new Task UpdateAsync(SQMessage entity); /// /// 重写删除指定ID的数据 /// new Task DeleteByIdAsync(object id); /// /// 重写删除指定ID集合的数据(批量删除) /// new Task DeleteByIdsAsync(int[] ids); #endregion #region 重写根据条件查询分页数据 /// /// 重写根据条件查询分页数据 /// new Task> QueryPageAsync( Expression> predicate, Expression> orderByExpression, OrderByType orderByType, int pageIndex = 1, int pageSize = 20, bool blUseNoLock = false); #endregion } /// /// 消息DTO(前端返回用) /// public class SQMessageDto { /// /// 消息ID /// public int id { get; set; } /// /// 消息标题 /// public string title { get; set; } /// /// 消息内容 /// public string content { get; set; } /// /// 创建时间 /// public string createTime { get; set; } /// /// 消息类型:0=系统通知,1=私信 /// public int messageType { get; set; } /// /// 是否已读 /// public bool isRead { get; set; } } }