提交代码

This commit is contained in:
zpc 2024-11-01 01:08:00 +08:00
parent bfed45c3e4
commit e067994af9
36 changed files with 578 additions and 634 deletions

View File

@ -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)
{
}
/// <summary>
///
/// </summary>
/// <returns></returns>
[HttpGet]
public async Task<List<EpgCategoryDto>> GetHomeInfo()
{
EpgBLL epgBLL = new EpgBLL(ServiceProvider);
return await epgBLL.GetHomeInfo();
}
}

View File

@ -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;
/// <summary>
@ -203,6 +205,29 @@ namespace CloudGaming.Code.AppExtend
return appRequestInfo;
}
}
private bool? isChecking;
/// <summary>
/// 是否在审核模式中
/// </summary>
public bool IsChecking
{
get
{
if (isChecking == null)
{
string key = $"App:Config:{AppRequestInfo.Platform}:{AppRequestInfo.Channel}:{AppRequestInfo.Version}";
isChecking = RedisCache.StringGet<bool?>(key);
if (isChecking == null)
{
isChecking = new AppConfigBLL(this._serviceProvider).GetAppIsChecking();
RedisCache.StringSet(key, isChecking, new TimeSpan(1, 0, 0));
}
}
return isChecking ?? false;
}
}
#endregion
}
}

View File

@ -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<string, object> keyValuePairs = new Dictionary<string, object>();
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<Dictionary<string, object>> baseResponse = new BaseResponse<Dictionary<string, object>>(ResonseCode.Success, "", dic);
BaseResponse<object> baseResponse = new BaseResponse<object>(ResonseCode.Success, "", dic);
objectResult.Value = baseResponse;
}
else
{
objectResult.Value = dic;
}
//if (objectResult.Value is IEnumerable enumerable)
//{
// var list = objectResult.Value.ToListDictionary(5);
// BaseResponse<List<Dictionary<string, object>>> baseResponse = new BaseResponse<List<Dictionary<string, object>>>(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<Dictionary<string, object>> baseResponse = new BaseResponse<Dictionary<string, object>>(ResonseCode.Success, "", dic);
// objectResult.Value = baseResponse;
//}
//else
//{
// objectResult.Value = dic;
//}
//objectResult.Value.to
//FindImagesAttributes(objectResult.Value);

View File

@ -54,6 +54,17 @@ namespace CloudGaming.Code.Cache
public List<T_App_Config> AppConfigList => GetCacheList(ref _appConfigCache);
#endregion
#region
private CommonDataEntityCache<T_Epg_CategoryCfg>? _epgCategoryCfg;
/// <summary>
/// 菜单分类
/// </summary>
public List<T_Epg_CategoryCfg> EpgCategoryCfg => GetCacheList(ref _epgCategoryCfg, it => it.IsOnline);
#endregion
}
/// <summary>

View File

@ -23,14 +23,25 @@ namespace CloudGaming.Code.Config
/// <returns></returns>
public async Task<AppConfigDto> 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;
}
/// <summary>
///
/// </summary>
/// <returns></returns>
public bool GetAppIsChecking()
{
var list = Cache.AppConfigList.ToList();
return list.GetAppIsChecking(AppRequestInfo);
}
}
}

View File

@ -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;
}

View File

@ -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
{
/// <summary>
///
/// </summary>
public class EpgBLL : CloudGamingBase
{
public EpgBLL(IServiceProvider serviceProvider) : base(serviceProvider)
{
}
/// <summary>
///
/// </summary>
/// <returns></returns>
public async Task<List<EpgCategoryDto>> 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<EpgCategoryDto> epgCategoryDtos = new List<EpgCategoryDto>();
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<EpgInfo>()
{
},
};
if (it.Id == list[0].Id)
{
epgCategoryDto.EpgList.Add(new EpgInfo() { CornerIcon = 1, IdName = "111" });
}
epgCategoryDtos.Add(epgCategoryDto);
});
return epgCategoryDtos;
}
/// <summary>
///
/// </summary>
/// <param name="idName"></param>
/// <returns></returns>
public List<T_Epg_CategoryCfg> 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<T_Epg_CategoryCfg>();
}
}
}

