diff --git a/src/0-core/HuanMeng.MiaoYu.Code/Chat/ChatBLL.cs b/src/0-core/HuanMeng.MiaoYu.Code/Chat/ChatBLL.cs
index fdd6984..26e20fe 100644
--- a/src/0-core/HuanMeng.MiaoYu.Code/Chat/ChatBLL.cs
+++ b/src/0-core/HuanMeng.MiaoYu.Code/Chat/ChatBLL.cs
@@ -2,7 +2,6 @@ using HuanMeng.DotNetCore.Base;
using HuanMeng.MiaoYu.Code.Cache;
using HuanMeng.MiaoYu.Model.DbSqlServer.Db_MiaoYu;
using HuanMeng.MiaoYu.Model.Dto.Chat;
-
using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore;
@@ -54,19 +53,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;
}
@@ -77,12 +74,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 97156f7..2929ac8 100644
--- a/src/0-core/HuanMeng.MiaoYu.Model/Dto/Chat/CharacterInfoDto.cs
+++ b/src/0-core/HuanMeng.MiaoYu.Model/Dto/Chat/CharacterInfoDto.cs
@@ -85,6 +85,14 @@ namespace HuanMeng.MiaoYu.Model.Dto.Chat
//public int RemainingChatCount { get; set; }
}
+ ///
+ /// 人物角色标签
+ ///
+ //public class LabelDto
+ //{
+ // public int LabelId { get; set; }
+ // public string LabelName { get; set; }
+ //}
///
/// 聊天列表信息
@@ -136,4 +144,44 @@ namespace HuanMeng.MiaoYu.Model.Dto.Chat
///
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..60f33cd
--- /dev/null
+++ b/src/0-core/HuanMeng.MiaoYu.Model/Dto/Find/RecommendDto.cs
@@ -0,0 +1,74 @@
+//using HuanMeng.MiaoYu.Model.Dto.Home;
+using HuanMeng.MiaoYu.Model.Dto.Label;
+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 39ca6e4..2e00dc8 100644
--- a/src/2-api/HuanMeng.MiaoYu.WebApi/Controllers/ChatController.cs
+++ b/src/2-api/HuanMeng.MiaoYu.WebApi/Controllers/ChatController.cs
@@ -57,6 +57,8 @@ namespace HuanMeng.MiaoYu.WebApi.Controllers
var obj = await characterBLL.GetCharacterInfo(requestCharacterInfo);
return obj;
+ //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}]");
+ //return new BaseResponse>(ResonseCode.Success, "", obj);
}
///