新增reids支持

development
温天培 2 years ago
parent 44693ac92d
commit 5e64b591d0

@ -0,0 +1,51 @@
using System;
using SqlSugar;
using System.ComponentModel;
using GDZZ.Core.Entity;
namespace GDZZ.Application.Entity
{
/// <summary>
/// 聊天历史任务列表
/// </summary>
[SugarTable("live_historycontacts")]
[Description("聊天历史任务列表")]
public class LiveHistoryContacts : DEntityBase
{
/// <summary>
/// 租户Id
/// </summary>
public long TenantId { get; set; }
/// <summary>
/// 名称
/// </summary>
public string DisplayName { get; set; }
/// <summary>
/// 头像
/// </summary>
public string Avatar { get; set; }
/// <summary>
/// 类型
/// </summary>
public string Type { get; set; }
/// <summary>
/// 排序
/// </summary>
public string Index { get; set; }
/// <summary>
/// 消息条数
/// </summary>
public string Unread { get; set; }
/// <summary>
/// 最后时间
/// </summary>
public DateTime LastSendTime { get; set; }
/// <summary>
/// 最后消息
/// </summary>
public string LastContent { get; set; }
/// <summary>
/// 用户ID
/// </summary>
public long UserID { get; set; }
}
}

@ -0,0 +1,47 @@
using System;
using SqlSugar;
using System.ComponentModel;
using GDZZ.Core.Entity;
namespace GDZZ.Application.Entity
{
/// <summary>
/// 聊天信息列表
/// </summary>
[SugarTable("live_messages")]
[Description("聊天信息列表")]
public class LiveMessage : DEntityBase
{
/// <summary>
/// 租户Id
/// </summary>
public long TenantId { get; set; }
/// <summary>
/// 消息
/// </summary>
public string Content { get; set; }
/// <summary>
/// 对方信息
/// </summary>
public long OtherUserID { get; set; }
/// <summary>
/// 消息类型
/// </summary>
public string Type { get; set; }
/// <summary>
/// 状态
/// </summary>
public string Status { get; set; }
/// <summary>
/// 发送时间
/// </summary>
public DateTime SendTime { get; set; }
/// <summary>
/// 文件名称
/// </summary>
public string FileName { get; set; }
/// <summary>
/// 文件大小
/// </summary>
public int FileSize { get; set; }
}
}

@ -0,0 +1,23 @@
using System;
using SqlSugar;
using System.ComponentModel;
using GDZZ.Core.Entity;
namespace GDZZ.Application.Entity
{
/// <summary>
/// 聊天用户好友表
/// </summary>
[SugarTable("live_user_friend")]
[Description("聊天用户好友表")]
public class LiveUserFriend : DEntityBase
{
/// <summary>
/// 租户Id
/// </summary>
public long TenantId { get; set; }
/// <summary>
/// 好友ID
/// </summary>
public long FriendID { get; set; }
}
}

@ -23,7 +23,6 @@
</ItemGroup>
<ItemGroup>
<Folder Include="Entity\" />
<Folder Include="Service\Auth\DTO\" />
</ItemGroup>

