合并代码
This commit is contained in:
commit
6bbe8cd268
|
|
@ -2,7 +2,6 @@ using HuanMeng.DotNetCore.Base;
|
||||||
using HuanMeng.MiaoYu.Code.Cache;
|
using HuanMeng.MiaoYu.Code.Cache;
|
||||||
using HuanMeng.MiaoYu.Model.DbSqlServer.Db_MiaoYu;
|
using HuanMeng.MiaoYu.Model.DbSqlServer.Db_MiaoYu;
|
||||||
using HuanMeng.MiaoYu.Model.Dto.Chat;
|
using HuanMeng.MiaoYu.Model.Dto.Chat;
|
||||||
|
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
|
||||||
|
|
@ -54,19 +53,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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -77,12 +74,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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -85,6 +85,14 @@ namespace HuanMeng.MiaoYu.Model.Dto.Chat
|
||||||
//public int RemainingChatCount { get; set; }
|
//public int RemainingChatCount { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 人物角色标签
|
||||||
|
/// </summary>
|
||||||
|
//public class LabelDto
|
||||||
|
//{
|
||||||
|
// public int LabelId { get; set; }
|
||||||
|
// public string LabelName { get; set; }
|
||||||
|
//}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 聊天列表信息
|
/// 聊天列表信息
|
||||||
|
|
@ -136,4 +144,44 @@ namespace HuanMeng.MiaoYu.Model.Dto.Chat
|
||||||
/// </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
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
74
src/0-core/HuanMeng.MiaoYu.Model/Dto/Find/RecommendDto.cs
Normal file
74
src/0-core/HuanMeng.MiaoYu.Model/Dto/Find/RecommendDto.cs
Normal file
|
|
@ -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<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; }
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -57,6 +57,8 @@ namespace HuanMeng.MiaoYu.WebApi.Controllers
|
||||||
var obj = await characterBLL.GetCharacterInfo(requestCharacterInfo);
|
var obj = await characterBLL.GetCharacterInfo(requestCharacterInfo);
|
||||||
return obj;
|
return obj;
|
||||||
|
|
||||||
|
//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}]");
|
||||||
|
//return new BaseResponse<List<CharacterInfoDto>>(ResonseCode.Success, "", obj);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user