View File

@ -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<CloudGamingUserContext>();
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<CloudGamingUserContext>();
//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.

View File

@ -0,0 +1,38 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace CloudGaming.DtoModel.Epg
{
/// <summary>
///
/// </summary>
public class EpgCategoryDto
{
public EpgCategoryDto() { }
/// <summary>
/// 菜单栏目名称
/// </summary>
public string CategoryName { get; set; }
/// <summary>
/// 菜单栏目标识
/// </summary>
public string CategoryType { get; set; }
/// <summary>
/// 是快速启动弹出窗口
/// </summary>
public bool IsQuickStartPopUp { get; set; }
/// <summary>
/// 菜单列表
/// </summary>
public List<EpgInfo> EpgList { get; set; }
/// <summary>
/// 首页展示数量
/// </summary>
public int ShowNum_Index { get; set; }
}
}

View File

@ -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
{
/// <summary>
/// 首页中游戏类型
/// </summary>
public class EpgInfo
{
public EpgInfo() { }
/// <summary>
/// 菜单编号
/// </summary>
public int EpgId { get; set; }
/// <summary>
/// 资源类型4游戏
/// </summary>
public int ResType { get; set; }
/// <summary>
/// 资源Id参数 如果资源类型为游戏游戏Id
/// </summary>
public string ResId { get; set; }
/// <summary>
/// 代码标识
/// </summary>
public string IdName { get; set; }
/// <summary>
/// 展示图片信息,长宽
/// </summary>
[Images]
public int Pic { get; set; }
/// <summary>
/// 展示图片信息,长宽
/// </summary>
[Images]
public int Pic2 { get; set; }
/// <summary>
/// 展示图片信息,长宽
/// </summary>
[Images]
public int Pic3 { get; set; }
/// <summary>
/// 展示游戏Iocn信息长宽
/// </summary>
[Images]
public int GameIconImage { get; set; }
/// <summary>
/// 标题
/// </summary>
public string Title { get; set; }
/// <summary>
/// 标题2
/// </summary>
public string Title2 { get; set; }
/// <summary>
/// 评分,0.0
/// </summary>
public string Score { get; set; }
/// <summary>
/// 角标图片信息
/// </summary>
[Images]
public int CornerIcon { get; set; }
}
}

View File

