diff --git a/src/CloudGaming/Api/CloudGaming.Api/Controllers/HomeController.cs b/src/CloudGaming/Api/CloudGaming.Api/Controllers/HomeController.cs new file mode 100644 index 0000000..c4d9b0a --- /dev/null +++ b/src/CloudGaming/Api/CloudGaming.Api/Controllers/HomeController.cs @@ -0,0 +1,27 @@ +using CloudGaming.Api.Base; +using CloudGaming.Code.Epg; +using CloudGaming.DtoModel.Epg; + +using Microsoft.AspNetCore.JsonPatch.Internal; +using Microsoft.AspNetCore.Mvc; + +namespace CloudGaming.Api.Controllers; + +public class HomeController : CloudGamingControllerBase +{ + public HomeController(IServiceProvider _serviceProvider) : base(_serviceProvider) + { + } + + /// + /// + /// + /// + [HttpGet] + public async Task> GetHomeInfo() + { + EpgBLL epgBLL = new EpgBLL(ServiceProvider); + return await epgBLL.GetHomeInfo(); + } + +} diff --git a/src/CloudGaming/Code/CloudGaming.Code/AppExtend/CloudGamingBase.cs b/src/CloudGaming/Code/CloudGaming.Code/AppExtend/CloudGamingBase.cs index 1e9ba96..7c2b7f1 100644 --- a/src/CloudGaming/Code/CloudGaming.Code/AppExtend/CloudGamingBase.cs +++ b/src/CloudGaming/Code/CloudGaming.Code/AppExtend/CloudGamingBase.cs @@ -1,6 +1,7 @@ using AutoMapper; using CloudGaming.Code.Cache; +using CloudGaming.Code.Config; using CloudGaming.Code.DataAccess; using HuanMeng.DotNetCore.JwtInfrastructure.Interface; @@ -187,6 +188,7 @@ namespace CloudGaming.Code.AppExtend } } #endregion + #region app配置 private AppRequestConfig appRequestInfo; /// @@ -203,6 +205,29 @@ namespace CloudGaming.Code.AppExtend return appRequestInfo; } } + + private bool? isChecking; + /// + /// 是否在审核模式中 + /// + public bool IsChecking + { + get + { + if (isChecking == null) + { + string key = $"App:Config:{AppRequestInfo.Platform}:{AppRequestInfo.Channel}:{AppRequestInfo.Version}"; + isChecking = RedisCache.StringGet(key); + if (isChecking == null) + { + isChecking = new AppConfigBLL(this._serviceProvider).GetAppIsChecking(); + RedisCache.StringSet(key, isChecking, new TimeSpan(1, 0, 0)); + } + + } + return isChecking ?? false; + } + } #endregion } } diff --git a/src/CloudGaming/Code/CloudGaming.Code/AppExtend/CustomResultFilter.cs b/src/CloudGaming/Code/CloudGaming.Code/AppExtend/CustomResultFilter.cs index 63c3c34..7b76eba 100644 --- a/src/CloudGaming/Code/CloudGaming.Code/AppExtend/CustomResultFilter.cs +++ b/src/CloudGaming/Code/CloudGaming.Code/AppExtend/CustomResultFilter.cs @@ -6,8 +6,12 @@ using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc.Filters; +using Swashbuckle.AspNetCore.SwaggerGen; + using System; using System.Collections; +using System.Collections.Specialized; +using System.Net; using System.Reflection; namespace CloudGaming.Code.AppExtend @@ -33,23 +37,40 @@ namespace CloudGaming.Code.AppExtend //Dictionary keyValuePairs = new Dictionary(); if (context.Result is ObjectResult objectResult && objectResult.Value != null) { - if (IsPrimitiveOrString(objectResult.Value.GetType())) - { + //if (IsPrimitiveOrString(objectResult.Value.GetType())) + //{ - } + //} - var dic = objectResult.Value.ToDictionary(); - //objectResult.Value = dic; + var dic = objectResult.Value.ToDictionaryOrList(); var t = objectResult.Value.GetType(); if (!t.FullName.Contains("HuanMeng.DotNetCore.Base.BaseResponse")) { - BaseResponse> baseResponse = new BaseResponse>(ResonseCode.Success, "", dic); + BaseResponse baseResponse = new BaseResponse(ResonseCode.Success, "", dic); objectResult.Value = baseResponse; } else { objectResult.Value = dic; } + //if (objectResult.Value is IEnumerable enumerable) + //{ + // var list = objectResult.Value.ToListDictionary(5); + // BaseResponse>> baseResponse = new BaseResponse>>(ResonseCode.Success, "", list); + // objectResult.Value = baseResponse; + // return; + //} + //var dic = objectResult.Value.ToDictionary(5); + //var t = objectResult.Value.GetType(); + //if (!t.FullName.Contains("HuanMeng.DotNetCore.Base.BaseResponse")) + //{ + // BaseResponse> baseResponse = new BaseResponse>(ResonseCode.Success, "", dic); + // objectResult.Value = baseResponse; + //} + //else + //{ + // objectResult.Value = dic; + //} //objectResult.Value.to //FindImagesAttributes(objectResult.Value); diff --git a/src/CloudGaming/Code/CloudGaming.Code/Cache/CloudGamingCache.cs b/src/CloudGaming/Code/CloudGaming.Code/Cache/CloudGamingCache.cs index 64e64f1..6ac9abb 100644 --- a/src/CloudGaming/Code/CloudGaming.Code/Cache/CloudGamingCache.cs +++ b/src/CloudGaming/Code/CloudGaming.Code/Cache/CloudGamingCache.cs @@ -54,6 +54,17 @@ namespace CloudGaming.Code.Cache public List AppConfigList => GetCacheList(ref _appConfigCache); #endregion + + #region 首页缓存表 + + private CommonDataEntityCache? _epgCategoryCfg; + + /// + /// 菜单分类 + /// + public List EpgCategoryCfg => GetCacheList(ref _epgCategoryCfg, it => it.IsOnline); + + #endregion } /// diff --git a/src/CloudGaming/Code/CloudGaming.Code/Config/AppConfigBLL.cs b/src/CloudGaming/Code/CloudGaming.Code/Config/AppConfigBLL.cs index 7cbc5e7..ee1b59e 100644 --- a/src/CloudGaming/Code/CloudGaming.Code/Config/AppConfigBLL.cs +++ b/src/CloudGaming/Code/CloudGaming.Code/Config/AppConfigBLL.cs @@ -23,14 +23,25 @@ namespace CloudGaming.Code.Config /// public async Task GetAppConfig() { - var list = Cache.AppConfigList.Where(it => it.IsShow).ToList(); - var x = AppRequestInfo.versionNum; + var x = AppRequestInfo.VersionNum; AppConfigDto appConfigDto = new AppConfigDto() { IsAuthRealName = true }; - appConfigDto.IsChecking = list.GetAppIsChecking(AppRequestInfo); + appConfigDto.IsChecking = IsChecking; return appConfigDto; } + + /// + /// + /// + /// + public bool GetAppIsChecking() + { + var list = Cache.AppConfigList.ToList(); + return list.GetAppIsChecking(AppRequestInfo); + } + + } } diff --git a/src/CloudGaming/Code/CloudGaming.Code/Config/AppConfigBLLExtend.cs b/src/CloudGaming/Code/CloudGaming.Code/Config/AppConfigBLLExtend.cs index 6aa8904..f3dcaf3 100644 --- a/src/CloudGaming/Code/CloudGaming.Code/Config/AppConfigBLLExtend.cs +++ b/src/CloudGaming/Code/CloudGaming.Code/Config/AppConfigBLLExtend.cs @@ -25,6 +25,7 @@ public static class AppConfigBLLExtend { return false; } + var version = config.ConfigValue.Replace(".", ""); if (!int.TryParse(version, out int versionNum)) { @@ -32,7 +33,7 @@ public static class AppConfigBLLExtend } if (appRequestInfo.VersionNum >= versionNum) { - return true; + return config.IsShow; } return false; } diff --git a/src/CloudGaming/Code/CloudGaming.Code/Epg/EpgBLL.cs b/src/CloudGaming/Code/CloudGaming.Code/Epg/EpgBLL.cs new file mode 100644 index 0000000..917d42b --- /dev/null +++ b/src/CloudGaming/Code/CloudGaming.Code/Epg/EpgBLL.cs @@ -0,0 +1,75 @@ +using CloudGaming.DtoModel.Epg; + +using System; +using System.Collections.Generic; +using System.Diagnostics; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace CloudGaming.Code.Epg +{ + /// + /// + /// + public class EpgBLL : CloudGamingBase + { + public EpgBLL(IServiceProvider serviceProvider) : base(serviceProvider) + { + } + + /// + /// + /// + /// + public async Task> GetHomeInfo() + { + var listQueryable = GetEpgCategory("Home").AsQueryable(); + if (IsChecking) + { + listQueryable = listQueryable.Where(it => it.ShowStatus == 0 || it.ShowStatus == 2).AsQueryable(); + } + else + { + listQueryable = listQueryable.Where(it => it.ShowStatus == 0 || it.ShowStatus == 1).AsQueryable(); + } + var list = listQueryable.OrderBy(it => it.OrderId).ToList(); + + List epgCategoryDtos = new List(); + list.ForEach(it => + { + EpgCategoryDto epgCategoryDto = new EpgCategoryDto() + { + CategoryName = it.Name, + CategoryType = it.IdName, + IsQuickStartPopUp = it.IsQuickStartPopUp ?? false, + ShowNum_Index = it.ShowNumIndex ?? 0, + EpgList = new List() + { + + }, + }; + if (it.Id == list[0].Id) + { + epgCategoryDto.EpgList.Add(new EpgInfo() { CornerIcon = 1, IdName = "111" }); + } + epgCategoryDtos.Add(epgCategoryDto); + }); + return epgCategoryDtos; + } + /// + /// + /// + /// + /// + public List GetEpgCategory(string idName) + { + var epg_CategoryCfg = Cache.EpgCategoryCfg.Where(it => it.IdName == idName).FirstOrDefault(); + if (epg_CategoryCfg != null) + { + return Cache.EpgCategoryCfg.Where(it => it.EpgParentCategory == epg_CategoryCfg.Id).ToList(); + } + return new List(); + } + } +} diff --git a/src/CloudGaming/Console/CloudGaming.CreateDataBase/Program.cs b/src/CloudGaming/Console/CloudGaming.CreateDataBase/Program.cs index 98bea14..6c46857 100644 --- a/src/CloudGaming/Console/CloudGaming.CreateDataBase/Program.cs +++ b/src/CloudGaming/Console/CloudGaming.CreateDataBase/Program.cs @@ -10,8 +10,8 @@ CloudGamingPhoneContext cloudGamingPhoneContext = new CloudGamingPhoneContext(op cloudGamingPhoneContext.Database.EnsureCreated(); var x = cloudGamingPhoneContext.T_Epg_Cfg.Count(); //Server=192.168.1.17;Database=CloudGamingPhone;User Id=sa;Password=Dbt@com@123;TrustServerCertificate=true; -var optionsBuilder1 = new DbContextOptionsBuilder(); -var option1 = optionsBuilder1.UseSqlServer("Server=192.168.1.17;Database=CloudGamingUser;User Id=sa;Password=Dbt@com@123;TrustServerCertificate=true;").Options; -CloudGamingUserContext cloud = new CloudGamingUserContext(option1); -cloud.Database.EnsureCreated(); +//var optionsBuilder1 = new DbContextOptionsBuilder(); +//var option1 = optionsBuilder1.UseSqlServer("Server=192.168.1.17;Database=CloudGamingUser;User Id=sa;Password=Dbt@com@123;TrustServerCertificate=true;").Options; +//CloudGamingUserContext cloud = new CloudGamingUserContext(option1); +//cloud.Database.EnsureCreated(); //cloud.Database. \ No newline at end of file diff --git a/src/CloudGaming/Model/CloudGaming.DtoModel/Epg/EpgCategoryDto.cs b/src/CloudGaming/Model/CloudGaming.DtoModel/Epg/EpgCategoryDto.cs new file mode 100644 index 0000000..83f872f --- /dev/null +++ b/src/CloudGaming/Model/CloudGaming.DtoModel/Epg/EpgCategoryDto.cs @@ -0,0 +1,38 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace CloudGaming.DtoModel.Epg +{ + /// + /// + /// + public class EpgCategoryDto + { + public EpgCategoryDto() { } + /// + /// 菜单栏目名称 + /// + public string CategoryName { get; set; } + /// + /// 菜单栏目标识 + /// + public string CategoryType { get; set; } + + /// + /// 是快速启动弹出窗口 + /// + public bool IsQuickStartPopUp { get; set; } + /// + /// 菜单列表 + /// + public List EpgList { get; set; } + + /// + /// 首页展示数量 + /// + public int ShowNum_Index { get; set; } + } +} diff --git a/src/CloudGaming/Model/CloudGaming.DtoModel/Epg/EpgInfo.cs b/src/CloudGaming/Model/CloudGaming.DtoModel/Epg/EpgInfo.cs new file mode 100644 index 0000000..add9a6e --- /dev/null +++ b/src/CloudGaming/Model/CloudGaming.DtoModel/Epg/EpgInfo.cs @@ -0,0 +1,77 @@ +using HuanMeng.DotNetCore.AttributeExtend; + +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace CloudGaming.DtoModel.Epg +{ + /// + /// 首页中游戏类型 + /// + public class EpgInfo + { + public EpgInfo() { } + /// + /// 菜单编号 + /// + public int EpgId { get; set; } + + /// + /// 资源类型:4游戏 + /// + public int ResType { get; set; } + + /// + /// 资源Id(参数) 如果资源类型为游戏:游戏Id + /// + public string ResId { get; set; } + + /// + /// 代码标识 + /// + public string IdName { get; set; } + + /// + /// 展示图片信息,长宽 + /// + [Images] + public int Pic { get; set; } + /// + /// 展示图片信息,长宽 + /// + [Images] + public int Pic2 { get; set; } + /// + /// 展示图片信息,长宽 + /// + [Images] + public int Pic3 { get; set; } + + /// + /// 展示游戏Iocn信息,长宽 + /// + [Images] + public int GameIconImage { get; set; } + + /// + /// 标题 + /// + public string Title { get; set; } + /// + /// 标题2 + /// + public string Title2 { get; set; } + /// + /// 评分,0.0 + /// + public string Score { get; set; } + /// + /// 角标图片信息 + /// + [Images] + public int CornerIcon { get; set; } + } +} diff --git a/src/CloudGaming/Model/CloudGaming.Model/DbSqlServer/Db_Phone/CloudGamingPhoneContext.cs b/src/CloudGaming/Model/CloudGaming.Model/DbSqlServer/Db_Phone/CloudGamingPhoneContext.cs index 8a256e8..8006955 100644 --- a/src/CloudGaming/Model/CloudGaming.Model/DbSqlServer/Db_Phone/CloudGamingPhoneContext.cs +++ b/src/CloudGaming/Model/CloudGaming.Model/DbSqlServer/Db_Phone/CloudGamingPhoneContext.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using Microsoft.EntityFrameworkCore; @@ -48,21 +48,11 @@ public partial class CloudGamingPhoneContext : MultiTenantDbContext//DbContext /// public virtual DbSet T_Epg_CategoryCfg { get; set; } - /// - /// Epg分组配置表 - /// - public virtual DbSet T_Epg_CategoryCfg_Export { get; set; } - /// /// Epg配置表 /// public virtual DbSet T_Epg_Cfg { get; set; } - /// - /// Epg配置表 - /// - public virtual DbSet T_Epg_Cfg_Export { get; set; } - /// /// 悬浮球配置 /// @@ -164,7 +154,6 @@ public partial class CloudGamingPhoneContext : MultiTenantDbContext//DbContext entity.ToTable(tb => tb.HasComment("用户头像框")); - entity.Property(e => e.AvatarId) .HasMaxLength(50) .HasComment("头像框Id") @@ -193,114 +182,37 @@ public partial class CloudGamingPhoneContext : MultiTenantDbContext//DbContext modelBuilder.Entity(entity => { - entity.HasKey(e => e.EpgCategory).HasName("PK_T_EPG_CATEGORYCFG"); - entity.ToTable(tb => tb.HasComment("Epg分组配置表")); - entity.Property(e => e.EpgCategory).HasComment("epg分组Id"); - - entity.Property(e => e.EpgParentCategory).HasComment("epg父组Id, 0无"); - entity.Property(e => e.Extend1) - .HasMaxLength(200) - .IsUnicode(false) - .HasComment("扩展字段1") - .UseCollation("Chinese_PRC_CI_AS"); - entity.Property(e => e.Extend2) - .HasMaxLength(200) - .IsUnicode(false) - .HasComment("扩展字段2") - .UseCollation("Chinese_PRC_CI_AS"); - entity.Property(e => e.Extend3) - .HasMaxLength(200) - .IsUnicode(false) - .HasComment("扩展字段3") - .UseCollation("Chinese_PRC_CI_AS"); - entity.Property(e => e.IdName) + entity.Property(e => e.Id).HasComment("epg分组Id"); + entity.Property(e => e.Channel) .HasMaxLength(50) .IsUnicode(false) + .HasComment("上线渠道,0不限制") + .UseCollation("Chinese_PRC_CI_AS"); + entity.Property(e => e.EpgParentCategory).HasComment("epg父组Id, 0无"); + entity.Property(e => e.IdName) + .HasMaxLength(50) .HasComment("代码标识") .UseCollation("Chinese_PRC_CI_AS"); entity.Property(e => e.ImageId).HasComment("图片-预留"); entity.Property(e => e.ImageId2).HasComment("图片-预留"); - entity.Property(e => e.IsNotCheckingShow) - .HasDefaultValue(true) - .HasComment("审核模式下不显示"); entity.Property(e => e.IsOnline).HasComment("是否启用"); - entity.Property(e => e.IsOnlineQuickStartPopUp).HasComment("联机游戏快速启动弹窗"); entity.Property(e => e.IsQuickStartPopUp).HasComment("快速启动弹窗"); - entity.Property(e => e.IsStandardClose).HasComment("非审核(正常)模式是否关闭"); entity.Property(e => e.Name) .HasMaxLength(50) .HasComment("分组名称") .UseCollation("Chinese_PRC_CI_AS"); - entity.Property(e => e.OnlineBossId) - .HasMaxLength(50) - .IsUnicode(false) - .HasComment("上线渠道,0不限制") - .UseCollation("Chinese_PRC_CI_AS"); - entity.Property(e => e.OnlinePlatform) + entity.Property(e => e.OrderId).HasComment("排序-正序"); + entity.Property(e => e.Platform) .HasMaxLength(100) .IsUnicode(false) .HasComment("上线平台") .UseCollation("Chinese_PRC_CI_AS"); - entity.Property(e => e.OrderId).HasComment("排序-正序"); - entity.Property(e => e.ShowNum_Index).HasComment("首页展示数量"); - //添加全局筛选器 - if (this.TenantInfo != null) - { - entity.HasQueryFilter(it => it.TenantId == this.TenantInfo.TenantId); - } - }); - - modelBuilder.Entity(entity => - { - entity.HasKey(e => e.EpgCategory).HasName("PK_T_EPG_CATEGORYCFG_EXP"); - - entity.ToTable(tb => tb.HasComment("Epg分组配置表")); - - entity.Property(e => e.EpgCategory) - .ValueGeneratedNever() - .HasComment("epg分组Id"); - entity.Property(e => e.EpgParentCategory).HasComment("epg父组Id, 0无"); - entity.Property(e => e.Extend1) - .HasMaxLength(200) - .IsUnicode(false) - .HasComment("扩展字段1") - .UseCollation("Chinese_PRC_CI_AS"); - entity.Property(e => e.Extend2) - .HasMaxLength(200) - .IsUnicode(false) - .HasComment("扩展字段2") - .UseCollation("Chinese_PRC_CI_AS"); - entity.Property(e => e.Extend3) - .HasMaxLength(200) - .IsUnicode(false) - .HasComment("扩展字段3") - .UseCollation("Chinese_PRC_CI_AS"); - entity.Property(e => e.IdName) - .HasMaxLength(50) - .IsUnicode(false) - .HasComment("代码标识") - .UseCollation("Chinese_PRC_CI_AS"); - entity.Property(e => e.ImageId).HasComment("图片-预留"); - entity.Property(e => e.ImageId2).HasComment("图片-预留"); - entity.Property(e => e.IsOnline).HasComment("是否启用"); - entity.Property(e => e.Name) - .HasMaxLength(50) - .HasComment("分组名称") - .UseCollation("Chinese_PRC_CI_AS"); - entity.Property(e => e.OnlineBossId) - .HasMaxLength(50) - .IsUnicode(false) - .HasComment("上线渠道,0不限制") - .UseCollation("Chinese_PRC_CI_AS"); - entity.Property(e => e.OnlinePlatform) - .HasMaxLength(100) - .IsUnicode(false) - .HasComment("上线平台") - .UseCollation("Chinese_PRC_CI_AS"); - entity.Property(e => e.OrderId).HasComment("排序-正序"); - entity.Property(e => e.ShowNum_Index).HasComment("首页展示数量"); + entity.Property(e => e.ShowNumIndex).HasComment("首页展示数量"); + entity.Property(e => e.ShowStatus) + .HasDefaultValue(1) + .HasComment("显示状态。0全部显示,1审核模式下不显示,2正常模式下不显示,审核显示"); //添加全局筛选器 if (this.TenantInfo != null) { @@ -310,11 +222,16 @@ public partial class CloudGamingPhoneContext : MultiTenantDbContext//DbContext modelBuilder.Entity(entity => { - entity.HasKey(e => e.EpgId).HasName("PK_T_EPG_CFG"); + entity.HasKey(e => e.EpgId).HasName("PK_T_VL_UI_EPG_CFG"); entity.ToTable(tb => tb.HasComment("Epg配置表")); entity.Property(e => e.EpgId).HasComment("标识"); + entity.Property(e => e.Channel) + .HasMaxLength(50) + .IsUnicode(false) + .HasComment("渠道") + .UseCollation("Chinese_PRC_CI_AS"); entity.Property(e => e.Continent) .HasMaxLength(200) .HasComment("州") @@ -324,58 +241,38 @@ public partial class CloudGamingPhoneContext : MultiTenantDbContext//DbContext .HasMaxLength(200) .HasComment("国家") .UseCollation("Chinese_PRC_CI_AS"); + entity.Property(e => e.CreateTime) + .HasComment("创建时间") + .HasColumnType("datetime"); entity.Property(e => e.EndEnableTime) .HasComment("结束时间") .HasColumnType("datetime"); entity.Property(e => e.EpgCategory).HasComment("epg分组"); - entity.Property(e => e.Extend1) - .HasMaxLength(200) - .IsUnicode(false) - .HasComment("扩展字段1") - .UseCollation("Chinese_PRC_CI_AS"); - entity.Property(e => e.Extend2) - .HasMaxLength(200) - .IsUnicode(false) - .HasComment("扩展字段2") - .UseCollation("Chinese_PRC_CI_AS"); - entity.Property(e => e.Extend3) - .HasMaxLength(200) - .IsUnicode(false) - .HasComment("扩展字段3") - .UseCollation("Chinese_PRC_CI_AS"); entity.Property(e => e.IdName) .HasMaxLength(50) .IsUnicode(false) + .HasComment("代码标识") .UseCollation("Chinese_PRC_CI_AS"); entity.Property(e => e.ImageId).HasComment("图片"); entity.Property(e => e.ImageId2).HasComment("图片2-预留"); entity.Property(e => e.ImageId3).HasComment("图片3"); entity.Property(e => e.ImageResStyle) .HasMaxLength(50) - .IsUnicode(false) .HasComment("使用原始资源图样式n_n") .UseCollation("Chinese_PRC_CI_AS"); - entity.Property(e => e.IsCheckingClose).HasComment("审核模式是否关闭"); entity.Property(e => e.IsOnline).HasComment("是否启用"); - entity.Property(e => e.IsOnlineQuickStartPopUp).HasComment("联机快速启动"); - entity.Property(e => e.IsStandardClose).HasComment("非审核(正常)模式是否关闭"); - entity.Property(e => e.OnlineBossId) - .HasMaxLength(50) - .IsUnicode(false) - .UseCollation("Chinese_PRC_CI_AS"); - entity.Property(e => e.OnlinePlatform) - .HasMaxLength(50) - .IsUnicode(false) - .UseCollation("Chinese_PRC_CI_AS"); entity.Property(e => e.OrderId).HasComment("排序-正序"); + entity.Property(e => e.Platform) + .HasMaxLength(50) + .IsUnicode(false) + .HasComment("平台,安卓还是ios") + .UseCollation("Chinese_PRC_CI_AS"); entity.Property(e => e.ResId) .HasMaxLength(200) - .IsUnicode(false) .HasComment("资源Id") .UseCollation("Chinese_PRC_CI_AS"); entity.Property(e => e.ResParams) .HasMaxLength(200) - .IsUnicode(false) .HasComment("资源参数") .UseCollation("Chinese_PRC_CI_AS"); entity.Property(e => e.ResType).HasComment("资源类型"); @@ -398,105 +295,6 @@ public partial class CloudGamingPhoneContext : MultiTenantDbContext//DbContext entity.Property(e => e.UpdateTime) .HasComment("更新时间") .HasColumnType("datetime"); - entity.Property(e => e.VideoIdentification) - .HasMaxLength(200) - .HasComment("视频标识") - .UseCollation("Chinese_PRC_CI_AS"); - entity.Property(e => e.VideoUrl) - .HasMaxLength(200) - .IsUnicode(false) - .HasComment("视频地址") - .UseCollation("Chinese_PRC_CI_AS"); - //添加全局筛选器 - if (this.TenantInfo != null) - { - entity.HasQueryFilter(it => it.TenantId == this.TenantInfo.TenantId); - } - }); - - modelBuilder.Entity(entity => - { - entity.HasKey(e => e.EpgId).HasName("PK_T_EPG_CFG_EXPORT"); - - entity.ToTable(tb => tb.HasComment("Epg配置表")); - - entity.Property(e => e.EpgId) - .ValueGeneratedNever() - .HasComment("标识"); - entity.Property(e => e.CornerIconId).HasComment("角标"); - entity.Property(e => e.EpgCategory).HasComment("epg分组"); - entity.Property(e => e.Extend1) - .HasMaxLength(200) - .IsUnicode(false) - .HasComment("扩展字段1") - .UseCollation("Chinese_PRC_CI_AS"); - entity.Property(e => e.Extend2) - .HasMaxLength(200) - .IsUnicode(false) - .HasComment("扩展字段2") - .UseCollation("Chinese_PRC_CI_AS"); - entity.Property(e => e.Extend3) - .HasMaxLength(200) - .IsUnicode(false) - .HasComment("扩展字段3") - .UseCollation("Chinese_PRC_CI_AS"); - entity.Property(e => e.IdName) - .HasMaxLength(50) - .IsUnicode(false) - .HasComment("代码标识") - .UseCollation("Chinese_PRC_CI_AS"); - entity.Property(e => e.ImageId).HasComment("图片"); - entity.Property(e => e.ImageId2).HasComment("图片2"); - entity.Property(e => e.ImageResStyle) - .HasMaxLength(50) - .IsUnicode(false) - .HasComment("使用原始资源图样式n_n") - .UseCollation("Chinese_PRC_CI_AS"); - entity.Property(e => e.IsOnline).HasComment("是否启用"); - entity.Property(e => e.OnlineBossId) - .HasMaxLength(50) - .IsUnicode(false) - .HasComment("上线渠道,0不限") - .UseCollation("Chinese_PRC_CI_AS"); - entity.Property(e => e.OnlinePlatform) - .HasMaxLength(100) - .IsUnicode(false) - .HasComment("上线平台") - .UseCollation("Chinese_PRC_CI_AS"); - entity.Property(e => e.OrderId).HasComment("排序-正序"); - entity.Property(e => e.ResId) - .HasMaxLength(200) - .IsUnicode(false) - .HasComment("资源Id") - .UseCollation("Chinese_PRC_CI_AS"); - entity.Property(e => e.ResParams) - .HasMaxLength(200) - .IsUnicode(false) - .HasComment("资源参数") - .UseCollation("Chinese_PRC_CI_AS"); - entity.Property(e => e.ResType).HasComment("资源类型"); - entity.Property(e => e.SpecialId).HasComment("特殊标志"); - entity.Property(e => e.StyleType) - .HasMaxLength(50) - .IsUnicode(false) - .HasComment("展示样式:more") - .UseCollation("Chinese_PRC_CI_AS"); - entity.Property(e => e.Title) - .HasMaxLength(50) - .HasComment("标题") - .UseCollation("Chinese_PRC_CI_AS"); - entity.Property(e => e.Title2) - .HasMaxLength(200) - .HasComment("标题2") - .UseCollation("Chinese_PRC_CI_AS"); - entity.Property(e => e.UpdateTime) - .HasComment("更新时间") - .HasColumnType("datetime"); - entity.Property(e => e.VideoUrl) - .HasMaxLength(200) - .IsUnicode(false) - .HasComment("视频地址") - .UseCollation("Chinese_PRC_CI_AS"); //添加全局筛选器 if (this.TenantInfo != null) { @@ -510,7 +308,6 @@ public partial class CloudGamingPhoneContext : MultiTenantDbContext//DbContext entity.ToTable(tb => tb.HasComment("悬浮球配置")); - entity.Property(e => e.BossId) .HasMaxLength(50) .HasDefaultValue("") diff --git a/src/CloudGaming/Model/CloudGaming.Model/DbSqlServer/Db_Phone/T_AvatarFrame.cs b/src/CloudGaming/Model/CloudGaming.Model/DbSqlServer/Db_Phone/T_AvatarFrame.cs index dda9d0e..4670ef9 100644 --- a/src/CloudGaming/Model/CloudGaming.Model/DbSqlServer/Db_Phone/T_AvatarFrame.cs +++ b/src/CloudGaming/Model/CloudGaming.Model/DbSqlServer/Db_Phone/T_AvatarFrame.cs @@ -1,4 +1,4 @@ -using System; +using System; namespace CloudGaming.Model.DbSqlServer.Db_Phone; @@ -45,4 +45,8 @@ public partial class T_AvatarFrame: MultiTenantEntity /// public virtual string NameColor { get; set; } = null!; -} + /// + /// 所属租户 + /// + public override Guid TenantId { get; set; } + } diff --git a/src/CloudGaming/Model/CloudGaming.Model/DbSqlServer/Db_Phone/T_Epg_CategoryCfg.cs b/src/CloudGaming/Model/CloudGaming.Model/DbSqlServer/Db_Phone/T_Epg_CategoryCfg.cs index 50f5f13..8aef8b6 100644 --- a/src/CloudGaming/Model/CloudGaming.Model/DbSqlServer/Db_Phone/T_Epg_CategoryCfg.cs +++ b/src/CloudGaming/Model/CloudGaming.Model/DbSqlServer/Db_Phone/T_Epg_CategoryCfg.cs @@ -1,4 +1,4 @@ -using System; +using System; namespace CloudGaming.Model.DbSqlServer.Db_Phone; @@ -12,7 +12,7 @@ public partial class T_Epg_CategoryCfg: MultiTenantEntity /// /// epg分组Id /// - public virtual int EpgCategory { get; set; } + public virtual int Id { get; set; } /// /// epg父组Id, 0无 @@ -34,31 +34,6 @@ public partial class T_Epg_CategoryCfg: MultiTenantEntity /// public virtual bool IsOnline { get; set; } - /// - /// 扩展字段1 - /// - public virtual string? Extend1 { get; set; } - - /// - /// 扩展字段2 - /// - public virtual string? Extend2 { get; set; } - - /// - /// 扩展字段3 - /// - public virtual string? Extend3 { get; set; } - - /// - /// 上线平台 - /// - public virtual string? OnlinePlatform { get; set; } - - /// - /// 首页展示数量 - /// - public virtual int ShowNum_Index { get; set; } - /// /// 代码标识 /// @@ -67,37 +42,40 @@ public partial class T_Epg_CategoryCfg: MultiTenantEntity /// /// 图片-预留 /// - public virtual int ImageId { get; set; } + public virtual int? ImageId { get; set; } /// /// 图片-预留 /// - public virtual int ImageId2 { get; set; } - - /// - /// 上线渠道,0不限制 - /// - public virtual string? OnlineBossId { get; set; } - - + public virtual int? ImageId2 { get; set; } /// /// 快速启动弹窗 /// - public virtual bool IsQuickStartPopUp { get; set; } + public virtual bool? IsQuickStartPopUp { get; set; } /// - /// 联机游戏快速启动弹窗 + /// 上线平台 /// - public virtual bool IsOnlineQuickStartPopUp { get; set; } + public virtual string? Platform { get; set; } /// - /// 审核模式下不显示 + /// 首页展示数量 /// - public virtual bool? IsNotCheckingShow { get; set; } + public virtual int? ShowNumIndex { get; set; } /// - /// 非审核(正常)模式是否关闭 + /// 上线渠道,0不限制 /// - public virtual int IsStandardClose { get; set; } -} + public virtual string? Channel { get; set; } + + /// + /// 显示状态。0全部显示,1审核模式下不显示,2正常模式下不显示,审核显示 + /// + public virtual int ShowStatus { get; set; } + + /// + /// 所属租户 + /// + public override Guid TenantId { get; set; } + } diff --git a/src/CloudGaming/Model/CloudGaming.Model/DbSqlServer/Db_Phone/T_Epg_CategoryCfg_Export.cs b/src/CloudGaming/Model/CloudGaming.Model/DbSqlServer/Db_Phone/T_Epg_CategoryCfg_Export.cs deleted file mode 100644 index 623641e..0000000 --- a/src/CloudGaming/Model/CloudGaming.Model/DbSqlServer/Db_Phone/T_Epg_CategoryCfg_Export.cs +++ /dev/null @@ -1,80 +0,0 @@ - -namespace CloudGaming.Model.DbSqlServer.Db_Phone; - -/// -/// Epg分组配置表 -/// -public partial class T_Epg_CategoryCfg_Export: MultiTenantEntity -{ - public T_Epg_CategoryCfg_Export() { } - - /// - /// epg分组Id - /// - public virtual int EpgCategory { get; set; } - - /// - /// epg父组Id, 0无 - /// - public virtual int EpgParentCategory { get; set; } - - /// - /// 分组名称 - /// - public virtual string? Name { get; set; } - - /// - /// 排序-正序 - /// - public virtual int OrderId { get; set; } - - /// - /// 是否启用 - /// - public virtual bool IsOnline { get; set; } - - /// - /// 扩展字段1 - /// - public virtual string? Extend1 { get; set; } - - /// - /// 扩展字段2 - /// - public virtual string? Extend2 { get; set; } - - /// - /// 扩展字段3 - /// - public virtual string? Extend3 { get; set; } - - /// - /// 上线平台 - /// - public virtual string? OnlinePlatform { get; set; } - - /// - /// 首页展示数量 - /// - public virtual int ShowNum_Index { get; set; } - - /// - /// 代码标识 - /// - public virtual string? IdName { get; set; } - - /// - /// 图片-预留 - /// - public virtual int ImageId { get; set; } - - /// - /// 图片-预留 - /// - public virtual int ImageId2 { get; set; } - - /// - /// 上线渠道,0不限制 - /// - public virtual string? OnlineBossId { get; set; } -} diff --git a/src/CloudGaming/Model/CloudGaming.Model/DbSqlServer/Db_Phone/T_Epg_Cfg.cs b/src/CloudGaming/Model/CloudGaming.Model/DbSqlServer/Db_Phone/T_Epg_Cfg.cs index ec9d65d..5928656 100644 --- a/src/CloudGaming/Model/CloudGaming.Model/DbSqlServer/Db_Phone/T_Epg_Cfg.cs +++ b/src/CloudGaming/Model/CloudGaming.Model/DbSqlServer/Db_Phone/T_Epg_Cfg.cs @@ -59,11 +59,6 @@ public partial class T_Epg_Cfg: MultiTenantEntity /// public virtual string? ImageResStyle { get; set; } - /// - /// 视频地址 - /// - public virtual string? VideoUrl { get; set; } - /// /// 是否启用 /// @@ -82,27 +77,11 @@ public partial class T_Epg_Cfg: MultiTenantEntity /// /// 更新时间 /// - public virtual DateTime UpdateTime { get; set; } + public virtual DateTime? UpdateTime { get; set; } /// - /// 扩展字段1 + /// 代码标识 /// - public virtual string? Extend1 { get; set; } - - /// - /// 扩展字段2 - /// - public virtual string? Extend2 { get; set; } - - /// - /// 扩展字段3 - /// - public virtual string? Extend3 { get; set; } - - public virtual string? OnlinePlatform { get; set; } - - public virtual int SpecialId { get; set; } - public virtual string? IdName { get; set; } /// @@ -110,18 +89,6 @@ public partial class T_Epg_Cfg: MultiTenantEntity /// public virtual int ImageId2 { get; set; } - public virtual string? OnlineBossId { get; set; } - - /// - /// 视频标识 - /// - public virtual string? VideoIdentification { get; set; } - - /// - /// 联机快速启动 - /// - public virtual bool IsOnlineQuickStartPopUp { get; set; } - /// /// 启用时间 /// @@ -148,12 +115,22 @@ public partial class T_Epg_Cfg: MultiTenantEntity public virtual string? Continent { get; set; } /// - /// 非审核(正常)模式是否关闭 + /// 渠道 /// - public virtual int IsStandardClose { get; set; } + public virtual string? Channel { get; set; } /// - /// 审核模式是否关闭 + /// 平台,安卓还是ios /// - public virtual int IsCheckingClose { get; set; } -} + public virtual string? Platform { get; set; } + + /// + /// 创建时间 + /// + public virtual DateTime? CreateTime { get; set; } + + /// + /// 所属租户 + /// + public override Guid TenantId { get; set; } + } diff --git a/src/CloudGaming/Model/CloudGaming.Model/DbSqlServer/Db_Phone/T_Epg_Cfg_Export.cs b/src/CloudGaming/Model/CloudGaming.Model/DbSqlServer/Db_Phone/T_Epg_Cfg_Export.cs deleted file mode 100644 index 53288d8..0000000 --- a/src/CloudGaming/Model/CloudGaming.Model/DbSqlServer/Db_Phone/T_Epg_Cfg_Export.cs +++ /dev/null @@ -1,126 +0,0 @@ -using System; - -namespace CloudGaming.Model.DbSqlServer.Db_Phone; - -/// -/// Epg配置表 -/// -public partial class T_Epg_Cfg_Export: MultiTenantEntity -{ - public T_Epg_Cfg_Export() { } - - /// - /// 标识 - /// - public virtual int EpgId { get; set; } - - /// - /// epg分组 - /// - public virtual int EpgCategory { get; set; } - - /// - /// 资源Id - /// - public virtual string? ResId { get; set; } - - /// - /// 资源类型 - /// - public virtual int ResType { get; set; } - - /// - /// 资源参数 - /// - public virtual string? ResParams { get; set; } - - /// - /// 排序-正序 - /// - public virtual int OrderId { get; set; } - - /// - /// 标题 - /// - public virtual string? Title { get; set; } - - /// - /// 标题2 - /// - public virtual string? Title2 { get; set; } - - /// - /// 图片 - /// - public virtual int ImageId { get; set; } - - /// - /// 使用原始资源图样式n_n - /// - public virtual string? ImageResStyle { get; set; } - - /// - /// 视频地址 - /// - public virtual string? VideoUrl { get; set; } - - /// - /// 是否启用 - /// - public virtual bool IsOnline { get; set; } - - /// - /// 角标 - /// - public virtual int CornerIconId { get; set; } - - /// - /// 展示样式:more - /// - public virtual string? StyleType { get; set; } - - /// - /// 更新时间 - /// - public virtual DateTime UpdateTime { get; set; } - - /// - /// 扩展字段1 - /// - public virtual string? Extend1 { get; set; } - - /// - /// 扩展字段2 - /// - public virtual string? Extend2 { get; set; } - - /// - /// 扩展字段3 - /// - public virtual string? Extend3 { get; set; } - - /// - /// 上线平台 - /// - public virtual string? OnlinePlatform { get; set; } - - /// - /// 特殊标志 - /// - public virtual int SpecialId { get; set; } - - /// - /// 代码标识 - /// - public virtual string? IdName { get; set; } - - /// - /// 图片2 - /// - public virtual int ImageId2 { get; set; } - - /// - /// 上线渠道,0不限 - /// - public virtual string? OnlineBossId { get; set; } -} diff --git a/src/CloudGaming/Model/CloudGaming.Model/DbSqlServer/Db_Phone/T_FloatBall_Cfg.cs b/src/CloudGaming/Model/CloudGaming.Model/DbSqlServer/Db_Phone/T_FloatBall_Cfg.cs index fefc071..709ca1b 100644 --- a/src/CloudGaming/Model/CloudGaming.Model/DbSqlServer/Db_Phone/T_FloatBall_Cfg.cs +++ b/src/CloudGaming/Model/CloudGaming.Model/DbSqlServer/Db_Phone/T_FloatBall_Cfg.cs @@ -1,4 +1,4 @@ -using System; +using System; namespace CloudGaming.Model.DbSqlServer.Db_Phone; @@ -61,9 +61,13 @@ public partial class T_FloatBall_Cfg: MultiTenantEntity /// public virtual DateTime UpdateTime { get; set; } - /// /// 渠道号id /// public virtual string BossId { get; set; } = null!; -} + + /// + /// 所属租户 + /// + public override Guid TenantId { get; set; } + } diff --git a/src/CloudGaming/Model/CloudGaming.Model/DbSqlServer/Db_Phone/T_GameCBT.cs b/src/CloudGaming/Model/CloudGaming.Model/DbSqlServer/Db_Phone/T_GameCBT.cs index 487765e..8852e03 100644 --- a/src/CloudGaming/Model/CloudGaming.Model/DbSqlServer/Db_Phone/T_GameCBT.cs +++ b/src/CloudGaming/Model/CloudGaming.Model/DbSqlServer/Db_Phone/T_GameCBT.cs @@ -166,4 +166,9 @@ public partial class T_GameCBT: MultiTenantEntity /// 启动提示 /// public virtual string? FriendlyTips { get; set; } -} + + /// + /// 所属租户 + /// + public override Guid TenantId { get; set; } + } diff --git a/src/CloudGaming/Model/CloudGaming.Model/DbSqlServer/Db_Phone/T_GameInputSetting.cs b/src/CloudGaming/Model/CloudGaming.Model/DbSqlServer/Db_Phone/T_GameInputSetting.cs index 8e35b00..c1bd0e1 100644 --- a/src/CloudGaming/Model/CloudGaming.Model/DbSqlServer/Db_Phone/T_GameInputSetting.cs +++ b/src/CloudGaming/Model/CloudGaming.Model/DbSqlServer/Db_Phone/T_GameInputSetting.cs @@ -31,4 +31,9 @@ public partial class T_GameInputSetting: MultiTenantEntity /// 是否显示切换键盘按钮 /// public virtual bool IsToggleKeyboard { get; set; } -} + + /// + /// 所属租户 + /// + public override Guid TenantId { get; set; } + } diff --git a/src/CloudGaming/Model/CloudGaming.Model/DbSqlServer/Db_Phone/T_GameKeyPlan_CBT.cs b/src/CloudGaming/Model/CloudGaming.Model/DbSqlServer/Db_Phone/T_GameKeyPlan_CBT.cs index 67fb904..bdd2052 100644 --- a/src/CloudGaming/Model/CloudGaming.Model/DbSqlServer/Db_Phone/T_GameKeyPlan_CBT.cs +++ b/src/CloudGaming/Model/CloudGaming.Model/DbSqlServer/Db_Phone/T_GameKeyPlan_CBT.cs @@ -41,4 +41,9 @@ public partial class T_GameKeyPlan_CBT: MultiTenantEntity /// 方案类型1键盘 2手柄 /// public virtual int PlanType { get; set; } -} + + /// + /// 所属租户 + /// + public override Guid TenantId { get; set; } + } diff --git a/src/CloudGaming/Model/CloudGaming.Model/DbSqlServer/Db_Phone/T_GamePressKey.cs b/src/CloudGaming/Model/CloudGaming.Model/DbSqlServer/Db_Phone/T_GamePressKey.cs index 00e66d7..4ce877d 100644 --- a/src/CloudGaming/Model/CloudGaming.Model/DbSqlServer/Db_Phone/T_GamePressKey.cs +++ b/src/CloudGaming/Model/CloudGaming.Model/DbSqlServer/Db_Phone/T_GamePressKey.cs @@ -93,4 +93,9 @@ public partial class T_GamePressKey: MultiTenantEntity /// 按键分组,手柄还是键盘 /// public virtual int? GamePressKeyGroupBy { get; set; } -} + + /// + /// 所属租户 + /// + public override Guid TenantId { get; set; } + } diff --git a/src/CloudGaming/Model/CloudGaming.Model/DbSqlServer/Db_Phone/T_GamePressKeyPlan.cs b/src/CloudGaming/Model/CloudGaming.Model/DbSqlServer/Db_Phone/T_GamePressKeyPlan.cs index cfc59c1..8967308 100644 --- a/src/CloudGaming/Model/CloudGaming.Model/DbSqlServer/Db_Phone/T_GamePressKeyPlan.cs +++ b/src/CloudGaming/Model/CloudGaming.Model/DbSqlServer/Db_Phone/T_GamePressKeyPlan.cs @@ -58,4 +58,9 @@ public partial class T_GamePressKeyPlan: MultiTenantEntity /// 是否启用 /// public virtual bool? IsEnable { get; set; } -} + + /// + /// 所属租户 + /// + public override Guid TenantId { get; set; } + } diff --git a/src/CloudGaming/Model/CloudGaming.Model/DbSqlServer/Db_Phone/T_GameShow.cs b/src/CloudGaming/Model/CloudGaming.Model/DbSqlServer/Db_Phone/T_GameShow.cs index 3ad191f..1568ae1 100644 --- a/src/CloudGaming/Model/CloudGaming.Model/DbSqlServer/Db_Phone/T_GameShow.cs +++ b/src/CloudGaming/Model/CloudGaming.Model/DbSqlServer/Db_Phone/T_GameShow.cs @@ -34,4 +34,9 @@ public partial class T_GameShow: MultiTenantEntity public virtual DateTime? CreateTime { get; set; } public virtual string? Desc { get; set; } -} + + /// + /// 所属租户 + /// + public override Guid TenantId { get; set; } + } diff --git a/src/CloudGaming/Model/CloudGaming.Model/DbSqlServer/Db_Phone/T_Game_DiscountCfg.cs b/src/CloudGaming/Model/CloudGaming.Model/DbSqlServer/Db_Phone/T_Game_DiscountCfg.cs index 096d40d..2bf65ac 100644 --- a/src/CloudGaming/Model/CloudGaming.Model/DbSqlServer/Db_Phone/T_Game_DiscountCfg.cs +++ b/src/CloudGaming/Model/CloudGaming.Model/DbSqlServer/Db_Phone/T_Game_DiscountCfg.cs @@ -63,4 +63,9 @@ public partial class T_Game_DiscountCfg: MultiTenantEntity /// 每小时折扣VIP蘑菇币费用 /// public virtual int DiscountMoguNumHourVip { get; set; } -} + + /// + /// 所属租户 + /// + public override Guid TenantId { get; set; } + } diff --git a/src/CloudGaming/Model/CloudGaming.Model/DbSqlServer/Db_Phone/T_KeyboardSetting.cs b/src/CloudGaming/Model/CloudGaming.Model/DbSqlServer/Db_Phone/T_KeyboardSetting.cs index ee4184d..adbe878 100644 --- a/src/CloudGaming/Model/CloudGaming.Model/DbSqlServer/Db_Phone/T_KeyboardSetting.cs +++ b/src/CloudGaming/Model/CloudGaming.Model/DbSqlServer/Db_Phone/T_KeyboardSetting.cs @@ -61,4 +61,9 @@ public partial class T_KeyboardSetting: MultiTenantEntity /// 是否按下锁定 /// public virtual bool IsPressLock { get; set; } -} + + /// + /// 所属租户 + /// + public override Guid TenantId { get; set; } + } diff --git a/src/CloudGaming/Model/CloudGaming.Model/DbSqlServer/Db_Phone/T_PlanKey_CBT.cs b/src/CloudGaming/Model/CloudGaming.Model/DbSqlServer/Db_Phone/T_PlanKey_CBT.cs index 94dbec6..fef727a 100644 --- a/src/CloudGaming/Model/CloudGaming.Model/DbSqlServer/Db_Phone/T_PlanKey_CBT.cs +++ b/src/CloudGaming/Model/CloudGaming.Model/DbSqlServer/Db_Phone/T_PlanKey_CBT.cs @@ -58,4 +58,9 @@ public partial class T_PlanKey_CBT: MultiTenantEntity public virtual DateTime UpdateTime { get; set; } public virtual string? Remark { get; set; } -} + + /// + /// 所属租户 + /// + public override Guid TenantId { get; set; } + } diff --git a/src/CloudGaming/Model/CloudGaming.Model/DbSqlServer/Db_Phone/T_Popup.cs b/src/CloudGaming/Model/CloudGaming.Model/DbSqlServer/Db_Phone/T_Popup.cs index 4413986..06b5dfd 100644 --- a/src/CloudGaming/Model/CloudGaming.Model/DbSqlServer/Db_Phone/T_Popup.cs +++ b/src/CloudGaming/Model/CloudGaming.Model/DbSqlServer/Db_Phone/T_Popup.cs @@ -92,4 +92,9 @@ public partial class T_Popup: MultiTenantEntity /// 扩展参数1 /// public virtual string? Extend1 { get; set; } -} + + /// + /// 所属租户 + /// + public override Guid TenantId { get; set; } + } diff --git a/src/CloudGaming/Model/CloudGaming.Model/DbSqlServer/Db_Phone/T_PopupBtn.cs b/src/CloudGaming/Model/CloudGaming.Model/DbSqlServer/Db_Phone/T_PopupBtn.cs index c6833c4..f61bb3a 100644 --- a/src/CloudGaming/Model/CloudGaming.Model/DbSqlServer/Db_Phone/T_PopupBtn.cs +++ b/src/CloudGaming/Model/CloudGaming.Model/DbSqlServer/Db_Phone/T_PopupBtn.cs @@ -55,4 +55,9 @@ public partial class T_PopupBtn: MultiTenantEntity /// 延迟几秒显示按钮 /// public virtual int? DelaySecond { get; set; } -} + + /// + /// 所属租户 + /// + public override Guid TenantId { get; set; } + } diff --git a/src/CloudGaming/Model/CloudGaming.Model/DbSqlServer/Db_Phone/T_SevenDaySignIn_AwardCBT.cs b/src/CloudGaming/Model/CloudGaming.Model/DbSqlServer/Db_Phone/T_SevenDaySignIn_AwardCBT.cs index b06f17c..fc1a2c7 100644 --- a/src/CloudGaming/Model/CloudGaming.Model/DbSqlServer/Db_Phone/T_SevenDaySignIn_AwardCBT.cs +++ b/src/CloudGaming/Model/CloudGaming.Model/DbSqlServer/Db_Phone/T_SevenDaySignIn_AwardCBT.cs @@ -25,4 +25,9 @@ public partial class T_SevenDaySignIn_AwardCBT: MultiTenantEntity public virtual DateTime UpdateTime { get; set; } public virtual string? Remark { get; set; } -} + + /// + /// 所属租户 + /// + public override Guid TenantId { get; set; } + } diff --git a/src/CloudGaming/Model/CloudGaming.Model/DbSqlServer/Db_Phone/T_SignTypes.cs b/src/CloudGaming/Model/CloudGaming.Model/DbSqlServer/Db_Phone/T_SignTypes.cs index 0398c5a..344a031 100644 --- a/src/CloudGaming/Model/CloudGaming.Model/DbSqlServer/Db_Phone/T_SignTypes.cs +++ b/src/CloudGaming/Model/CloudGaming.Model/DbSqlServer/Db_Phone/T_SignTypes.cs @@ -27,4 +27,9 @@ public partial class T_SignTypes: MultiTenantEntity public virtual DateTime? CreateTime { get; set; } public virtual string? Desc { get; set; } -} + + /// + /// 所属租户 + /// + public override Guid TenantId { get; set; } + } diff --git a/src/CloudGaming/Model/CloudGaming.Model/DbSqlServer/Db_Phone/T_SysMessage.cs b/src/CloudGaming/Model/CloudGaming.Model/DbSqlServer/Db_Phone/T_SysMessage.cs index 92e41b0..a705b4d 100644 --- a/src/CloudGaming/Model/CloudGaming.Model/DbSqlServer/Db_Phone/T_SysMessage.cs +++ b/src/CloudGaming/Model/CloudGaming.Model/DbSqlServer/Db_Phone/T_SysMessage.cs @@ -47,4 +47,9 @@ public partial class T_SysMessage: MultiTenantEntity public virtual DateTime EndTime { get; set; } public virtual int ReceiveType { get; set; } -} + + /// + /// 所属租户 + /// + public override Guid TenantId { get; set; } + } diff --git a/src/CloudGaming/Model/CloudGaming.Model/DbSqlServer/Db_Phone/T_UITypes.cs b/src/CloudGaming/Model/CloudGaming.Model/DbSqlServer/Db_Phone/T_UITypes.cs index 7017f20..9c90d37 100644 --- a/src/CloudGaming/Model/CloudGaming.Model/DbSqlServer/Db_Phone/T_UITypes.cs +++ b/src/CloudGaming/Model/CloudGaming.Model/DbSqlServer/Db_Phone/T_UITypes.cs @@ -24,4 +24,9 @@ public partial class T_UITypes: MultiTenantEntity public virtual DateTime? CreateTime { get; set; } public virtual string? Desc { get; set; } -} + + /// + /// 所属租户 + /// + public override Guid TenantId { get; set; } + } diff --git a/src/CloudGaming/Model/CloudGaming.Model/DbSqlServer/Db_Phone/T_UIs.cs b/src/CloudGaming/Model/CloudGaming.Model/DbSqlServer/Db_Phone/T_UIs.cs index 1a33660..9a2da0c 100644 --- a/src/CloudGaming/Model/CloudGaming.Model/DbSqlServer/Db_Phone/T_UIs.cs +++ b/src/CloudGaming/Model/CloudGaming.Model/DbSqlServer/Db_Phone/T_UIs.cs @@ -45,4 +45,9 @@ public partial class T_UIs: MultiTenantEntity /// 放大倍数 /// public virtual double Scale { get; set; } -} + + /// + /// 所属租户 + /// + public override Guid TenantId { get; set; } + } diff --git a/src/CloudGaming/Model/CloudGaming.Model/DbSqlServer/Db_Phone/T_Videos.cs b/src/CloudGaming/Model/CloudGaming.Model/DbSqlServer/Db_Phone/T_Videos.cs index d529513..a7ec79f 100644 --- a/src/CloudGaming/Model/CloudGaming.Model/DbSqlServer/Db_Phone/T_Videos.cs +++ b/src/CloudGaming/Model/CloudGaming.Model/DbSqlServer/Db_Phone/T_Videos.cs @@ -30,4 +30,9 @@ public partial class T_Videos: MultiTenantEntity public virtual DateTime? CreateTime { get; set; } public virtual string? Desc { get; set; } -} + + /// + /// 所属租户 + /// + public override Guid TenantId { get; set; } + } diff --git a/src/CloudGaming/Utile/HuanMeng.DotNetCore/Redis/RedisConnection.cs b/src/CloudGaming/Utile/HuanMeng.DotNetCore/Redis/RedisConnection.cs index f3e9f40..16e0968 100644 --- a/src/CloudGaming/Utile/HuanMeng.DotNetCore/Redis/RedisConnection.cs +++ b/src/CloudGaming/Utile/HuanMeng.DotNetCore/Redis/RedisConnection.cs @@ -1,5 +1,8 @@ using Microsoft.Identity.Client; +using Newtonsoft.Json; +using Newtonsoft.Json.Linq; + using StackExchange.Redis; using System; @@ -52,5 +55,35 @@ namespace HuanMeng.DotNetCore.Redis { return database.StringSet(key, value, TimeSpan.FromSeconds(time), when: When.NotExists); } + + /// + /// 获取一个key的对象 + /// + /// + /// + /// + public static T? StringGet(this IDatabase database, string key) + { + var value = database.StringGet(key); + // 检查值是否为空 + if (!value.HasValue) + { + return default(T); + } + if (typeof(T).IsPrimitive || typeof(T) == typeof(string) || typeof(T) == typeof(decimal)) + { + try + { + return (T)Convert.ChangeType(value.ToString(), typeof(T)); + } + catch + { + return default; // 或抛出异常,取决于业务需求 + } + } + // 将 RedisValue 转换为 T 类型 + return JsonConvert.DeserializeObject(value); + } + } } diff --git a/src/CloudGaming/Utile/HuanMeng.DotNetCore/Utility/ObjectExtensions.cs b/src/CloudGaming/Utile/HuanMeng.DotNetCore/Utility/ObjectExtensions.cs index f15f5bf..b8ce46d 100644 --- a/src/CloudGaming/Utile/HuanMeng.DotNetCore/Utility/ObjectExtensions.cs +++ b/src/CloudGaming/Utile/HuanMeng.DotNetCore/Utility/ObjectExtensions.cs @@ -7,6 +7,8 @@ using System.Reflection; using System.Text; using System.Threading.Tasks; using HuanMeng.DotNetCore.AttributeExtend; +using Newtonsoft.Json.Linq; +using Swashbuckle.AspNetCore.SwaggerGen; namespace HuanMeng.DotNetCore.Utility; @@ -21,99 +23,83 @@ public static class ObjectExtensions /// private static readonly ConcurrentDictionary FieldCache = new(); + + /// - /// 将对象转换为 Dictionary 类型。 + /// 判断对象是否为基础类型。 /// - /// 要转换的对象。 - /// 最大递归深度,以控制嵌套对象的转换层数。 - /// 包含对象属性和值的字典。 - public static Dictionary ToDictionary(this object obj, int maxDepth = 3) + public static bool IsPrimitiveType(object obj) { - return ToDictionaryRecursive(obj, maxDepth); + if (obj == null) return false; + + Type type = obj.GetType(); + return type.IsPrimitive || type.IsValueType || type == typeof(string); } /// - /// 递归地将对象转换为 Dictionary。 + /// 判断对象是否为集合类型(排除字符串)。 /// - /// 要转换的对象。 - /// 当前递归深度。 - /// 包含对象属性和值的字典。 - private static Dictionary ToDictionaryRecursive(object obj, int depth) + public static bool IsCollectionType(object obj) { - // 检查对象是否为 null 或递归深度是否小于 0,若是则返回 null - if (obj == null || depth < 0) + if (obj == null) return false; + + return obj is IEnumerable && !(obj is string); + } + + /// + /// 判断对象是否为复杂类型。 + /// + public static bool IsComplexType(object obj) + { + if (obj == null) return false; + + Type type = obj.GetType(); + // 非基础类型且非集合类型的对象即为复杂类型 + return !IsPrimitiveType(obj) && !IsCollectionType(obj); + } + + public static object ToDictionaryOrList(this object obj) + { + if (obj == null) + { return null; - - var dictionary = new Dictionary(); - var type = obj.GetType(); - - // 获取对象的属性信息,若类型已缓存则直接使用缓存中的信息 - var properties = PropertyCache.GetOrAdd(type, t => t.GetProperties(BindingFlags.Public | BindingFlags.Instance)); - foreach (var property in properties) - { - var value = property.GetValue(obj); - var imagesAttribute = property.GetCustomAttribute(); - if (imagesAttribute != null) - { - string keyName = property.Name; - if (!string.IsNullOrEmpty(imagesAttribute.FieldName)) - { - keyName = imagesAttribute.FieldName; - } - dictionary[keyName] = $"[Images]{value.ToString()}"; - continue; - } - // 获取属性值并递归转换 - - dictionary[property.Name] = ConvertValue(value, depth - 1); } - - // 获取对象的字段信息,若类型已缓存则直接使用缓存中的信息 - //var fields = FieldCache.GetOrAdd(type, t => t.GetFields(BindingFlags.Public | BindingFlags.Instance)); - //foreach (var field in fields) - //{ - // //var imagesAttribute = field.GetCustomAttribute(); - // //if (imagesAttribute != null) - // //{ - // // Console.WriteLine($"带有 [Images] 特性的成员:{field.Name}"); - // // Console.WriteLine($"FieldName 属性值:{imagesAttribute?.FieldName}"); - // //} - // // 获取字段值并递归转换 - // var value = field.GetValue(obj); - // dictionary[field.Name] = ConvertValue(value, depth - 1); - //} - - return dictionary; - } - - /// - /// 将属性或字段值转换为适当的类型。 - /// - /// 要转换的值。 - /// 当前递归深度。 - /// 转换后的值,可能是基本类型、字典或列表。 - private static object ConvertValue(object value, int depth) - { - if (value == null) return null; - - // 检查是否为集合类型(非字符串),如果是则递归转换集合中的每个元素 - if (value is IEnumerable enumerable && !(value is string)) + Type type = obj.GetType(); + //判断对象是否是基础类型的 + if (type.IsPrimitive || type.IsValueType || type == typeof(string)) { - var list = new List(); + return type; + } + //判断对象是否是数组类型的 + else if (obj is IEnumerable enumerable && !(obj is string)) + { + List list = new List(); foreach (var item in enumerable) { - list.Add(ConvertValue(item, depth - 1)); + list.Add(ToDictionaryOrList(item)); } return list; } - - // 如果是类且非字符串,则递归转换为字典类型 - if (value.GetType().IsClass && !(value is string)) + else { - return ToDictionaryRecursive(value, depth - 1); - } + //object类型 + Dictionary keyValuePairs = new Dictionary(); + var properties = PropertyCache.GetOrAdd(type, t => t.GetProperties(BindingFlags.Public | BindingFlags.Instance)); + foreach (var property in properties) + { - // 对于基本类型或字符串,直接返回值 - return value; + var imagesAttribute = property.GetCustomAttribute(); + var objstr = property.GetValue(obj); + //对象中判断字段是否是数组 + if (objstr is IEnumerable enumerable1 && !(objstr is string)) + { + keyValuePairs[property.Name] = ToDictionaryOrList(objstr); + continue; + } + keyValuePairs[property.Name] = objstr; + } + return keyValuePairs; + } } + } \ No newline at end of file