@ -79,6 +79,116 @@
公司详情
</summary>
</member>
<member name="T:GDZZ.Application.Entity.LiveHistoryContacts">
<summary>
聊天历史任务列表
</summary>
</member>
<member name="P:GDZZ.Application.Entity.LiveHistoryContacts.TenantId">
<summary>
租户Id
</summary>
</member>
<member name="P:GDZZ.Application.Entity.LiveHistoryContacts.DisplayName">
<summary>
名称
</summary>
</member>
<member name="P:GDZZ.Application.Entity.LiveHistoryContacts.Avatar">
<summary>
头像
</summary>
</member>
<member name="P:GDZZ.Application.Entity.LiveHistoryContacts.Type">
<summary>
类型
</summary>
</member>
<member name="P:GDZZ.Application.Entity.LiveHistoryContacts.Index">
<summary>
排序
</summary>
</member>
<member name="P:GDZZ.Application.Entity.LiveHistoryContacts.Unread">
<summary>
消息条数
</summary>
</member>
<member name="P:GDZZ.Application.Entity.LiveHistoryContacts.LastSendTime">
<summary>
最后时间
</summary>
</member>
<member name="P:GDZZ.Application.Entity.LiveHistoryContacts.LastContent">
<summary>
最后消息
</summary>
</member>
<member name="P:GDZZ.Application.Entity.LiveHistoryContacts.UserID">
<summary>
用户ID
</summary>
</member>
<member name="T:GDZZ.Application.Entity.LiveMessage">
<summary>
聊天信息列表
</summary>
</member>
<member name="P:GDZZ.Application.Entity.LiveMessage.TenantId">
<summary>
租户Id
</summary>
</member>
<member name="P:GDZZ.Application.Entity.LiveMessage.Content">
<summary>
消息
</summary>
</member>
<member name="P:GDZZ.Application.Entity.LiveMessage.OtherUserID">
<summary>
对方信息
</summary>
</member>
<member name="P:GDZZ.Application.Entity.LiveMessage.Type">
<summary>
消息类型
</summary>
</member>
<member name="P:GDZZ.Application.Entity.LiveMessage.Status">
<summary>
状态
</summary>
</member>
<member name="P:GDZZ.Application.Entity.LiveMessage.SendTime">
<summary>
发送时间
</summary>
</member>
<member name="P:GDZZ.Application.Entity.LiveMessage.FileName">
<summary>
文件名称
</summary>
</member>
<member name="P:GDZZ.Application.Entity.LiveMessage.FileSize">
<summary>
文件大小
</summary>
</member>
<member name="T:GDZZ.Application.Entity.LiveUserFriend">
<summary>
聊天用户好友表
</summary>
</member>
<member name="P:GDZZ.Application.Entity.LiveUserFriend.TenantId">
<summary>
租户Id
</summary>
</member>
<member name="P:GDZZ.Application.Entity.LiveUserFriend.FriendID">
<summary>
好友ID
</summary>
</member>
<member name="F:GDZZ.Application.Service.Auth.AuthService._oauthConfig">
<summary>
获取配置文件
@ -94,10 +204,24 @@
即时聊天
</summary>
</member>
<member name="M:GDZZ.Application.Service.LiveChat.LiveChatService.CreateLinkCaht">
<member name="F:GDZZ.Application.Service.LiveChat.LiveChatService._chatHubContext">
<summary>
聊天总线
</summary>
</member>
<member name="M:GDZZ.Application.Service.LiveChat.LiveChatService.#ctor(Microsoft.AspNetCore.SignalR.IHubContext{GDZZ.Core.ChatHub,GDZZ.Core.IChatClient},GDZZ.Core.SqlSugarRepository{GDZZ.Core.Entity.OnlineUser})">
<summary>
聊天服务
</summary>
<param name="chatHubContext"></param>
<param name="_sysOnlineUerRep"></param>
</member>
<member name="M:GDZZ.Application.Service.LiveChat.LiveChatService.PushMessages(System.Collections.Generic.List{System.Int64},System.String)">
<summary>
创建聊天
发送消息
</summary>
<param name="message"></param>
<param name="userIds"></param>
<returns></returns>
</member>
<member name="T:GDZZ.Application.Service.WXPay.IWXPayService">
@ -489,5 +613,276 @@
公司详情
</summary>
</member>
<member name="T:GDZZ.Application.LiveHistoryContactsDto">
<summary>
聊天历史任务列表输出参数
</summary>
</member>
<member name="P:GDZZ.Application.LiveHistoryContactsDto.Id">
<summary>
主键Id
</summary>
</member>
<member name="P:GDZZ.Application.LiveHistoryContactsDto.TenantId">
<summary>
租户Id
</summary>
</member>
<member name="P:GDZZ.Application.LiveHistoryContactsDto.displayName">
<summary>
名称
</summary>
</member>
<member name="P:GDZZ.Application.LiveHistoryContactsDto.avatar">
<summary>
头像
</summary>
</member>
<member name="P:GDZZ.Application.LiveHistoryContactsDto.type">
<summary>
类型
</summary>
</member>
<member name="P:GDZZ.Application.LiveHistoryContactsDto.index">
<summary>
排序
</summary>
</member>
<member name="P:GDZZ.Application.LiveHistoryContactsDto.unread">
<summary>
消息条数
</summary>
</member>
<member name="P:GDZZ.Application.LiveHistoryContactsDto.lastSendTime">
<summary>
最后时间
</summary>
</member>
<member name="P:GDZZ.Application.LiveHistoryContactsDto.lastContent">
<summary>
最后消息
</summary>
</member>
<member name="T:GDZZ.Application.LiveHistoryLists">
<summary>
历史聊天列表输出参数
</summary>
</member>
<member name="P:GDZZ.Application.LiveHistoryLists.Id">
<summary>
联系人ID
</summary>
</member>
<member name="P:GDZZ.Application.LiveHistoryLists.DisplayName">
<summary>
名称
</summary>
</member>
<member name="P:GDZZ.Application.LiveHistoryLists.Avatar">
<summary>
头像
</summary>
</member>
<member name="P:GDZZ.Application.LiveHistoryLists.Type">
<summary>
消息类型
</summary>
</member>
<member name="P:GDZZ.Application.LiveHistoryLists.Index">
<summary>
索引
</summary>
</member>
<member name="P:GDZZ.Application.LiveHistoryLists.Unread">
<summary>
未读消息数
</summary>
</member>
<member name="P:GDZZ.Application.LiveHistoryLists.LastSendTime">
<summary>
最新消息时间戳
</summary>
</member>
<member name="P:GDZZ.Application.LiveHistoryLists.LastContent">
<summary>
最新消息内容
</summary>
</member>
<member name="T:GDZZ.Application.LiveMessageList">
<summary>
聊天记录输出参数
</summary>
</member>
<member name="T:GDZZ.Application.LiveHistoryContactsInput">
<summary>
聊天历史任务列表输入参数
</summary>
</member>
<member name="P:GDZZ.Application.AddLiveHistoryContactsInput.displayName">
<summary>
名称
</summary>
</member>
<member name="P:GDZZ.Application.AddLiveHistoryContactsInput.avatar">
<summary>
头像
</summary>
</member>
<member name="P:GDZZ.Application.AddLiveHistoryContactsInput.type">
<summary>
类型
</summary>
</member>
<member name="P:GDZZ.Application.AddLiveHistoryContactsInput.index">
<summary>
排序
</summary>
</member>
<member name="P:GDZZ.Application.AddLiveHistoryContactsInput.unread">
<summary>
消息条数
</summary>
</member>
<member name="P:GDZZ.Application.AddLiveHistoryContactsInput.lastSendTime">
<summary>
最后时间
</summary>
</member>
<member name="P:GDZZ.Application.AddLiveHistoryContactsInput.lastContent">
<summary>
最后消息
</summary>
</member>
<member name="P:GDZZ.Application.DeleteLiveHistoryContactsInput.Id">
<summary>
主键Id
</summary>
</member>
<member name="P:GDZZ.Application.UpdateLiveHistoryContactsInput.Id">
<summary>
主键Id
</summary>
</member>
<member name="P:GDZZ.Application.AddLiveMessageInput.TenantId">
<summary>
租户Id
</summary>
</member>
<member name="P:GDZZ.Application.AddLiveMessageInput.Content">
<summary>
消息
</summary>
</member>
<member name="P:GDZZ.Application.AddLiveMessageInput.OtherUserID">
<summary>
对方信息
</summary>
</member>
<member name="P:GDZZ.Application.AddLiveMessageInput.Type">
<summary>
消息类型
</summary>
</member>
<member name="P:GDZZ.Application.AddLiveMessageInput.Status">
<summary>
状态
</summary>
</member>
<member name="P:GDZZ.Application.AddLiveMessageInput.SendTime">
<summary>
发送时间
</summary>
</member>
<member name="P:GDZZ.Application.AddLiveMessageInput.FileSize">
<summary>
文件大小
</summary>
</member>
<member name="P:GDZZ.Application.AddLiveMessageInput.FileName">
<summary>
文件名称
</summary>
</member>
<member name="T:GDZZ.Application.LiveHistoryContactsOutput">
<summary>
聊天历史任务列表输出参数
</summary>
</member>
<member name="P:GDZZ.Application.LiveHistoryContactsOutput.Id">
<summary>
主键Id
</summary>
</member>
<member name="P:GDZZ.Application.LiveHistoryContactsOutput.TenantId">
<summary>
租户Id
</summary>
</member>
<member name="P:GDZZ.Application.LiveHistoryContactsOutput.displayName">
<summary>
名称
</summary>
</member>
<member name="P:GDZZ.Application.LiveHistoryContactsOutput.avatar">
<summary>
头像
</summary>
</member>
<member name="P:GDZZ.Application.LiveHistoryContactsOutput.type">
<summary>
类型
</summary>
</member>
<member name="P:GDZZ.Application.LiveHistoryContactsOutput.index">
<summary>
排序
</summary>
</member>
<member name="P:GDZZ.Application.LiveHistoryContactsOutput.unread">
<summary>
消息条数
</summary>
</member>
<member name="P:GDZZ.Application.LiveHistoryContactsOutput.lastSendTime">
<summary>
最后时间
</summary>
</member>
<member name="P:GDZZ.Application.LiveHistoryContactsOutput.lastContent">
<summary>
最后消息
</summary>
</member>
<member name="T:GDZZ.Application.LiveHistoryContactsService">
<summary>
聊天服务
</summary>
</member>
<member name="M:GDZZ.Application.LiveHistoryContactsService.AddLive(GDZZ.Application.AddLiveHistoryContactsInput)">
<summary>
新增联系人
</summary>
<returns></returns>
</member>
<member name="M:GDZZ.Application.LiveHistoryContactsService.List">
<summary>
获取联系人
</summary>
<param name="input"></param>
<returns></returns>
</member>
<member name="M:GDZZ.Application.LiveHistoryContactsService.GetMessageLists">
<summary>
获取聊天信息列表
</summary>
<returns></returns>
</member>
<member name="M:GDZZ.Application.LiveHistoryContactsService.AddMessage(GDZZ.Application.AddLiveMessageInput)">
<summary>
增加聊天历史任务列表
</summary>
<param name="input"></param>
<returns></returns>
</member>
</members>
</doc>