@ -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
/// </summary>
public virtual DbSet<T_Epg_CategoryCfg> T_Epg_CategoryCfg { get; set; }
/// <summary>
/// Epg分组配置表
/// </summary>
public virtual DbSet<T_Epg_CategoryCfg_Export> T_Epg_CategoryCfg_Export { get; set; }
/// <summary>
/// Epg配置表
/// </summary>
public virtual DbSet<T_Epg_Cfg> T_Epg_Cfg { get; set; }
/// <summary>
/// Epg配置表
/// </summary>
public virtual DbSet<T_Epg_Cfg_Export> T_Epg_Cfg_Export { get; set; }
/// <summary>
/// 悬浮球配置
/// </summary>
@ -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<T_Epg_CategoryCfg>(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<T_Epg_CategoryCfg_Export>(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<T_Epg_Cfg>(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<T_Epg_Cfg_Export>(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("")

View File

@ -1,4 +1,4 @@
using System;
using System;
namespace CloudGaming.Model.DbSqlServer.Db_Phone;
@ -45,4 +45,8 @@ public partial class T_AvatarFrame: MultiTenantEntity
/// </summary>
public virtual string NameColor { get; set; } = null!;
}
/// <summary>
/// 所属租户
/// </summary>
public override Guid TenantId { get; set; }
}

View File

@ -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
/// <summary>
/// epg分组Id
/// </summary>
public virtual int EpgCategory { get; set; }
public virtual int Id { get; set; }
/// <summary>
/// epg父组Id, 0无
@ -34,31 +34,6 @@ public partial class T_Epg_CategoryCfg: MultiTenantEntity
/// </summary>
public virtual bool IsOnline { get; set; }
/// <summary>
/// 扩展字段1
/// </summary>
public virtual string? Extend1 { get; set; }
/// <summary>
/// 扩展字段2
/// </summary>
public virtual string? Extend2 { get; set; }
/// <summary>
/// 扩展字段3
/// </summary>
public virtual string? Extend3 { get; set; }
/// <summary>
/// 上线平台
/// </summary>
public virtual string? OnlinePlatform { get; set; }
/// <summary>
/// 首页展示数量
/// </summary>
public virtual int ShowNum_Index { get; set; }
/// <summary>
/// 代码标识
/// </summary>
@ -67,37 +42,40 @@ public partial class T_Epg_CategoryCfg: MultiTenantEntity
/// <summary>
/// 图片-预留
/// </summary>
public virtual int ImageId { get; set; }
public virtual int? ImageId { get; set; }
/// <summary>
/// 图片-预留
/// </summary>
public virtual int ImageId2 { get; set; }
/// <summary>
/// 上线渠道,0不限制
/// </summary>
public virtual string? OnlineBossId { get; set; }
public virtual int? ImageId2 { get; set; }
/// <summary>
/// 快速启动弹窗
/// </summary>
public virtual bool IsQuickStartPopUp { get; set; }
public virtual bool? IsQuickStartPopUp { get; set; }
/// <summary>
/// 联机游戏快速启动弹窗
/// 上线平台
/// </summary>
public virtual bool IsOnlineQuickStartPopUp { get; set; }
public virtual string? Platform { get; set; }
/// <summary>
/// 审核模式下不显示
/// 首页展示数量
/// </summary>
public virtual bool? IsNotCheckingShow { get; set; }
public virtual int? ShowNumIndex { get; set; }
/// <summary>
/// 非审核(正常)模式是否关闭
/// 上线渠道,0不限制
/// </summary>
public virtual int IsStandardClose { get; set; }
}
public virtual string? Channel { get; set; }
/// <summary>
/// 显示状态。0全部显示1审核模式下不显示2正常模式下不显示审核显示
/// </summary>
public virtual int ShowStatus { get; set; }
/// <summary>
/// 所属租户
/// </summary>
public override Guid TenantId { get; set; }
}

View File

@ -1,80 +0,0 @@

namespace CloudGaming.Model.DbSqlServer.Db_Phone;
/// <summary>
/// Epg分组配置表
/// </summary>
public partial class T_Epg_CategoryCfg_Export: MultiTenantEntity
{
public T_Epg_CategoryCfg_Export() { }
/// <summary>
/// epg分组Id
/// </summary>
public virtual int EpgCategory { get; set; }
/// <summary>
/// epg父组Id, 0无
/// </summary>
public virtual int EpgParentCategory { get; set; }
/// <summary>
/// 分组名称
/// </summary>
public virtual string? Name { get; set; }
/// <summary>
/// 排序-正序
/// </summary>
public virtual int OrderId { get; set; }
/// <summary>
/// 是否启用
/// </summary>
public virtual bool IsOnline { get; set; }
/// <summary>
/// 扩展字段1
/// </summary>
public virtual string? Extend1 { get; set; }
/// <summary>
/// 扩展字段2
/// </summary>
public virtual string? Extend2 { get; set; }
/// <summary>
/// 扩展字段3
/// </summary>
public virtual string? Extend3 { get; set; }
/// <summary>
/// 上线平台
/// </summary>
public virtual string? OnlinePlatform { get; set; }
/// <summary>
/// 首页展示数量
/// </summary>
public virtual int ShowNum_Index { get; set; }
/// <summary>
/// 代码标识
/// </summary>
public virtual string? IdName { get; set; }
/// <summary>
/// 图片-预留
/// </summary>
public virtual int ImageId { get; set; }
/// <summary>
/// 图片-预留
/// </summary>
public virtual int ImageId2 { get; set; }
/// <summary>
/// 上线渠道,0不限制
/// </summary>
public virtual string? OnlineBossId { get; set; }
}

View File

