using HuanMeng.DotNetCore.Base; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace HuanMeng.MiaoYu.Code.Chat { /// /// 聊天类 /// public class ChatBLL : MiaoYuBase { public ChatBLL(IServiceProvider serviceProvider) : base(serviceProvider) { } /// /// 删除聊天记录 /// /// 聊天id /// /// public async Task DelChatByIds(List id,int characterId) { var chatsToDelete = Dao.daoDbMiaoYu.context.T_Chat.Where(t => id.Contains(t.Id)).ToList(); if (chatsToDelete.Count <= 0) { throw new Exception(""); } var chatList = chatsToDelete.Where(t => t.UserId == _UserId && t.CharacterId == characterId && t.IsDel == false).ToList(); Dao.daoDbMiaoYu.context.T_Chat.RemoveRange(chatList); Dao.daoDbMiaoYu.context.SaveChanges(); return true; } } }