添加app配置
This commit is contained in:
parent
a68ce163ec
commit
97f4047174
|
|
@ -21,6 +21,7 @@ public class AppController : CloudGamingControllerBase
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
[HttpGet]
|
[HttpGet]
|
||||||
|
[Message("获取成功!")]
|
||||||
public async Task<AppConfigDto> GetAppConfigAsync()
|
public async Task<AppConfigDto> GetAppConfigAsync()
|
||||||
{
|
{
|
||||||
AppConfigBLL appConfigBLL = new AppConfigBLL(ServiceProvider);
|
AppConfigBLL appConfigBLL = new AppConfigBLL(ServiceProvider);
|
||||||
|
|
|
||||||
|
|
@ -1,24 +1,12 @@
|
||||||
using Bogus;
|
|
||||||
|
|
||||||
using CloudGaming.Code.DataAccess;
|
using CloudGaming.Code.DataAccess;
|
||||||
|
|
||||||
using Flurl;
|
|
||||||
|
|
||||||
using HuanMeng.DotNetCore.CacheHelper;
|
using HuanMeng.DotNetCore.CacheHelper;
|
||||||
using HuanMeng.DotNetCore.CacheHelper.Contract;
|
using HuanMeng.DotNetCore.CacheHelper.Contract;
|
||||||
|
|
||||||
using Microsoft.Extensions.Caching.Memory;
|
|
||||||
|
|
||||||
using SKIT.FlurlHttpClient.Wechat.TenpayV3.Models;
|
|
||||||
|
|
||||||
using StackExchange.Redis;
|
using StackExchange.Redis;
|
||||||
|
|
||||||
using System.Collections.Concurrent;
|
using System.Collections.Concurrent;
|
||||||
|
|
||||||
using static SKIT.FlurlHttpClient.Wechat.TenpayV3.ExtendedSDK.Global.Models.QueryPartnerRefundsResponse.Types;
|
|
||||||
using static SKIT.FlurlHttpClient.Wechat.TenpayV3.Models.CreateNewTaxControlFapiaoApplicationRequest.Types.Fapiao.Types;
|
|
||||||
using static System.Net.Mime.MediaTypeNames;
|
|
||||||
|
|
||||||
namespace CloudGaming.Code.Cache.Special;
|
namespace CloudGaming.Code.Cache.Special;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
||||||
|
|
@ -95,17 +95,23 @@ public class CustomResultFilter : IResultFilter
|
||||||
}
|
}
|
||||||
string c = cloudGamingBase.AppRequestInfo.Language;
|
string c = cloudGamingBase.AppRequestInfo.Language;
|
||||||
var languageDic = _appConfig.GetAppApiLanguage(c, apiPrefix);
|
var languageDic = _appConfig.GetAppApiLanguage(c, apiPrefix);
|
||||||
var dic = value.ToDictionaryOrList(false, apiPrefix, it => cloudGamingBase.Cache.AppImageCache[it], (value, prefix, isArray) =>
|
var dic = value.ToDictionaryOrList(false, apiPrefix, it => cloudGamingBase.Cache.AppImageCache[it], (value, prefix, propertyName, isArray) =>
|
||||||
{
|
{
|
||||||
if (false && !isArray && value.ContainsChineseOptimized())
|
if (!isArray)
|
||||||
{
|
{
|
||||||
//中文
|
if (value.ContainsChineseOptimized())
|
||||||
var v = languageDic.GetOrAdd(prefix, value);
|
|
||||||
if (!string.IsNullOrEmpty(v))
|
|
||||||
{
|
{
|
||||||
return v;
|
if (propertyName == "Message")
|
||||||
|
{
|
||||||
|
var v = languageDic.GetOrAdd(prefix, value);
|
||||||
|
if (!string.IsNullOrEmpty(v))
|
||||||
|
{
|
||||||
|
return v;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return value;
|
return value;
|
||||||
});
|
});
|
||||||
objectResult.Value = dic;
|
objectResult.Value = dic;
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
// See https://aka.ms/new-console-template for more information
|
// See https://aka.ms/new-console-template for more information
|
||||||
|
using CloudGaming.AppConfigModel;
|
||||||
using CloudGaming.GameModel.Db.Db_Ext;
|
using CloudGaming.GameModel.Db.Db_Ext;
|
||||||
using CloudGaming.GameModel.Db.Db_Game;
|
using CloudGaming.GameModel.Db.Db_Game;
|
||||||
using CloudGaming.Model.DbSqlServer.Db_Phone;
|
using CloudGaming.Model.DbSqlServer.Db_Phone;
|
||||||
|
|
@ -289,7 +290,7 @@ tempGames.ForEach((Action<tempGame>)(game =>
|
||||||
VipTypeLimit = 0,
|
VipTypeLimit = 0,
|
||||||
VipVisible = false,
|
VipVisible = false,
|
||||||
IsDiscount = false,
|
IsDiscount = false,
|
||||||
OnlinePlatform = "",
|
OnlinePlatform = AppPlatform.car.ToString(),
|
||||||
FriendlyTips = "",
|
FriendlyTips = "",
|
||||||
TenantId = Guid.Parse("6fba9c21-0de5-4734-a91e-f4961684d3d1"),
|
TenantId = Guid.Parse("6fba9c21-0de5-4734-a91e-f4961684d3d1"),
|
||||||
GameLoadBgImageId = 0,
|
GameLoadBgImageId = 0,
|
||||||
|
|
|
||||||
|
|
@ -44,7 +44,7 @@ public static class ObjectExtensions
|
||||||
/// <param name="obj">要转换的对象。</param>
|
/// <param name="obj">要转换的对象。</param>
|
||||||
/// <param name="prefix">属性路径的可选前缀。</param>
|
/// <param name="prefix">属性路径的可选前缀。</param>
|
||||||
/// <returns>对象的字典或列表表示形式。</returns>
|
/// <returns>对象的字典或列表表示形式。</returns>
|
||||||
public static object ToDictionaryOrList(this object obj, bool isEnumerable, string prefix = "", Func<int, string>? imageFunc = null, Func<string, string, bool, string>? languageFunc = null)
|
public static object ToDictionaryOrList(this object obj, bool isEnumerable, string prefix = "", Func<int, string>? imageFunc = null, Func<string, string, string, bool, string>? languageFunc = null)
|
||||||
{
|
{
|
||||||
if (obj == null) return null;
|
if (obj == null) return null;
|
||||||
|
|
||||||
|
|
@ -62,7 +62,7 @@ public static class ObjectExtensions
|
||||||
/// <param name="enumerable">要转换的集合。</param>
|
/// <param name="enumerable">要转换的集合。</param>
|
||||||
/// <param name="prefix">集合中每个属性路径的前缀。</param>
|
/// <param name="prefix">集合中每个属性路径的前缀。</param>
|
||||||
/// <returns>转换后的项列表。</returns>
|
/// <returns>转换后的项列表。</returns>
|
||||||
private static List<object> TransformCollection(IEnumerable enumerable, string prefix = "", Func<int, string>? imageFunc = null, Func<string, string, bool, string>? languageFunc = null)
|
private static List<object> TransformCollection(IEnumerable enumerable, string prefix = "", Func<int, string>? imageFunc = null, Func<string, string, string, bool, string>? languageFunc = null)
|
||||||
{
|
{
|
||||||
var list = new List<object>(enumerable is ICollection collection ? collection.Count : 10);
|
var list = new List<object>(enumerable is ICollection collection ? collection.Count : 10);
|
||||||
int index = 0;
|
int index = 0;
|
||||||
|
|
@ -80,7 +80,7 @@ public static class ObjectExtensions
|
||||||
/// <param name="obj">要转换的对象。</param>
|
/// <param name="obj">要转换的对象。</param>
|
||||||
/// <param name="prefix">每个属性路径的前缀。</param>
|
/// <param name="prefix">每个属性路径的前缀。</param>
|
||||||
/// <returns>包含属性名和属性值的字典。</returns>
|
/// <returns>包含属性名和属性值的字典。</returns>
|
||||||
private static Dictionary<string, object> TransformObject(object obj, bool isEnumerable, string prefix = "", Func<int, string>? imageFunc = null, Func<string, string, bool, string>? languageFunc = null)
|
private static Dictionary<string, object> TransformObject(object obj, bool isEnumerable, string prefix = "", Func<int, string>? imageFunc = null, Func<string, string, string, bool, string>? languageFunc = null)
|
||||||
{
|
{
|
||||||
if (obj == null)
|
if (obj == null)
|
||||||
{
|
{
|
||||||
|
|
@ -107,7 +107,7 @@ public static class ObjectExtensions
|
||||||
}
|
}
|
||||||
if (!string.IsNullOrEmpty(stringValue) && languageFunc != null)
|
if (!string.IsNullOrEmpty(stringValue) && languageFunc != null)
|
||||||
{
|
{
|
||||||
stringValue = languageFunc?.Invoke(stringValue, propertyPath, isEnumerable) ?? "";
|
stringValue = languageFunc?.Invoke(stringValue, propertyPath, accessor.PropertyName, isEnumerable) ?? "";
|
||||||
}
|
}
|
||||||
keyValuePairs[accessor.PropertyName] = stringValue;
|
keyValuePairs[accessor.PropertyName] = stringValue;
|
||||||
continue;
|
continue;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user