@ -59,11 +59,6 @@ public partial class T_Epg_Cfg: MultiTenantEntity
/// </summary>
public virtual string? ImageResStyle { get; set; }
/// <summary>
/// 视频地址
/// </summary>
public virtual string? VideoUrl { get; set; }
/// <summary>
/// 是否启用
/// </summary>
@ -82,27 +77,11 @@ public partial class T_Epg_Cfg: MultiTenantEntity
/// <summary>
/// 更新时间
/// </summary>
public virtual DateTime UpdateTime { get; set; }
public virtual DateTime? UpdateTime { get; set; }
/// <summary>
/// 扩展字段1
/// 代码标识
/// </summary>
public virtual string? Extend1 { get; set; }
/// <summary>
/// 扩展字段2
/// </summary>
public virtual string? Extend2 { get; set; }
/// <summary>
/// 扩展字段3
/// </summary>
public virtual string? Extend3 { get; set; }
public virtual string? OnlinePlatform { get; set; }
public virtual int SpecialId { get; set; }
public virtual string? IdName { get; set; }
/// <summary>
@ -110,18 +89,6 @@ public partial class T_Epg_Cfg: MultiTenantEntity
/// </summary>
public virtual int ImageId2 { get; set; }
public virtual string? OnlineBossId { get; set; }
/// <summary>
/// 视频标识
/// </summary>
public virtual string? VideoIdentification { get; set; }
/// <summary>
/// 联机快速启动
/// </summary>
public virtual bool IsOnlineQuickStartPopUp { get; set; }
/// <summary>
/// 启用时间
/// </summary>
@ -148,12 +115,22 @@ public partial class T_Epg_Cfg: MultiTenantEntity
public virtual string? Continent { get; set; }
/// <summary>
/// 非审核(正常)模式是否关闭
/// 渠道
/// </summary>
public virtual int IsStandardClose { get; set; }
public virtual string? Channel { get; set; }
/// <summary>
/// 审核模式是否关闭
/// 平台安卓还是ios
/// </summary>
public virtual int IsCheckingClose { get; set; }
}
public virtual string? Platform { get; set; }
/// <summary>
/// 创建时间
/// </summary>
public virtual DateTime? CreateTime { get; set; }
/// <summary>
/// 所属租户
/// </summary>
public override Guid TenantId { get; set; }
}

View File

@ -1,126 +0,0 @@
using System;
namespace CloudGaming.Model.DbSqlServer.Db_Phone;
/// <summary>
/// Epg配置表
/// </summary>
public partial class T_Epg_Cfg_Export: MultiTenantEntity
{
public T_Epg_Cfg_Export() { }
/// <summary>
/// 标识
/// </summary>
public virtual int EpgId { get; set; }
/// <summary>
/// epg分组
/// </summary>
public virtual int EpgCategory { get; set; }
/// <summary>
/// 资源Id
/// </summary>
public virtual string? ResId { get; set; }
/// <summary>
/// 资源类型
/// </summary>
public virtual int ResType { get; set; }
/// <summary>
/// 资源参数
/// </summary>
public virtual string? ResParams { get; set; }
/// <summary>
/// 排序-正序
/// </summary>
public virtual int OrderId { get; set; }
/// <summary>
/// 标题
/// </summary>
public virtual string? Title { get; set; }
/// <summary>
/// 标题2
/// </summary>
public virtual string? Title2 { get; set; }
/// <summary>
/// 图片
/// </summary>
public virtual int ImageId { get; set; }
/// <summary>
/// 使用原始资源图样式n_n
/// </summary>
public virtual string? ImageResStyle { get; set; }
/// <summary>
/// 视频地址
/// </summary>
public virtual string? VideoUrl { get; set; }
/// <summary>
/// 是否启用
/// </summary>
public virtual bool IsOnline { get; set; }
/// <summary>
/// 角标
/// </summary>
public virtual int CornerIconId { get; set; }
/// <summary>
/// 展示样式more
/// </summary>
public virtual string? StyleType { get; set; }
/// <summary>
/// 更新时间
/// </summary>
public virtual DateTime UpdateTime { get; set; }
/// <summary>
/// 扩展字段1
/// </summary>
public virtual string? Extend1 { get; set; }
/// <summary>
/// 扩展字段2
/// </summary>
public virtual string? Extend2 { get; set; }
/// <summary>
/// 扩展字段3
/// </summary>
public virtual string? Extend3 { get; set; }
/// <summary>
/// 上线平台
/// </summary>
public virtual string? OnlinePlatform { get; set; }
/// <summary>
/// 特殊标志
/// </summary>
public virtual int SpecialId { get; set; }
/// <summary>
/// 代码标识
/// </summary>
public virtual string? IdName { get; set; }
/// <summary>
/// 图片2
/// </summary>
public virtual int ImageId2 { get; set; }
/// <summary>
/// 上线渠道0不限
/// </summary>
public virtual string? OnlineBossId { get; set; }
}

