39 lines
1.2 KiB
C#
39 lines
1.2 KiB
C#
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
|
|
{
|
|
/// <summary>
|
|
/// 聊天类
|
|
/// </summary>
|
|
public class ChatBLL : MiaoYuBase
|
|
{
|
|
public ChatBLL(IServiceProvider serviceProvider) : base(serviceProvider)
|
|
{
|
|
|
|
}
|
|
/// <summary>
|
|
/// 删除聊天记录
|
|
/// </summary>
|
|
/// <param name="id">聊天id</param>
|
|
/// <param name="characterId"></param>
|
|
/// <returns></returns>
|
|
public async Task<bool> DelChatByIds(List<int> 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;
|
|
}
|
|
}
|
|
}
|