提交代码

This commit is contained in:
zpc 2024-07-15 15:00:49 +08:00
parent 609157ad0d
commit b0d5792843
3 changed files with 28 additions and 4 deletions

View File

@ -1,12 +1,13 @@
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;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;
@ -21,7 +22,28 @@ namespace HuanMeng.MiaoYu.Code.Chat
{
public ChatBLL(IServiceProvider serviceProvider) : base(serviceProvider)
{
}
public async Task<BaseResponse<List<ChatMessageDto>>> GetChatMessage(int characterId, long timeStamp)
{
if (_UserId == 0)
{
return new BaseResponse<List<ChatMessageDto>>(ResonseCode.Success, "", new List<ChatMessageDto>());
}
var userChatSession = Dao.daoDbMiaoYu.context.T_User_Chat.Where(it => it.CharacterId == characterId && it.UserId == _UserId && !it.IsDelete).FirstOrDefault();
if (userChatSession == null)
{
userChatSession = new T_User_Chat()
{
SessionId=Guid.NewGuid(),
CharacterId=characterId,
CreateAt=DateTime.Now,
IsDelete=false,
SessionName="现在",
};
}
//Dao.daoDbMiaoYu.context.T_Chat.Where(it=>it.CharacterId)
return null;
}
/// <summary>

View File

@ -86,7 +86,7 @@ public partial class MiaoYuContext : MultiTenantDbContext//DbContext
/// <summary>
///
/// </summary>
public virtual DbSet<T_User_Char> T_User_Char { get; set; }
public virtual DbSet<T_User_Chat> T_User_Chat { get; set; }
/// <summary>
/// 用户信息表
@ -393,8 +393,10 @@ public partial class MiaoYuContext : MultiTenantDbContext//DbContext
}
});
modelBuilder.Entity<T_User_Char>(entity =>
modelBuilder.Entity<T_User_Chat>(entity =>
{
entity.HasKey(e => e.Id).HasName("PK_T_User_Char");
entity.Property(e => e.CharacterId).HasComment("角色Id");
entity.Property(e => e.CreateAt)
.HasComment("创建时间")

View File

@ -2,7 +2,7 @@
namespace HuanMeng.MiaoYu.Model.DbSqlServer.Db_MiaoYu;
public partial class T_User_Char: MultiTenantEntity
public partial class T_User_Chat: MultiTenantEntity
{
public int Id { get; set; }