View File

@ -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
/// </summary>
public virtual DateTime UpdateTime { get; set; }
/// <summary>
/// 渠道号id
/// </summary>
public virtual string BossId { get; set; } = null!;
}
/// <summary>
/// 所属租户
/// </summary>
public override Guid TenantId { get; set; }
}

View File

@ -166,4 +166,9 @@ public partial class T_GameCBT: MultiTenantEntity
/// 启动提示
/// </summary>
public virtual string? FriendlyTips { get; set; }
}
/// <summary>
/// 所属租户
/// </summary>
public override Guid TenantId { get; set; }
}

View File

@ -31,4 +31,9 @@ public partial class T_GameInputSetting: MultiTenantEntity
/// 是否显示切换键盘按钮
/// </summary>
public virtual bool IsToggleKeyboard { get; set; }
}
/// <summary>
/// 所属租户
/// </summary>
public override Guid TenantId { get; set; }
}

View File

@ -41,4 +41,9 @@ public partial class T_GameKeyPlan_CBT: MultiTenantEntity
/// 方案类型1键盘 2手柄
/// </summary>
public virtual int PlanType { get; set; }
}
/// <summary>
/// 所属租户
/// </summary>
public override Guid TenantId { get; set; }
}

View File

@ -93,4 +93,9 @@ public partial class T_GamePressKey: MultiTenantEntity
/// 按键分组,手柄还是键盘
/// </summary>
public virtual int? GamePressKeyGroupBy { get; set; }
}
/// <summary>
/// 所属租户
/// </summary>
public override Guid TenantId { get; set; }
}

View File

@ -58,4 +58,9 @@ public partial class T_GamePressKeyPlan: MultiTenantEntity
/// 是否启用
/// </summary>
public virtual bool? IsEnable { get; set; }
}
/// <summary>
/// 所属租户
/// </summary>
public override Guid TenantId { get; set; }
}

View File

@ -34,4 +34,9 @@ public partial class T_GameShow: MultiTenantEntity
public virtual DateTime? CreateTime { get; set; }
public virtual string? Desc { get; set; }
}
/// <summary>
/// 所属租户
/// </summary>
public override Guid TenantId { get; set; }
}

View File

@ -63,4 +63,9 @@ public partial class T_Game_DiscountCfg: MultiTenantEntity
/// 每小时折扣VIP蘑菇币费用
/// </summary>
public virtual int DiscountMoguNumHourVip { get; set; }
}
/// <summary>
/// 所属租户
/// </summary>
public override Guid TenantId { get; set; }
}

View File

@ -61,4 +61,9 @@ public partial class T_KeyboardSetting: MultiTenantEntity
/// 是否按下锁定
/// </summary>
public virtual bool IsPressLock { get; set; }
}
/// <summary>
/// 所属租户
/// </summary>
public override Guid TenantId { get; set; }
}

View File

@ -58,4 +58,9 @@ public partial class T_PlanKey_CBT: MultiTenantEntity
public virtual DateTime UpdateTime { get; set; }
public virtual string? Remark { get; set; }
}
/// <summary>
/// 所属租户
/// </summary>
public override Guid TenantId { get; set; }
}

View File

@ -92,4 +92,9 @@ public partial class T_Popup: MultiTenantEntity
/// 扩展参数1
/// </summary>
public virtual string? Extend1 { get; set; }
}
/// <summary>
/// 所属租户
/// </summary>
public override Guid TenantId { get; set; }
}

View File

