删除聊天记录
This commit is contained in:
parent
bdcf89bc35
commit
b548c6e73f
|
|
@ -32,19 +32,17 @@ namespace HuanMeng.MiaoYu.Code.Chat
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public async Task<bool> DelChatByIds(List<int> id, int characterId)
|
public async Task<bool> DelChatByIds(List<int> id, int characterId)
|
||||||
{
|
{
|
||||||
//var charactersList = MiaoYuCache.CharactersList;
|
var chatsToDelete = await Dao.daoDbMiaoYu.context.T_Chat.Where(t => id.Contains(t.Id)).ToListAsync();
|
||||||
//List<T_Character> list = _characterCache.GetCharacterFromCache(characterId);
|
if (chatsToDelete.Count <= 0)
|
||||||
//var chatsToDelete = await Dao.daoDbMiaoYu.context.T_Chat.Where(t => id.Contains(t.Id)).ToListAsync();
|
{
|
||||||
//if (chatsToDelete.Count <= 0)
|
throw new Exception("删除失败");
|
||||||
//{
|
}
|
||||||
// throw new Exception("");
|
var chatList = chatsToDelete.Where(t => t.UserId == _UserId && t.CharacterId == characterId && (t.Type == (int)ChatType.正常 || t.Type == (int)ChatType.重新生成)).ToList();
|
||||||
//}
|
if (chatList.Count > 0)
|
||||||
//var chatList = chatsToDelete.Where(t => t.UserId == _UserId && t.CharacterId == characterId && t.Type == 0).ToList();
|
{
|
||||||
//if (chatList.Count > 0)
|
chatList.ForEach(t => t.Type = 2);
|
||||||
//{
|
}
|
||||||
// chatList.ForEach(t => t.Type = 2);
|
Dao.daoDbMiaoYu.context.SaveChanges();
|
||||||
//}
|
|
||||||
//Dao.daoDbMiaoYu.context.SaveChanges();
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -55,12 +53,12 @@ namespace HuanMeng.MiaoYu.Code.Chat
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public async Task<bool> DelChat(int characterId)
|
public async Task<bool> DelChat(int characterId)
|
||||||
{
|
{
|
||||||
//var tempList = await Dao.daoDbMiaoYu.context.T_Chat.Where(t => t.UserId == _UserId && t.CharacterId == characterId && t.IsDel == false).ToListAsync();
|
var tempList = await Dao.daoDbMiaoYu.context.T_User_Char.Where(t => t.UserId == _UserId && t.CharacterId == characterId && t.IsDelete == false).FirstOrDefaultAsync();
|
||||||
//if (tempList.Count > 0)
|
if (tempList != null)
|
||||||
//{
|
{
|
||||||
// tempList.ForEach(t => t.IsDel = true);
|
tempList.IsDelete = true;
|
||||||
//}
|
}
|
||||||
//Dao.daoDbMiaoYu.context.SaveChanges();
|
Dao.daoDbMiaoYu.context.SaveChanges();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -76,8 +76,8 @@ namespace HuanMeng.MiaoYu.Model.Dto.Home
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class LabelDto
|
public class LabelDto
|
||||||
{
|
{
|
||||||
public int Id { get; set; }
|
public int LabelId { get; set; }
|
||||||
public string Name { get; set; }
|
public string LabelName { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
@ -130,4 +130,44 @@ namespace HuanMeng.MiaoYu.Model.Dto.Home
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public int CharacterId { get; set; }
|
public int CharacterId { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 聊天表信息状态
|
||||||
|
/// </summary>
|
||||||
|
public enum ChatType
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 正常
|
||||||
|
/// </summary>
|
||||||
|
正常 = 0,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 重新生成
|
||||||
|
/// </summary>
|
||||||
|
重新生成 = 1,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 删除
|
||||||
|
/// </summary>
|
||||||
|
删除 = 2
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 角色分类
|
||||||
|
/// </summary>
|
||||||
|
public enum Role
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 用户
|
||||||
|
/// </summary>
|
||||||
|
user,
|
||||||
|
/// <summary>
|
||||||
|
/// AI
|
||||||
|
/// </summary>
|
||||||
|
assistant,
|
||||||
|
/// <summary>
|
||||||
|
/// 提示
|
||||||
|
/// </summary>
|
||||||
|
tips
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
73
src/0-core/HuanMeng.MiaoYu.Model/Dto/Find/RecommendDto.cs
Normal file
73
src/0-core/HuanMeng.MiaoYu.Model/Dto/Find/RecommendDto.cs
Normal file
|
|
@ -0,0 +1,73 @@
|
||||||
|
using HuanMeng.MiaoYu.Model.Dto.Home;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace HuanMeng.MiaoYu.Model.Dto.Find
|
||||||
|
{
|
||||||
|
public class RecommendDto<T> where T : class
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 热门推荐、热门小说角色、Banner
|
||||||
|
/// </summary>
|
||||||
|
public string Title { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// tuijian xiaoshuo Banner
|
||||||
|
/// </summary>
|
||||||
|
public string Type { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
public List<T> Data { get; set; }
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
public class DataListBaseDto
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 图片地址
|
||||||
|
/// </summary>
|
||||||
|
public string ImageUrl { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 跳角色、跳页面、跳商城
|
||||||
|
/// </summary>
|
||||||
|
public string ActionType { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 行为id
|
||||||
|
/// </summary>
|
||||||
|
public int ActionId { get; set; }
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
public class DataListDto : DataListBaseDto
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 角色名称
|
||||||
|
/// </summary>
|
||||||
|
public string Name { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 人物简介
|
||||||
|
/// </summary>
|
||||||
|
public string Biography { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 人物性别
|
||||||
|
/// </summary>
|
||||||
|
public int Gender { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 人物标签
|
||||||
|
/// </summary>
|
||||||
|
public List<LabelDto> Label { get; set; }
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -37,7 +37,7 @@ namespace HuanMeng.MiaoYu.WebApi.Controllers
|
||||||
public async Task<BaseResponse<List<CharacterInfoDto>>> GetCharacterInfo()
|
public async Task<BaseResponse<List<CharacterInfoDto>>> GetCharacterInfo()
|
||||||
{
|
{
|
||||||
|
|
||||||
var obj = JsonConvert.DeserializeObject<List<CharacterInfoDto>>("[{\"Icon\":\"\",\"Intimacy\":10,\"CharacterId\":2,\"CharacterName\":\"许荷姻\",\"Gender\":1,\"LookCount\":2,\"BgUrl\":\"\",\"Biography\":\"你那商业联姻得来的妻子,原本的天才女孩,聪明伶俐,生的漂亮、端庄,不知贵圈多少人梦寐以求的存在。\",\"Prologue\":\"坐在轮椅上,眼神平静的看着你,语气也同样平静)你回来了。饭菜在桌上,我刚刚热了。(说到这,又垂下眸子道)我还做了碗醒酒汤,记得喝\",\"Label\":[{\"Id\":1,\"Name\":\"美女\"},{\"Id\":2,\"Name\":\"二次元\"}],\"RemainingChatCount\":1}]");
|
var obj = JsonConvert.DeserializeObject<List<CharacterInfoDto>>("[{\"Icon\":\"\",\"Intimacy\":10,\"CharacterId\":2,\"CharacterName\":\"许荷姻\",\"Gender\":1,\"LookCount\":2,\"BgUrl\":\"\",\"Biography\":\"你那商业联姻得来的妻子,原本的天才女孩,聪明伶俐,生的漂亮、端庄,不知贵圈多少人梦寐以求的存在。\",\"Prologue\":\"坐在轮椅上,眼神平静的看着你,语气也同样平静)你回来了。饭菜在桌上,我刚刚热了。(说到这,又垂下眸子道)我还做了碗醒酒汤,记得喝\",\"Label\":[{\"LabelId\":1,\"LabelName\":\"美女\"},{\"LabelId\":2,\"LabelName\":\"二次元\"}],\"RemainingChatCount\":1}]");
|
||||||
return new BaseResponse<List<CharacterInfoDto>>(ResonseCode.Success, "", obj);
|
return new BaseResponse<List<CharacterInfoDto>>(ResonseCode.Success, "", obj);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user