提交代码
This commit is contained in:
parent
fba8540c15
commit
7c0d61c43c
|
|
@ -54,5 +54,27 @@ namespace HuanMeng.DotNetCore.MultiTenant
|
|||
{
|
||||
this.TenantInfo = tenantInfo;
|
||||
}
|
||||
|
||||
public override int SaveChanges()
|
||||
{
|
||||
if (TenantInfo?.TenantId != null)
|
||||
{
|
||||
var entries = ChangeTracker.Entries()
|
||||
.Where(e => e.Entity is IMultiTenantEntity &&
|
||||
(e.State == EntityState.Added || e.State == EntityState.Modified))
|
||||
.Select(e => e.Entity as IMultiTenantEntity)
|
||||
.ToList();
|
||||
|
||||
foreach (var entity in entries)
|
||||
{
|
||||
if (entity?.TenantId == null)
|
||||
{
|
||||
entity.TenantId = TenantInfo.TenantId;
|
||||
}
|
||||
}
|
||||
}
|
||||
return base.SaveChanges();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -278,4 +278,31 @@ namespace HuanMeng.MiaoYu.Code.Base
|
|||
}
|
||||
#endregion
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 默认控制器类,日志实现
|
||||
/// </summary>
|
||||
/// <typeparam name="T"></typeparam>
|
||||
public class MiaoYuBase<T> : MiaoYuBase where T : class
|
||||
{
|
||||
public MiaoYuBase(IServiceProvider serviceProvider) : base(serviceProvider)
|
||||
{
|
||||
|
||||
}
|
||||
#region 日志
|
||||
private Logger<T>? _logger;
|
||||
public Logger<T> _Logger
|
||||
{
|
||||
|
||||
get
|
||||
{
|
||||
if (_logger == null)
|
||||
{
|
||||
_logger = _serviceProvider.GetRequiredService<Logger<T>>();
|
||||
}
|
||||
return _logger;
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ namespace HuanMeng.MiaoYu.Code.Cache
|
|||
/// <summary>
|
||||
/// 角色数据表
|
||||
/// </summary>
|
||||
public List<T_Character> CharactersList
|
||||
public List<T_Character> CharacterInfoList
|
||||
{
|
||||
get
|
||||
{
|
||||
|
|
@ -81,7 +81,7 @@ namespace HuanMeng.MiaoYu.Code.Cache
|
|||
{
|
||||
if (CharacterCache == null)
|
||||
{
|
||||
|
||||
|
||||
CharacterCache = new CharacterEntityCache(dao, mapper);
|
||||
}
|
||||
return CharacterCache.DataList ?? new List<CharacterCache>();
|
||||
|
|
@ -115,5 +115,60 @@ namespace HuanMeng.MiaoYu.Code.Cache
|
|||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
#region 角色类型缓存表
|
||||
/// <summary>
|
||||
///角色类型缓存表
|
||||
/// </summary>
|
||||
private static object CharacterTypeLock = new object();
|
||||
|
||||
/// <summary>
|
||||
/// 角色类型缓存表
|
||||
/// </summary>
|
||||
public MiaoYuDataEntityCache<T_Character_Type>? CharacterTypeCache { get; set; }
|
||||
/// <summary>
|
||||
/// 角色类型
|
||||
/// </summary>
|
||||
public List<T_Character_Type> CharacterTypeList
|
||||
{
|
||||
get
|
||||
{
|
||||
if (CharacterTypeCache == null)
|
||||
{
|
||||
CharacterTypeCache = new MiaoYuDataEntityCache<T_Character_Type>(dao, CharacterTypeLock);
|
||||
}
|
||||
return CharacterTypeCache.DataList ?? new List<T_Character_Type>();
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region 角色类型缓存表
|
||||
/// <summary>
|
||||
/// 类型中的角色缓存表
|
||||
/// </summary>
|
||||
private static object CharacterTypeIntimacyLock = new object();
|
||||
|
||||
/// <summary>
|
||||
/// 类型中的角色缓存表
|
||||
/// </summary>
|
||||
public MiaoYuDataEntityCache<T_Character_Type_Intimacy>? CharacterTypeIntimacyCache { get; set; }
|
||||
/// <summary>
|
||||
/// 类型中的角色
|
||||
/// </summary>
|
||||
public List<T_Character_Type_Intimacy> CharacterTypeIntimacyList
|
||||
{
|
||||
get
|
||||
{
|
||||
if (CharacterTypeIntimacyCache == null)
|
||||
{
|
||||
CharacterTypeIntimacyCache = new MiaoYuDataEntityCache<T_Character_Type_Intimacy>(dao, CharacterTypeIntimacyLock);
|
||||
}
|
||||
return CharacterTypeIntimacyCache.DataList ?? new List<T_Character_Type_Intimacy>();
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -52,7 +52,6 @@ namespace HuanMeng.MiaoYu.Code.Cache.Special
|
|||
var labels = labelCache.DataList;
|
||||
var labelRelationCache = new MiaoYuDataEntityCache<T_Character_Label_Relation>(_dao, T_Character_Label_RelationLock);
|
||||
var labelRelations = labelRelationCache.DataList;
|
||||
|
||||
foreach (var characterCache in characterCaches)
|
||||
{
|
||||
var modelConfig = modelConfigs.FirstOrDefault(it => it.Id == characterCache.ModelConfigId);
|
||||
|
|
|
|||
61
src/0-core/HuanMeng.MiaoYu.Code/Category/CategoryBLL.cs
Normal file
61
src/0-core/HuanMeng.MiaoYu.Code/Category/CategoryBLL.cs
Normal file
|
|
@ -0,0 +1,61 @@
|
|||
using HuanMeng.DotNetCore.Base;
|
||||
using HuanMeng.MiaoYu.Model.Dto.Category;
|
||||
using HuanMeng.MiaoYu.Model.Dto.Character;
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace HuanMeng.MiaoYu.Code.Category
|
||||
{
|
||||
/// <summary>
|
||||
/// 类别
|
||||
/// </summary>
|
||||
public class CategoryBLL : MiaoYuBase
|
||||
{
|
||||
public CategoryBLL(IServiceProvider serviceProvider) : base(serviceProvider)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取类型集合
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public BaseResponse<List<CategoryInfo>> GetCategoryList()
|
||||
{
|
||||
var list = MiaoYuCache.CharacterTypeList.Where(it => !it.IsNotCategoryShow).OrderBy(it => it.OrderBy).ToList();
|
||||
var rList = Mapper.Map<List<CategoryInfo>>(list);
|
||||
rList.Insert(0, new CategoryInfo
|
||||
{
|
||||
Id = 0,
|
||||
Name = "发现"
|
||||
});
|
||||
//Dao.daoDbMiaoYu.context.T_Character_Type.Where()
|
||||
return new BaseResponse<List<CategoryInfo>>(ResonseCode.Success, "", rList) { };
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 获取类型中的角色信息
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public BaseResponse<List<CharacterSummary>> GetCategoryInfoList(int CategoryId)
|
||||
{
|
||||
var list = MiaoYuCache.CharacterTypeIntimacyList.Where(it => it.TypeId == CategoryId).OrderBy(it => it.OrderBy).ToList();
|
||||
var list2 = MiaoYuCache.CharacterList;
|
||||
var rList = new List<CharacterSummary>();
|
||||
list.ForEach(it =>
|
||||
{
|
||||
var model = list2.FirstOrDefault(item => item.Id == it.CharacterId);
|
||||
if (model != null)
|
||||
{
|
||||
var su = Mapper.Map<CharacterSummary>(model);
|
||||
rList.Add(su);
|
||||
}
|
||||
});
|
||||
return new BaseResponse<List<CharacterSummary>>(ResonseCode.Success, "", rList) { };
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -237,8 +237,6 @@ namespace HuanMeng.MiaoYu.Code.Chat
|
|||
var response = await chat.MessagesAsync(baseChatParams);
|
||||
var claudeChatResponse = response as ClaudeChatResponse;
|
||||
#endregion
|
||||
|
||||
|
||||
T_Chat t_Chat = new T_Chat
|
||||
{
|
||||
CharacterId = charact.Id,
|
||||
|
|
@ -261,6 +259,7 @@ namespace HuanMeng.MiaoYu.Code.Chat
|
|||
};
|
||||
Dao.daoDbMiaoYu.context.Add(t_Chat1);
|
||||
Dao.daoDbMiaoYu.context.Add(t_Chat);
|
||||
userChatSession.UpdateAt = DateTime.Now;
|
||||
await Dao.daoDbMiaoYu.context.SaveChangesAsync();
|
||||
//claudeChatResponse.
|
||||
ChatMessageDto chatMessageDto = new ChatMessageDto()
|
||||
|
|
@ -278,6 +277,7 @@ namespace HuanMeng.MiaoYu.Code.Chat
|
|||
chatListDto.RemainingChatCount = 999;
|
||||
return new BaseResponse<ChatMessageDataDto>(ResonseCode.Success, "", chatListDto);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 删除聊天记录
|
||||
/// </summary>
|
||||
|
|
@ -315,5 +315,29 @@ namespace HuanMeng.MiaoYu.Code.Chat
|
|||
Dao.daoDbMiaoYu.context.SaveChanges();
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取消息聊天记录列表
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public async Task<BaseResponse<List<ChatHistoryInfo>>> GetChatHistoryList()
|
||||
{
|
||||
var userChatSessions = await Dao.daoDbMiaoYu.context.T_User_Chat.Where(it => it.UserId == _UserId && !it.IsDelete).ToListAsync();
|
||||
List<ChatHistoryInfo> chatHistoryInfos = new List<ChatHistoryInfo>();
|
||||
var charactersIds = MiaoYuCache.CharacterList.ToList();
|
||||
userChatSessions.ForEach(it =>
|
||||
{
|
||||
var model = charactersIds.FirstOrDefault(item => item.Id == it.CharacterId);
|
||||
if (model != null)
|
||||
{
|
||||
var info = Mapper.Map<ChatHistoryInfo>(model);
|
||||
info.LastContactTime = it.UpdateAt;
|
||||
chatHistoryInfos.Add(info);
|
||||
}
|
||||
|
||||
});
|
||||
chatHistoryInfos = chatHistoryInfos.OrderByDescending(it => it.LastContactTime).ToList();
|
||||
return new BaseResponse<List<ChatHistoryInfo>>(ResonseCode.Success, "", chatHistoryInfos) { };
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -58,6 +58,11 @@ public partial class MiaoYuContext : MultiTenantDbContext//DbContext
|
|||
/// </summary>
|
||||
public virtual DbSet<T_Character_Type> T_Character_Type { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 角色和角色类型关联表
|
||||
/// </summary>
|
||||
public virtual DbSet<T_Character_Type_Intimacy> T_Character_Type_Intimacy { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 存储用户和角色之间的亲密值
|
||||
/// </summary>
|
||||
|
|
@ -203,9 +208,11 @@ public partial class MiaoYuContext : MultiTenantDbContext//DbContext
|
|||
entity.Property(e => e.CreateTime)
|
||||
.HasComment("创建时间")
|
||||
.HasColumnType("datetime");
|
||||
entity.Property(e => e.IsNotCategoryShow).HasComment("分类页不显示");
|
||||
entity.Property(e => e.Name)
|
||||
.HasMaxLength(255)
|
||||
.HasComment("类型名称");
|
||||
entity.Property(e => e.OrderBy).HasComment("序号");
|
||||
entity.Property(e => e.TenantId).HasComment("租户id");
|
||||
entity.Property(e => e.UpdateTime)
|
||||
.HasComment("更新时间")
|
||||
|
|
@ -217,6 +224,30 @@ public partial class MiaoYuContext : MultiTenantDbContext//DbContext
|
|||
}
|
||||
});
|
||||
|
||||
modelBuilder.Entity<T_Character_Type_Intimacy>(entity =>
|
||||
{
|
||||
entity.HasKey(e => e.Id).HasName("PK__T_Charac__3214EC077745C163");
|
||||
|
||||
entity.ToTable(tb => tb.HasComment("角色和角色类型关联表"));
|
||||
|
||||
entity.Property(e => e.Id).HasComment("主键");
|
||||
entity.Property(e => e.CharacterId).HasComment("角色Id");
|
||||
entity.Property(e => e.CreateTime)
|
||||
.HasComment("创建时间")
|
||||
.HasColumnType("datetime");
|
||||
entity.Property(e => e.OrderBy).HasComment("类别表排序");
|
||||
entity.Property(e => e.TenantId).HasComment("租户");
|
||||
entity.Property(e => e.TypeId).HasComment("列表Id");
|
||||
entity.Property(e => e.UpdateTIme)
|
||||
.HasComment("修改时间")
|
||||
.HasColumnType("datetime");
|
||||
//添加全局筛选器
|
||||
if (this.TenantInfo != null)
|
||||
{
|
||||
entity.HasQueryFilter(it => it.TenantId == this.TenantInfo.TenantId);
|
||||
}
|
||||
});
|
||||
|
||||
modelBuilder.Entity<T_Character_User_Intimacy>(entity =>
|
||||
{
|
||||
entity.HasKey(e => e.Id).HasName("PK__T_Charac__3214EC079BEEBDEA");
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
using System;
|
||||
using System;
|
||||
|
||||
namespace HuanMeng.MiaoYu.Model.DbSqlServer.Db_MiaoYu;
|
||||
|
||||
|
|
|
|||
|
|
@ -27,4 +27,14 @@ public partial class T_Character_Type: MultiTenantEntity
|
|||
/// </summary>
|
||||
public DateTime UpdateTime { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 分类页不显示
|
||||
/// </summary>
|
||||
public bool IsNotCategoryShow { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 序号
|
||||
/// </summary>
|
||||
public int OrderBy { get; set; }
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,40 @@
|
|||
using System;
|
||||
|
||||
namespace HuanMeng.MiaoYu.Model.DbSqlServer.Db_MiaoYu;
|
||||
|
||||
/// <summary>
|
||||
/// 角色和角色类型关联表
|
||||
/// </summary>
|
||||
public partial class T_Character_Type_Intimacy: MultiTenantEntity
|
||||
{
|
||||
/// <summary>
|
||||
/// 主键
|
||||
/// </summary>
|
||||
public int Id { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 列表Id
|
||||
/// </summary>
|
||||
public int TypeId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 角色Id
|
||||
/// </summary>
|
||||
public int CharacterId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 修改时间
|
||||
/// </summary>
|
||||
public DateTime UpdateTIme { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 创建时间
|
||||
/// </summary>
|
||||
public DateTime CreateTime { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 类别表排序
|
||||
/// </summary>
|
||||
public int OrderBy { get; set; }
|
||||
}
|
||||
|
|
@ -0,0 +1,29 @@
|
|||
using AutoMapper;
|
||||
|
||||
using HuanMeng.MiaoYu.Model.DbSqlServer.Db_MiaoYu;
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace HuanMeng.MiaoYu.Model.Dto.Category
|
||||
{
|
||||
/// <summary>
|
||||
/// 分类
|
||||
/// </summary>
|
||||
[AutoMap(typeof(T_Character_Type))]
|
||||
public class CategoryInfo
|
||||
{
|
||||
/// <summary>
|
||||
/// 类型id
|
||||
/// </summary>
|
||||
public int Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 类型名称
|
||||
/// </summary>
|
||||
public string Name { get; set; }
|
||||
}
|
||||
}
|
||||
|
|
@ -12,7 +12,7 @@ using System.Threading.Tasks;
|
|||
namespace HuanMeng.MiaoYu.Model.Dto.Character
|
||||
{
|
||||
/// <summary>
|
||||
/// 模型
|
||||
/// 模型
|
||||
/// </summary>
|
||||
[AutoMap(typeof(T_Character))]
|
||||
public class CharacterCache : T_Character
|
||||
|
|
|
|||
|
|
@ -0,0 +1,52 @@
|
|||
using AutoMapper;
|
||||
|
||||
using HuanMeng.MiaoYu.Model.DbSqlServer.Db_MiaoYu;
|
||||
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.Character
|
||||
{
|
||||
[AutoMap(typeof(CharacterCache))]
|
||||
public class CharacterSummary
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// 人物id
|
||||
/// </summary>
|
||||
public int Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 人物名字
|
||||
/// </summary>
|
||||
public string? Name { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 人物简介
|
||||
/// </summary>
|
||||
public string? Biography { get; set; }
|
||||
/// <summary>
|
||||
/// 多少人聊天过
|
||||
/// </summary>
|
||||
public int LookCount { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 背景图片
|
||||
/// </summary>
|
||||
public string BgImage { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 用户头像url
|
||||
/// </summary>
|
||||
public string IconImage { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 标签
|
||||
/// </summary>
|
||||
public List<LabelDto> Label { get; set; }
|
||||
}
|
||||
}
|
||||
|
|
@ -17,7 +17,7 @@ namespace HuanMeng.MiaoYu.Model.Dto.Chat
|
|||
public List<CharacterInfoDto> CharacterInfos { get; set; }
|
||||
}
|
||||
/// <summary>
|
||||
/// 用户和人物信息
|
||||
/// 用户和人物信息
|
||||
/// </summary>
|
||||
[AutoMap(typeof(CharacterCache))]
|
||||
public class CharacterInfoDto
|
||||
|
|
|
|||
45
src/0-core/HuanMeng.MiaoYu.Model/Dto/Chat/ChatHistoryInfo.cs
Normal file
45
src/0-core/HuanMeng.MiaoYu.Model/Dto/Chat/ChatHistoryInfo.cs
Normal file
|
|
@ -0,0 +1,45 @@
|
|||
using AutoMapper;
|
||||
|
||||
using HuanMeng.MiaoYu.Model.Dto.Character;
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace HuanMeng.MiaoYu.Model.Dto.Chat
|
||||
{
|
||||
/// <summary>
|
||||
/// 聊天历史
|
||||
/// </summary>
|
||||
[AutoMap(typeof(CharacterCache))]
|
||||
public class ChatHistoryInfo
|
||||
{
|
||||
/// <summary>
|
||||
/// 人物id
|
||||
/// </summary>
|
||||
public int Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 人物名字
|
||||
/// </summary>
|
||||
public string? Name { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 人物简介
|
||||
/// </summary>
|
||||
public string? Biography { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 用户头像url
|
||||
/// </summary>
|
||||
public string IconImage { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 最后一次联系时间
|
||||
/// </summary>
|
||||
public DateTime? LastContactTime { get; set; }
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -19,7 +19,7 @@ using System.Text.RegularExpressions;
|
|||
namespace HuanMeng.MiaoYu.WebApi.Controllers
|
||||
{
|
||||
/// <summary>
|
||||
/// 账号控制器
|
||||
/// 账号控制器
|
||||
/// </summary>
|
||||
[Route("api/[controller]/[action]")]
|
||||
[ApiController]
|
||||
|
|
|
|||
|
|
@ -0,0 +1,48 @@
|
|||
using HuanMeng.DotNetCore.Base;
|
||||
using HuanMeng.MiaoYu.Code.Cache;
|
||||
using HuanMeng.MiaoYu.Code.Category;
|
||||
using HuanMeng.MiaoYu.Model.Dto.Category;
|
||||
using HuanMeng.MiaoYu.Model.Dto.Character;
|
||||
using HuanMeng.MiaoYu.WebApi.Base;
|
||||
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
namespace HuanMeng.MiaoYu.WebApi.Controllers
|
||||
{
|
||||
/// <summary>
|
||||
/// 分类页面控制器
|
||||
/// </summary>
|
||||
[Route("api/[controller]/[action]")]
|
||||
[ApiController]
|
||||
public class CategoryController : MiaoYuControllerBase
|
||||
{
|
||||
public CategoryController(IServiceProvider _serviceProvider) : base(_serviceProvider)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取分类列表
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpGet]
|
||||
[AllowAnonymous]
|
||||
public BaseResponse<List<CategoryInfo>> GetCategoryList()
|
||||
{
|
||||
CategoryBLL categoryBLL = new CategoryBLL(ServiceProvider);
|
||||
return categoryBLL.GetCategoryList();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取类型中的角色信息
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpGet]
|
||||
[AllowAnonymous]
|
||||
public BaseResponse<List<CharacterSummary>> GetCategoryInfoList(int CategoryId)
|
||||
{
|
||||
CategoryBLL categoryBLL = new CategoryBLL(ServiceProvider);
|
||||
return categoryBLL.GetCategoryInfoList(CategoryId);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,4 +1,5 @@
|
|||
using HuanMeng.DotNetCore.Base;
|
||||
using HuanMeng.MiaoYu.Code.Cache;
|
||||
using HuanMeng.MiaoYu.Code.Character;
|
||||
using HuanMeng.MiaoYu.Code.Chat;
|
||||
using HuanMeng.MiaoYu.Model.Dto.Character;
|
||||
|
|
@ -70,7 +71,7 @@ namespace HuanMeng.MiaoYu.WebApi.Controllers
|
|||
[AllowAnonymous]
|
||||
public async Task<BaseResponse<List<ChatMessageDto>>> GetChatInfo(int characterId)
|
||||
{
|
||||
|
||||
|
||||
ChatBLL chatBLL = new ChatBLL(ServiceProvider);
|
||||
var list = await chatBLL.GetChatMessage(characterId);
|
||||
|
||||
|
|
@ -121,5 +122,17 @@ namespace HuanMeng.MiaoYu.WebApi.Controllers
|
|||
var obj = await _chatBLL.DelChat(delChatList.CharacterId);
|
||||
return new BaseResponse<bool>(ResonseCode.Success, "", obj);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 获取消息页面的聊天记录列表
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpGet]
|
||||
public async Task<BaseResponse<List<ChatHistoryInfo>>> GetChatHistoryList()
|
||||
{
|
||||
var obj = await _chatBLL.GetChatHistoryList();
|
||||
return obj;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -129,6 +129,8 @@ app.UseAuthorization();
|
|||
//使用跨域
|
||||
app.UseCors(_myAllowSpecificOrigins);
|
||||
app.MapControllers();
|
||||
|
||||
app.UseStaticFiles();//静态文件访问配置
|
||||
//数据库中间件
|
||||
app.UseMultiTenantMiaoYu();
|
||||
//异常中间件
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user