@ -55,4 +55,9 @@ public partial class T_PopupBtn: MultiTenantEntity
/// 延迟几秒显示按钮
/// </summary>
public virtual int? DelaySecond { get; set; }
}
/// <summary>
/// 所属租户
/// </summary>
public override Guid TenantId { get; set; }
}

View File

@ -25,4 +25,9 @@ public partial class T_SevenDaySignIn_AwardCBT: MultiTenantEntity
public virtual DateTime UpdateTime { get; set; }
public virtual string? Remark { get; set; }
}
/// <summary>
/// 所属租户
/// </summary>
public override Guid TenantId { get; set; }
}

View File

@ -27,4 +27,9 @@ public partial class T_SignTypes: MultiTenantEntity
public virtual DateTime? CreateTime { get; set; }
public virtual string? Desc { get; set; }
}
/// <summary>
/// 所属租户
/// </summary>
public override Guid TenantId { get; set; }
}

View File

@ -47,4 +47,9 @@ public partial class T_SysMessage: MultiTenantEntity
public virtual DateTime EndTime { get; set; }
public virtual int ReceiveType { get; set; }
}
/// <summary>
/// 所属租户
/// </summary>
public override Guid TenantId { get; set; }
}

View File

@ -24,4 +24,9 @@ public partial class T_UITypes: MultiTenantEntity
public virtual DateTime? CreateTime { get; set; }
public virtual string? Desc { get; set; }
}
/// <summary>
/// 所属租户
/// </summary>
public override Guid TenantId { get; set; }
}

View File

@ -45,4 +45,9 @@ public partial class T_UIs: MultiTenantEntity
/// 放大倍数
/// </summary>
public virtual double Scale { get; set; }
}
/// <summary>
/// 所属租户
/// </summary>
public override Guid TenantId { get; set; }
}

View File

@ -30,4 +30,9 @@ public partial class T_Videos: MultiTenantEntity
public virtual DateTime? CreateTime { get; set; }
public virtual string? Desc { get; set; }
}
/// <summary>
/// 所属租户
/// </summary>
public override Guid TenantId { get; set; }
}

View File

@ -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);
}
/// <summary>
/// 获取一个key的对象
/// </summary>
/// <typeparam name="T"></typeparam>
/// <param name="key"></param>
/// <returns></returns>
public static T? StringGet<T>(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<T>(value);
}
}
}

View File

@ -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
/// </summary>
private static readonly ConcurrentDictionary<Type, FieldInfo[]> FieldCache = new();
/// <summary>
/// 将对象转换为 Dictionary<string, object> 类型。
/// 判断对象是否为基础类型。
/// </summary>
/// <param name="obj">要转换的对象。</param>
/// <param name="maxDepth">最大递归深度,以控制嵌套对象的转换层数。</param>
/// <returns>包含对象属性和值的字典。</returns>
public static Dictionary<string, object> 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);
}
/// <summary>
/// 递归地将对象转换为 Dictionary<string, object>
/// 判断对象是否为集合类型(排除字符串)
/// </summary>
/// <param name="obj">要转换的对象。</param>
/// <param name="depth">当前递归深度。</param>
/// <returns>包含对象属性和值的字典。</returns>
private static Dictionary<string, object> 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);
}
/// <summary>
/// 判断对象是否为复杂类型。
/// </summary>
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<string, object>();
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<ImagesAttribute>();
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<ImagesAttribute>();
// //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;
}
/// <summary>
/// 将属性或字段值转换为适当的类型。
/// </summary>
/// <param name="value">要转换的值。</param>
/// <param name="depth">当前递归深度。</param>
/// <returns>转换后的值,可能是基本类型、字典或列表。</returns>
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<object>();
return type;
}
//判断对象是否是数组类型的
else if (obj is IEnumerable enumerable && !(obj is string))
{
List<object> list = new List<object>();
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<string, object> keyValuePairs = new Dictionary<string, object>();
var properties = PropertyCache.GetOrAdd(type, t => t.GetProperties(BindingFlags.Public | BindingFlags.Instance));
foreach (var property in properties)
{
// 对于基本类型或字符串,直接返回值
return value;
var imagesAttribute = property.GetCustomAttribute<ImagesAttribute>();
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;
}
}
}