@ -0,0 +1,22 @@
using GDZZ.Application.Entity;
using Mapster;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace GDZZ.Application.Mapper
{
public class Mapper : IRegister
{
public void Register(TypeAdapterConfig config)
{
config.ForType<LiveMessage, LiveMessageList>()
.Map(d => d.ToContactId, s => s.CreatedUserId);
config.ForType<LiveHistoryContacts, LiveHistoryLists>()
.Map(d => d.Id, s => s.CreatedUserId);
}
}
}

@ -11,7 +11,7 @@ namespace GDZZ.Application.Service.LiveChat
/// </summary>
public interface ILiveChatService
{
Task<bool> CreateLinkCaht();
}

@ -1,25 +1,62 @@
using Microsoft.AspNetCore.SignalR;
using GDZZ.Core;
using GDZZ.Core.Entity;
using GDZZ.Core.Service;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.SignalR;
using System.Collections.Generic;
using System.Threading.Tasks;
using System.Linq;
using Furion.DependencyInjection;
using Furion.DynamicApiController;
namespace GDZZ.Application.Service.LiveChat
{
/// <summary>
/// 即时聊天
/// </summary>
public class LiveChatService: Hub<ILiveChatService>
{
public LiveChatService()
[ApiDescriptionSettings("Application", Name = "LiveChat", Order = 1)]
public class LiveChatService:Hub<ILiveChatService> ,ILiveChatService, IDynamicApiController, ITransient
{
/// <summary>
/// 聊天总线
/// </summary>
private readonly IHubContext<ChatHub, IChatClient> _chatHubContext;
private readonly SqlSugarRepository<OnlineUser> sysOnlineUerRep; // 在线用户表仓储
/// <summary>
/// 聊天服务
/// </summary>
/// <param name="chatHubContext"></param>
/// <param name="_sysOnlineUerRep"></param>
public LiveChatService(IHubContext<ChatHub, IChatClient> chatHubContext,
SqlSugarRepository<OnlineUser> _sysOnlineUerRep)
{
this.sysOnlineUerRep = _sysOnlineUerRep;
_chatHubContext = chatHubContext;
}
/// <summary>
/// 创建聊天
/// 发送消息
/// </summary>
/// <param name="message"></param>
/// <param name="userIds"></param>
/// <returns></returns>
Task<bool> CreateLinkCaht()
[HttpPost("/LiveChat/PushMessage")]
public async Task PushMessages(List<long> userIds, string message)
{
var userList = this.sysOnlineUerRep.Where(m => userIds.Contains(m.UserId)).ToList();
if (userList.Any())
{
foreach (var item in userList)
{
return Task.FromResult(true);
await _chatHubContext.Clients.Client(item.ConnectionId).SendMessage("", item.Name, message);
}
}
}
}

@ -0,0 +1,118 @@
using System;
using GDZZ.Core;
namespace GDZZ.Application
{
/// <summary>
/// 聊天历史任务列表输出参数
/// </summary>
public class LiveHistoryContactsDto
{
/// <summary>
/// 主键Id
/// </summary>
public long Id { get; set; }
/// <summary>
/// 租户Id
/// </summary>
public long TenantId { get; set; }
/// <summary>
/// 名称
/// </summary>
public string displayName { get; set; }
/// <summary>
/// 头像
/// </summary>
public string avatar { get; set; }
/// <summary>
/// 类型
/// </summary>
public string type { get; set; }
/// <summary>
/// 排序
/// </summary>
public string index { get; set; }
/// <summary>
/// 消息条数
/// </summary>
public string unread { get; set; }
/// <summary>
/// 最后时间
/// </summary>
public DateTime lastSendTime { get; set; }
/// <summary>
/// 最后消息
/// </summary>
public string lastContent { get; set; }
}
/// <summary>
/// 历史聊天列表输出参数
/// </summary>
public class LiveHistoryLists
{
/// <summary>
/// 联系人ID
/// </summary>
public long Id { get; set; }
/// <summary>
/// 名称
/// </summary>
public string DisplayName { get; set; }
/// <summary>
/// 头像
/// </summary>
public string Avatar { get; set; }
/// <summary>
/// 消息类型
/// </summary>
public string Type { get; set; }
/// <summary>
/// 索引
/// </summary>
public string Index { get; set; }
/// <summary>
/// 未读消息数
/// </summary>
public int Unread { get; set; }
/// <summary>
/// 最新消息时间戳
/// </summary>
public string LastSendTime { get; set; }
/// <summary>
/// 最新消息内容
/// </summary>
public string LastContent { get; set; }
}
/// <summary>
/// 聊天记录输出参数
/// </summary>
public class LiveMessageList
{
public string ID { get; set; }
public string Status { get; set; }
public string Type { get; set; }
public DateTime SendTime { get; set; }
public string Content { get; set; }
public long ToContactId { get; set; }
}
}

@ -0,0 +1,113 @@
using GDZZ.Core;
using System;
using System.ComponentModel.DataAnnotations;
namespace GDZZ.Application
{
/// <summary>
/// 聊天历史任务列表输入参数
/// </summary>
public class LiveHistoryContactsInput : PageInputBase
{
}
public class AddLiveHistoryContactsInput : LiveHistoryContactsInput
{
/// <summary>
/// 名称
/// </summary>
public string displayName { get; set; }
/// <summary>
/// 头像
/// </summary>
public string avatar { get; set; }
/// <summary>
/// 类型
/// </summary>
public string type { get; set; }
/// <summary>
/// 排序
/// </summary>
public string index { get; set; }
/// <summary>
/// 消息条数
/// </summary>
public string unread { get; set; }
/// <summary>
/// 最后时间
/// </summary>
public DateTime lastSendTime { get; set; }
/// <summary>
/// 最后消息
/// </summary>
public string lastContent { get; set; }
}
public class DeleteLiveHistoryContactsInput
{
/// <summary>
/// 主键Id
/// </summary>
[Required(ErrorMessage = "主键Id不能为空")]
public long Id { get; set; }
}
public class UpdateLiveHistoryContactsInput : LiveHistoryContactsInput
{
/// <summary>
/// 主键Id
/// </summary>
[Required(ErrorMessage = "主键Id不能为空")]
public long Id { get; set; }
}
public class QueryeLiveHistoryContactsInput : DeleteLiveHistoryContactsInput
{
}
public class AddLiveMessageInput
{
/// <summary>
/// 租户Id
/// </summary>
public long TenantId { get; set; }
/// <summary>
/// 消息
/// </summary>
public string Content { get; set; }
/// <summary>
/// 对方信息
/// </summary>
public long OtherUserID { get; set; }
/// <summary>
/// 消息类型
/// </summary>
public string Type { get; set; }
/// <summary>
/// 状态
/// </summary>
public string Status { get; set; }
/// <summary>
/// 发送时间
/// </summary>
public DateTime SendTime { get; set; }
/// <summary>
/// 文件大小
/// </summary>
public string FileSize { get; set; }
/// <summary>
/// 文件名称
/// </summary>
public string FileName { get; set; }
}
}

@ -0,0 +1,56 @@
using System;
namespace GDZZ.Application
{
/// <summary>
/// 聊天历史任务列表输出参数
/// </summary>
public class LiveHistoryContactsOutput
{
/// <summary>
/// 主键Id
/// </summary>
public long Id { get; set; }
/// <summary>
/// 租户Id
/// </summary>
public long TenantId { get; set; }
/// <summary>
/// 名称
/// </summary>
public string displayName { get; set; }
/// <summary>
/// 头像
/// </summary>
public string avatar { get; set; }
/// <summary>
/// 类型
/// </summary>
public string type { get; set; }
/// <summary>
/// 排序
/// </summary>
public string index { get; set; }
/// <summary>
/// 消息条数
/// </summary>
public string unread { get; set; }
/// <summary>
/// 最后时间
/// </summary>
public DateTime lastSendTime { get; set; }
/// <summary>
/// 最后消息
/// </summary>
public string lastContent { get; set; }
}
}

@ -0,0 +1,14 @@
using GDZZ.Core;
using Microsoft.AspNetCore.Mvc;
using System.Threading.Tasks;
using GDZZ.Application.Entity;
using System.Collections.Generic;
namespace GDZZ.Application
{
public interface ILiveHistoryContactsService
{
Task<List<LiveHistoryLists>> List();
}
}

@ -0,0 +1,115 @@
using GDZZ.Core;
using Furion.DependencyInjection;
using Furion.DynamicApiController;
using Mapster;
using Microsoft.AspNetCore.Mvc;
using SqlSugar;
using System.Linq;
using System.Threading.Tasks;
using GDZZ.Application.Entity;
using System.Collections.Generic;
using K4os.Hash.xxHash;
using GDZZ.Core.Entity;
namespace GDZZ.Application
{
/// <summary>
/// 聊天服务
/// </summary>
[ApiDescriptionSettings("Application", Name = "LiveHistoryContacts", Order = 1)]
public class LiveHistoryContactsService : ILiveHistoryContactsService, IDynamicApiController, ITransient
{
private readonly SqlSugarRepository<LiveHistoryContacts> _rep;
private readonly SqlSugarRepository<LiveMessage> liveMessageRep;
private readonly SqlSugarRepository<LiveUserFriend> liveUserFriend; //好友表仓储
private readonly SqlSugarRepository<SysUser> _sysUserRep; // 用户表仓储
public LiveHistoryContactsService(SqlSugarRepository<LiveHistoryContacts> rep,
SqlSugarRepository<LiveUserFriend> liveUserFriend,
SqlSugarRepository<LiveMessage> liveMessageRep)
{
_rep = rep;
this.liveUserFriend = liveUserFriend;
this.liveMessageRep = liveMessageRep;
}
/// <summary>
/// 新增联系人
/// </summary>
/// <returns></returns>
[HttpPost("/LiveHistoryContacts/AddLive")]
public async Task AddLive(AddLiveHistoryContactsInput input)
{
var entity = input.Adapt<LiveHistoryContacts>();
await _rep.InsertAsync(entity);
}
/// <summary>
/// 获取联系人
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
[HttpGet("/LiveHistoryContacts/list")]
public async Task<List<LiveHistoryLists>> List()
{
List<LiveHistoryLists> historyLists= new List<LiveHistoryLists>();
//获取好友列表
var friends = await this.liveUserFriend.Where(x => x.CreatedUserId == UserManager.UserId).ToListAsync();
foreach (var item in friends)
{
var friend = await this._sysUserRep.SingleAsync(x => x.Id == item.FriendID);
if (friend == null)
continue;
historyLists.Add(new LiveHistoryLists()
{
Avatar = friend.Avatar,
DisplayName = friend.NickName,
Id = item.FriendID,
Index = friend.Name.Substring(0, 1),
//rm -rf mk dir ls install cd home
}) ;
}
return historyLists;
}
#region 聊天详情
/// <summary>
/// 获取聊天信息列表
/// </summary>
/// <returns></returns>
[HttpGet("/LiveHistoryContacts/GetMessageLists")]
public async Task<List<LiveMessageList>> GetMessageLists()
{
var res = await this.liveMessageRep.Where(x => x.CreatedUserId == UserManager.UserId || x.OtherUserID == UserManager.UserId).ToListAsync();
return res.Adapt<List<LiveMessageList>>();
}
/// <summary>
/// 增加聊天历史任务列表
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
[HttpPost("/LiveHistoryContacts/addMessage")]
public async Task AddMessage(AddLiveMessageInput input)
{
var entity = input.Adapt<LiveMessage>();
var history = await this._rep.Where(x => (x.CreatedUserId == input.OtherUserID && x.UserID == UserManager.UserId) || (x.UserID == input.OtherUserID && x.CreatedUserId == UserManager.UserId)).SingleAsync();
await this.liveMessageRep.InsertAsync(entity);
}
#endregion
}
}

@ -7063,12 +7063,12 @@
<param name="userIds"></param>
<returns></returns>
</member>
<member name="M:GDZZ.Core.Service.SysOnlineUserService.SendMessage(System.String,System.String)">
<member name="M:GDZZ.Core.Service.SysOnlineUserService.PushMessages(System.Collections.Generic.List{System.Int64},System.String)">
<summary>
发送消息
</summary>
<param name="user"></param>
<param name="message"></param>
<param name="notice"></param>
<param name="userIds"></param>
<returns></returns>
</member>
<member name="T:GDZZ.Core.Service.OrgInput">

@ -2,6 +2,7 @@ using Furion.DataEncryption;
using GDZZ.Core.Entity;
using GDZZ.Core.Service;
using Microsoft.AspNetCore.SignalR;
using Furion.InstantMessaging;
using System;
using System.Linq;
using System.Threading.Tasks;
@ -11,6 +12,7 @@ namespace GDZZ.Core;
/// <summary>
/// 聊天集线器
/// </summary>
//[MapHub("/hubs/chathub")]
public class ChatHub : Hub<IChatClient>
{
private readonly ISysCacheService _cache;
@ -66,11 +68,6 @@ public class ChatHub : Hub<IChatClient>
}
public async Task SendMessage(string user, string message)
{
//await Clients.All.SendAsync("ReceiveMessage", user, message);
}
}

@ -83,7 +83,6 @@ public class SysEmpService : ISysEmpService, ITransient
{
_sysEmpRep.CurrentBeginTran();
var emppos = await this.sysEmpPosRep.FirstOrDefaultAsync(x => x.SysEmpId == long.Parse(sysEmpParam.Id));
await this.sysEmpPosRep.DeleteAsync(x =>x.SysEmpId == long.Parse(sysEmpParam.Id));
// 先删除员工信息

@ -277,10 +277,13 @@ public class SysMenuService : ISysMenuService, IDynamicApiController, ITransient
try
{
_sysMenuRep.CurrentBeginTran();
await _sysMenuRep.DeleteAsync(u => childIdList.Contains(u.Id));
// 级联删除该菜单及子菜单对应的角色-菜单表信息
await _sysRoleMenuService.DeleteRoleMenuListByMenuIdList(childIdList);
await _sysMenuRep.DeleteAsync(u => childIdList.Contains(u.Id));
// 清除缓存
await _sysCacheService.DelByPatternAsync(CommonConst.CACHE_KEY_MENU);
await _sysCacheService.DelByPatternAsync(CommonConst.CACHE_KEY_ALLPERMISSION);

@ -75,17 +75,30 @@ public class SysOnlineUserService : ISysOnlineUserService, IDynamicApiController
}
/// <summary>
/// 发送消息
/// </summary>
/// <param name="user"></param>
/// <param name="message"></param>
/// <param name="notice"></param>
/// <param name="userIds"></param>
/// <returns></returns>
public async Task SendMessage(string user, string message)
[NonAction]
public async Task PushMessages(List<long> userIds,string message)
{
var userList = _sysOnlineUerRep.Where(m => userIds.Contains(m.UserId)).ToList();
if (userList.Any())
{
//await _chatHubContext.Clients.All.SendAsync("ReceiveMessage", user, message);
foreach (var item in userList)
{
await _chatHubContext.Clients.Client(item.ConnectionId).SendMessage("", item.Name, message);
}
}
}

@ -240,6 +240,7 @@ public static class SqlSugarSetup
IsAutoCloseConnection = true,
ConfigId = item.DbNumber,
InitKeyType = InitKeyType.Attribute,
MoreSettings = new ConnMoreSettings()
{
IsAutoRemoveDataCache = true//自动清理缓存

@ -52,7 +52,7 @@
},
"Cache": {
"CacheType": "MemoryCache", // RedisCache
"RedisConnectionString": "127.0.0.1:6379,password=,defaultDatabase=2"
"RedisConnectionString": "106.55.234.178:6379,password=zongzhi@2022,defaultDatabase=2"
},
"SnowId": {
"WorkerId": "1" // 0~63,1

Binary file not shown.

After

Width:  |  Height:  |  Size: 88 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 66 KiB

Loading…
Cancel
Save