diff --git a/src/CloudGaming/Code/CloudGaming.Code/AppExtend/AppRequestConfig.cs b/src/CloudGaming/Code/CloudGaming.Code/AppExtend/AppRequestConfig.cs
index 425a394..af2e9ba 100644
--- a/src/CloudGaming/Code/CloudGaming.Code/AppExtend/AppRequestConfig.cs
+++ b/src/CloudGaming/Code/CloudGaming.Code/AppExtend/AppRequestConfig.cs
@@ -4,6 +4,7 @@ using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
+using System.Threading.Channels;
using System.Threading.Tasks;
namespace CloudGaming.Code.AppExtend
@@ -25,12 +26,12 @@ namespace CloudGaming.Code.AppExtend
{
if (!(httpRequest?.Headers?.TryGetValue("Channel", out var _channel) ?? false))
{
- _channel = "27001";
+ _channel = "ps_001";
}
channel = _channel;
if (string.IsNullOrEmpty(channel))
{
- channel = "27001";
+ channel = "ps_001";
}
}
return channel;
@@ -48,9 +49,30 @@ namespace CloudGaming.Code.AppExtend
{
if (string.IsNullOrEmpty(platform))
{
+
if (!(httpRequest?.Headers.TryGetValue("Platform", out var _platform) ?? false))
{
- _platform = "android";
+ _platform = "";
+ }
+ if (string.IsNullOrEmpty(_platform))
+ {
+
+ if (Channel.StartsWith("ps_"))
+ {
+ _platform = AppPlatform.android.ToString();
+ }
+ else if (Channel.StartsWith("ios_"))
+ {
+ _platform = AppPlatform.ios.ToString();
+ }
+ else if (Channel.StartsWith("cs_"))
+ {
+ _platform = AppPlatform.car.ToString();
+ }
+ else if (Channel.StartsWith("ts_"))
+ {
+ _platform = AppPlatform.tv.ToString();
+ }
}
platform = _platform;
}
diff --git a/src/CloudGaming/Code/CloudGaming.Code/Cache/CloudGamingCache.cs b/src/CloudGaming/Code/CloudGaming.Code/Cache/CloudGamingCache.cs
index 63b6b50..e3beee5 100644
--- a/src/CloudGaming/Code/CloudGaming.Code/Cache/CloudGamingCache.cs
+++ b/src/CloudGaming/Code/CloudGaming.Code/Cache/CloudGamingCache.cs
@@ -100,7 +100,7 @@ public class CloudGamingCache
{
if (gameEntityCache == null)
{
- gameEntityCache = new GameEntityCache(_gamingBase.Dao, _gamingBase.RedisCache, _gamingBase.Mapper, _gamingBase.AppConfig, _gamingBase.AppRequestInfo.Language);
+ gameEntityCache = new GameEntityCache(_gamingBase.Dao, _gamingBase.RedisCache, _gamingBase.Mapper, _gamingBase.AppConfig, _gamingBase.AppRequestInfo.Language, _gamingBase.AppRequestInfo.Platform);
}
return gameEntityCache;
}
@@ -329,9 +329,13 @@ public static class CloudGamingCacheExtend
cloudGamingBase.Cache.AppConfigCache.ClearLocalData();
cloudGamingBase.Cache.ProductCacheEntityCache.ClearLocalData();
cloudGamingBase.Cache.AppImageCache.ClearLocalData();
- cloudGamingBase.Cache.GameEntityCache.ClearLocalData();
+ //cloudGamingBase.Cache.GameEntityCache.ClearLocalData();
cloudGamingBase.Cache.RedemptionCodeEntityCache.ClearLocalData();
cloudGamingBase.Cache.SevenDayEntityCache.ClearLocalData();
+ var gameEntityCache = new GameEntityCache(cloudGamingBase.Dao, cloudGamingBase.RedisCache, cloudGamingBase.Mapper, cloudGamingBase.AppConfig, cloudGamingBase.AppRequestInfo.Language, AppPlatform.android.ToString());
+ gameEntityCache.ClearData();
+ var gameEntityCache1 = new GameEntityCache(cloudGamingBase.Dao, cloudGamingBase.RedisCache, cloudGamingBase.Mapper, cloudGamingBase.AppConfig, cloudGamingBase.AppRequestInfo.Language, AppPlatform.car.ToString());
+ gameEntityCache1.ClearData();
}
diff --git a/src/CloudGaming/Code/CloudGaming.Code/Cache/Special/GameEntityCache.cs b/src/CloudGaming/Code/CloudGaming.Code/Cache/Special/GameEntityCache.cs
index d6cf4c3..3a5a01c 100644
--- a/src/CloudGaming/Code/CloudGaming.Code/Cache/Special/GameEntityCache.cs
+++ b/src/CloudGaming/Code/CloudGaming.Code/Cache/Special/GameEntityCache.cs
@@ -19,18 +19,23 @@ namespace CloudGaming.Code.Cache.Special
///
/// 游戏缓存表
///
- public class GameEntityCache(DAO dao, IDatabase database, IMapper mapper, AppConfig appConfig, string language) : CommonDataEntityCache(GameEntityCache.GameEntityCacheLock, 60 * 60 * 24 * 7), ICacheClearLocalData
+ public class GameEntityCache(DAO dao, IDatabase database, IMapper mapper, AppConfig appConfig, string language, string platform) : CommonDataEntityCache(GameEntityCache.GameEntityCacheLock, 60 * 60 * 24 * 7), ICacheClearLocalData
{
public static object GameEntityCacheLock;
- public override string key => $"{appConfig.Identifier}:game:gameInfo:{language}";
+ ///
+ ///
+ ///
+ public override string key => $"{appConfig.Identifier}:game:gameInfo:{platform}:{language}";
- public string locaKey => $"lock:gameInfo:{language}";
- public string RedisKey => $"cache:game:gameInfo:{language}";
+ public string locaKey => $"lock:gameInfo:{platform}:{language}";
+ public string RedisKey => $"cache:game:gameInfo:{platform}:{language}";
public override List GetDataList()
{
+ //dao.DaoPhone.Context.T_GameCBT.AsNoTracking().Where(it => it.IsOnline&&it.OnlinePlatform==)
var gameCbtList = dao.DaoPhone.Context.T_GameCBT.AsNoTracking().Where(it => it.IsOnline).ToList() ?? new List();
+
var gameListDict = dao.DaoGame.Context.T_Game_List.AsNoTracking().ToDictionary(g => g.GameId);
var gameChildList = dao.DaoGame.Context.T_Game_ChildList.AsNoTracking().ToList();
var gameTypesDict = dao.DaoGame.Context.T_Game_Types.AsNoTracking().ToDictionary(type => type.TypeId) ?? new Dictionary();
@@ -72,48 +77,96 @@ namespace CloudGaming.Code.Cache.Special
}
}
var gameLanguageDic = AppLanguage.GetAppLanguageGame(appConfig, language);
+
var faker = new Faker("zh_CN");
- var gameInfos = gameCbtList
- .Where(gameCbt => gameListDict.ContainsKey(gameCbt.GameId))
- .Select(gameCbt =>
+ List gameInfos = new List();
+ foreach (var gameId in gameListDict.Keys)
+ {
+ var gameCbt = gameCbtList.FirstOrDefault(it => it.GameId == gameId && it.OnlinePlatform == platform);
+ if (gameCbt == null)
{
- var game = gameListDict[gameCbt.GameId];
- var gameInfo = mapper.Map(gameCbt);
- game.ToGameInfo(gameInfo);
- //game.GameName
- gameInfo.GameType = GetGameExtendedAttributes(gameChildList, gameCbt.GameId, 1, gameTypesDict);
- gameInfo.GameTags = GetGameExtendedAttributes(gameChildList, gameCbt.GameId, 2, gameTagsDict);
- if (!gameUserShare.TryGetValue(gameCbt.GameId, out string NickName))
- {
- string chineseName = faker.Internet.UserName();
- NickName = chineseName;
- }
- gameInfo.GameShare = $"{NickName}";
- var gameLanguageInfo = gameLanguageDic.GetAppGameLanguage(gameInfo);
- if (gameLanguageInfo != null)
- {
- gameInfo.GameName = gameLanguageInfo.GameName;
- gameInfo.GameIntroduce = gameLanguageInfo.GameIntroduce;
- gameInfo.GameShare = gameLanguageInfo.GameShare;
- }
- gameInfo.GameIntroduce = $"{gameInfo.GameIntroduce}
";
- gameInfo.GameShareUserIcon = 90001;
- if (gameInfo.ConsumeDiamondNumHour == 0)
- {
- gameInfo.ConsumeDiamondNumHour = defaultConsumeDiamondNumHour;
- }
- if (gameInfo.ConsumeDiamondNumHour > 0)
- {
- gameInfo.GameDetailsofCharges = $"游戏资费:游玩按分钟计费,{gameInfo.ConsumeDiamondNumHour}钻石/小时。";
- }
- else
- {
- gameInfo.GameDetailsofCharges = $"游戏免费";
- }
- //gameInfo.GameIntroduce
- return gameInfo;
- })
- .ToList();
+ gameCbt = gameCbtList.FirstOrDefault(it => it.GameId == gameId && string.IsNullOrEmpty(it.OnlinePlatform));
+ }
+ if (gameCbt == null)
+ {
+ continue;
+ }
+ var game = gameListDict[gameCbt.GameId];
+ var gameInfo = mapper.Map(gameCbt);
+ game.ToGameInfo(gameInfo);
+ //game.GameName
+ gameInfo.GameType = GetGameExtendedAttributes(gameChildList, gameCbt.GameId, 1, gameTypesDict);
+ gameInfo.GameTags = GetGameExtendedAttributes(gameChildList, gameCbt.GameId, 2, gameTagsDict);
+ if (!gameUserShare.TryGetValue(gameCbt.GameId, out string NickName))
+ {
+ string chineseName = faker.Internet.UserName();
+ NickName = chineseName;
+ }
+ gameInfo.GameShare = $"{NickName}";
+ var gameLanguageInfo = gameLanguageDic.GetAppGameLanguage(gameInfo);
+ if (gameLanguageInfo != null)
+ {
+ gameInfo.GameName = gameLanguageInfo.GameName;
+ gameInfo.GameIntroduce = gameLanguageInfo.GameIntroduce;
+ gameInfo.GameShare = gameLanguageInfo.GameShare;
+ }
+ gameInfo.GameIntroduce = $"{gameInfo.GameIntroduce}
";
+ gameInfo.GameShareUserIcon = 90001;
+ if (gameInfo.ConsumeDiamondNumHour == 0)
+ {
+ gameInfo.ConsumeDiamondNumHour = defaultConsumeDiamondNumHour;
+ }
+ if (gameInfo.ConsumeDiamondNumHour > 0)
+ {
+ gameInfo.GameDetailsofCharges = $"游戏资费:游玩按分钟计费,{gameInfo.ConsumeDiamondNumHour}钻石/小时。";
+ }
+ else
+ {
+ gameInfo.GameDetailsofCharges = $"游戏免费";
+ }
+ gameInfos.Add(gameInfo);
+ }
+ //var gameInfos = gameCbtList
+ // .Where(gameCbt => gameListDict.ContainsKey(gameCbt.GameId))
+ // .Select(gameCbt =>
+ // {
+ // var game = gameListDict[gameCbt.GameId];
+ // var gameInfo = mapper.Map(gameCbt);
+ // game.ToGameInfo(gameInfo);
+ // //game.GameName
+ // gameInfo.GameType = GetGameExtendedAttributes(gameChildList, gameCbt.GameId, 1, gameTypesDict);
+ // gameInfo.GameTags = GetGameExtendedAttributes(gameChildList, gameCbt.GameId, 2, gameTagsDict);
+ // if (!gameUserShare.TryGetValue(gameCbt.GameId, out string NickName))
+ // {
+ // string chineseName = faker.Internet.UserName();
+ // NickName = chineseName;
+ // }
+ // gameInfo.GameShare = $"{NickName}";
+ // var gameLanguageInfo = gameLanguageDic.GetAppGameLanguage(gameInfo);
+ // if (gameLanguageInfo != null)
+ // {
+ // gameInfo.GameName = gameLanguageInfo.GameName;
+ // gameInfo.GameIntroduce = gameLanguageInfo.GameIntroduce;
+ // gameInfo.GameShare = gameLanguageInfo.GameShare;
+ // }
+ // gameInfo.GameIntroduce = $"{gameInfo.GameIntroduce}
";
+ // gameInfo.GameShareUserIcon = 90001;
+ // if (gameInfo.ConsumeDiamondNumHour == 0)
+ // {
+ // gameInfo.ConsumeDiamondNumHour = defaultConsumeDiamondNumHour;
+ // }
+ // if (gameInfo.ConsumeDiamondNumHour > 0)
+ // {
+ // gameInfo.GameDetailsofCharges = $"游戏资费:游玩按分钟计费,{gameInfo.ConsumeDiamondNumHour}钻石/小时。";
+ // }
+ // else
+ // {
+ // gameInfo.GameDetailsofCharges = $"游戏免费";
+ // }
+ // //gameInfo.GameIntroduce
+ // return gameInfo;
+ // })
+ // .ToList();
return gameInfos;
}
diff --git a/src/CloudGaming/Code/CloudGaming.Code/Epg/EpgBLL.cs b/src/CloudGaming/Code/CloudGaming.Code/Epg/EpgBLL.cs
index 5280c35..3dbac64 100644
--- a/src/CloudGaming/Code/CloudGaming.Code/Epg/EpgBLL.cs
+++ b/src/CloudGaming/Code/CloudGaming.Code/Epg/EpgBLL.cs
@@ -25,7 +25,13 @@ namespace CloudGaming.Code.Epg
///
public async Task> GetHomeInfo()
{
- var listQueryable = GetEpgCategory(EpgEnum.EpgCatIdName.大厅首页).AsQueryable();
+ var home = Cache.EpgCategoryCfg.Where(it => it.IdName.Contains(EpgEnum.EpgCatIdName.大厅首页) && it.Platform == AppRequestInfo.Platform).FirstOrDefault();
+ if (home == null)
+ {
+ home = Cache.EpgCategoryCfg.Where(it => it.IdName.Contains(EpgEnum.EpgCatIdName.大厅首页) && string.IsNullOrEmpty(it.Platform)).FirstOrDefault();
+ }
+ string homeStr = home?.IdName ?? "Home";
+ var listQueryable = GetEpgCategory(homeStr).AsQueryable();
if (IsChecking)
{
listQueryable = listQueryable.Where(it => it.ShowStatus == 0 || it.ShowStatus == 2).AsQueryable();
@@ -51,8 +57,8 @@ namespace CloudGaming.Code.Epg
{
return;
}
-
- var epgInfo = item.ToEpgInfo(Cache.GameEntityCache,it.DefaultImageStyle);
+
+ var epgInfo = item.ToEpgInfo(Cache.GameEntityCache, it.DefaultImageStyle);
if (epgInfo != null)
{
list.Add(epgInfo);
diff --git a/src/CloudGaming/Model/CloudGaming.AppConfigModel/AppConfig.cs b/src/CloudGaming/Model/CloudGaming.AppConfigModel/AppConfig.cs
index 8999bbc..09bf390 100644
--- a/src/CloudGaming/Model/CloudGaming.AppConfigModel/AppConfig.cs
+++ b/src/CloudGaming/Model/CloudGaming.AppConfigModel/AppConfig.cs
@@ -146,5 +146,15 @@ namespace CloudGaming.AppConfigModel
///
App
}
+ ///
+ /// 手机平台
+ ///
+ public enum AppPlatform
+ {
+ android,
+ ios,
+ tv,
+ car,
+ }
}