diff --git a/src/0-core/HuanMeng.MiaoYu.Code/Chat/ChatBLL.cs b/src/0-core/HuanMeng.MiaoYu.Code/Chat/ChatBLL.cs
index 90e3336..ecfc17a 100644
--- a/src/0-core/HuanMeng.MiaoYu.Code/Chat/ChatBLL.cs
+++ b/src/0-core/HuanMeng.MiaoYu.Code/Chat/ChatBLL.cs
@@ -32,19 +32,17 @@ namespace HuanMeng.MiaoYu.Code.Chat
///
public async Task DelChatByIds(List id, int characterId)
{
- //var charactersList = MiaoYuCache.CharactersList;
- //List list = _characterCache.GetCharacterFromCache(characterId);
- //var chatsToDelete = await Dao.daoDbMiaoYu.context.T_Chat.Where(t => id.Contains(t.Id)).ToListAsync();
- //if (chatsToDelete.Count <= 0)
- //{
- // throw new Exception("");
- //}
- //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);
- //}
- //Dao.daoDbMiaoYu.context.SaveChanges();
+ var chatsToDelete = await Dao.daoDbMiaoYu.context.T_Chat.Where(t => id.Contains(t.Id)).ToListAsync();
+ if (chatsToDelete.Count <= 0)
+ {
+ 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)
+ {
+ chatList.ForEach(t => t.Type = 2);
+ }
+ Dao.daoDbMiaoYu.context.SaveChanges();
return true;
}
@@ -55,12 +53,12 @@ namespace HuanMeng.MiaoYu.Code.Chat
///
public async Task DelChat(int characterId)
{
- //var tempList = await Dao.daoDbMiaoYu.context.T_Chat.Where(t => t.UserId == _UserId && t.CharacterId == characterId && t.IsDel == false).ToListAsync();
- //if (tempList.Count > 0)
- //{
- // tempList.ForEach(t => t.IsDel = true);
- //}
- //Dao.daoDbMiaoYu.context.SaveChanges();
+ var tempList = await Dao.daoDbMiaoYu.context.T_User_Char.Where(t => t.UserId == _UserId && t.CharacterId == characterId && t.IsDelete == false).FirstOrDefaultAsync();
+ if (tempList != null)
+ {
+ tempList.IsDelete = true;
+ }
+ Dao.daoDbMiaoYu.context.SaveChanges();
return true;
}
}
diff --git a/src/0-core/HuanMeng.MiaoYu.Model/Dto/Chat/CharacterInfoDto.cs b/src/0-core/HuanMeng.MiaoYu.Model/Dto/Chat/CharacterInfoDto.cs
index 824fecc..b125dd6 100644
--- a/src/0-core/HuanMeng.MiaoYu.Model/Dto/Chat/CharacterInfoDto.cs
+++ b/src/0-core/HuanMeng.MiaoYu.Model/Dto/Chat/CharacterInfoDto.cs
@@ -76,8 +76,8 @@ namespace HuanMeng.MiaoYu.Model.Dto.Home
///
public class LabelDto
{
- public int Id { get; set; }
- public string Name { get; set; }
+ public int LabelId { get; set; }
+ public string LabelName { get; set; }
}
///
@@ -130,4 +130,44 @@ namespace HuanMeng.MiaoYu.Model.Dto.Home
///
public int CharacterId { get; set; }
}
+
+ ///
+ /// 聊天表信息状态
+ ///
+ public enum ChatType
+ {
+ ///
+ /// 正常
+ ///
+ 正常 = 0,
+
+ ///
+ /// 重新生成
+ ///
+ 重新生成 = 1,
+
+ ///
+ /// 删除
+ ///
+ 删除 = 2
+ }
+
+ ///
+ /// 角色分类
+ ///
+ public enum Role
+ {
+ ///
+ /// 用户
+ ///
+ user,
+ ///
+ /// AI
+ ///
+ assistant,
+ ///
+ /// 提示
+ ///
+ tips
+ }
}
diff --git a/src/0-core/HuanMeng.MiaoYu.Model/Dto/Find/RecommendDto.cs b/src/0-core/HuanMeng.MiaoYu.Model/Dto/Find/RecommendDto.cs
new file mode 100644
index 0000000..d97030f
--- /dev/null
+++ b/src/0-core/HuanMeng.MiaoYu.Model/Dto/Find/RecommendDto.cs
@@ -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 where T : class
+ {
+ ///
+ /// 热门推荐、热门小说角色、Banner
+ ///
+ public string Title { get; set; }
+
+ ///
+ /// tuijian xiaoshuo Banner
+ ///
+ public string Type { get; set; }
+
+ ///
+ ///
+ ///
+ public List Data { get; set; }
+ }
+ ///
+ ///
+ ///
+ public class DataListBaseDto
+ {
+ ///
+ /// 图片地址
+ ///
+ public string ImageUrl { get; set; }
+
+ ///
+ /// 跳角色、跳页面、跳商城
+ ///
+ public string ActionType { get; set; }
+
+ ///
+ /// 行为id
+ ///
+ public int ActionId { get; set; }
+ }
+ ///
+ ///
+ ///
+ public class DataListDto : DataListBaseDto
+ {
+ ///
+ /// 角色名称
+ ///
+ public string Name { get; set; }
+
+ ///
+ /// 人物简介
+ ///
+ public string Biography { get; set; }
+
+ ///
+ /// 人物性别
+ ///
+ public int Gender { get; set; }
+
+ ///
+ /// 人物标签
+ ///
+ public List Label { get; set; }
+
+ }
+}
diff --git a/src/2-api/HuanMeng.MiaoYu.WebApi/Controllers/ChatController.cs b/src/2-api/HuanMeng.MiaoYu.WebApi/Controllers/ChatController.cs
index 8bf63da..0d00824 100644
--- a/src/2-api/HuanMeng.MiaoYu.WebApi/Controllers/ChatController.cs
+++ b/src/2-api/HuanMeng.MiaoYu.WebApi/Controllers/ChatController.cs
@@ -37,7 +37,7 @@ namespace HuanMeng.MiaoYu.WebApi.Controllers
public async Task>> GetCharacterInfo()
{
- var obj = JsonConvert.DeserializeObject>("[{\"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>("[{\"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>(ResonseCode.Success, "", obj);
}