Commit baf6eec8 authored by 黄奎's avatar 黄奎

页面修改

parent dc99c7bd
...@@ -109,6 +109,28 @@ namespace Mall.Common ...@@ -109,6 +109,28 @@ namespace Mall.Common
return valueStr; return valueStr;
} }
/// <summary>
/// redis服务器
/// </summary>
public static string RedisServer
{
get
{
return ReadConfigKey("RedisSetting", "RedisServer");
}
}
/// <summary>
/// redis密码
/// </summary>
public static string RedisPwd
{
get
{
return ReadConfigKey("RedisSetting", "RedisPwd");
}
}
/// <summary> /// <summary>
/// 超级管理员id /// 超级管理员id
/// </summary> /// </summary>
......
...@@ -77,22 +77,27 @@ namespace Mall.WebApi ...@@ -77,22 +77,27 @@ namespace Mall.WebApi
"https://mallapi.oytour.com", "https://mallapi.oytour.com",
"http://edu.oytour.com", "http://edu.oytour.com",
"http://jvs.oytour.com", "http://jvs.oytour.com",
"http://pic.oytour.com" "http://pic.oytour.com",
"http://admin.jjsw.vip",
"http://mallweb.jjsw.vip",
}; };
services.AddCors(options => options.AddPolicy("AllowCors", policy => policy.AllowAnyHeader().AllowAnyMethod().AllowCredentials().WithOrigins(corsArray.ToArray()))); services.AddCors(options => options.AddPolicy("AllowCors", policy => policy.AllowAnyHeader().AllowAnyMethod().AllowCredentials().WithOrigins(corsArray.ToArray())));
services.Configure<ForwardedHeadersOptions>(options => //services.Configure<ForwardedHeadersOptions>(options =>
{ //{
options.ForwardedHeaders = Microsoft.AspNetCore.HttpOverrides.ForwardedHeaders.XForwardedFor // options.ForwardedHeaders = Microsoft.AspNetCore.HttpOverrides.ForwardedHeaders.XForwardedFor
| Microsoft.AspNetCore.HttpOverrides.ForwardedHeaders.XForwardedProto; // | Microsoft.AspNetCore.HttpOverrides.ForwardedHeaders.XForwardedProto;
options.KnownProxies.Add(IPAddress.Parse("47.96.12.235")); // options.KnownProxies.Add(IPAddress.Parse("47.96.12.235"));
}); //});
string redisConnStr = $"{Common.Config.RedisServer},password={Common.Config.RedisPwd},connectTimeout=5000,allowAdmin=false,defaultDatabase=0";
//Api限流 //Api限流
services.AddApiThrottle(options => { services.AddApiThrottle(options =>
{
//配置redis //配置redis
options.UseRedisCacheAndStorage(opts => { options.UseRedisCacheAndStorage(opts =>
opts.ConnectionString = "47.96.23.199,password=Viitto2018,connectTimeout=5000,allowAdmin=false,defaultDatabase=0"; {
opts.ConnectionString = redisConnStr;
opts.KeyPrefix = "apithrottle"; //指定给所有key加上前缀,默认为apithrottle opts.KeyPrefix = "apithrottle"; //指定给所有key加上前缀,默认为apithrottle
}); });
}); });
......
...@@ -79,7 +79,7 @@ ...@@ -79,7 +79,7 @@
"Password": "viitto2019" "Password": "viitto2019"
}, },
"RedisSetting": { "RedisSetting": {
"RedisServer": "47.96.23.199", "RedisServer": "192.168.10.214",
"RedisPort": "6379", "RedisPort": "6379",
"RedisPwd": "Viitto2018" "RedisPwd": "Viitto2018"
}, },
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment