diff --git a/Yi.Framework/Yi.Framework.ApiMicroservice/Startup.cs b/Yi.Framework/Yi.Framework.ApiMicroservice/Startup.cs index 060e93ab..7ed91dd8 100644 --- a/Yi.Framework/Yi.Framework.ApiMicroservice/Startup.cs +++ b/Yi.Framework/Yi.Framework.ApiMicroservice/Startup.cs @@ -84,7 +84,7 @@ namespace Yi.Framework.ApiMicroservice #endregion // This method gets called by the runtime. Use this method to configure the HTTP request pipeline. - public void Configure(IApplicationBuilder app, IWebHostEnvironment env,IDbContextFactory _DbFactory) + public void Configure(IApplicationBuilder app, IWebHostEnvironment env,IDbContextFactory _DbFactory, CacheClientDB _cacheClientDB) { //if (env.IsDevelopment()) { @@ -142,7 +142,11 @@ namespace Yi.Framework.ApiMicroservice //数据库种子注入 #endregion app.UseDbSeedInitService(_DbFactory); - //app.UseRedisInitService(_cacheClientDB); + + #region + //redis种子注入 + #endregion + app.UseRedisSeedInitService(_cacheClientDB); #region //Endpoints注入 #endregion diff --git a/Yi.Framework/Yi.Framework.ApiMicroservice/SwaggerDoc.xml b/Yi.Framework/Yi.Framework.ApiMicroservice/SwaggerDoc.xml index 2efb0841..6c8d851c 100644 --- a/Yi.Framework/Yi.Framework.ApiMicroservice/SwaggerDoc.xml +++ b/Yi.Framework/Yi.Framework.ApiMicroservice/SwaggerDoc.xml @@ -39,6 +39,14 @@ + + + 璇ユ柟娉曚笉瀵瑰鏆撮湶 + + + + + 杩欎釜鏄閫掑綊鐨勶紝浣嗘槸瑕佽繃婊ゆ帀鍒犻櫎鐨勶紝鎵浠ワ紝鍙互鍐欎竴涓氱敤杩囨护鎺夊垹闄ょ殑鏂规硶 @@ -159,11 +167,11 @@ - + - + diff --git a/Yi.Framework/Yi.Framework.ApiMicroservice/appsettings.json b/Yi.Framework/Yi.Framework.ApiMicroservice/appsettings.json index 61f66577..e08f7152 100644 --- a/Yi.Framework/Yi.Framework.ApiMicroservice/appsettings.json +++ b/Yi.Framework/Yi.Framework.ApiMicroservice/appsettings.json @@ -1,69 +1,69 @@ { - "Logging": { - "LogLevel": { - "Default": "Information", - "Microsoft": "Warning", - "Microsoft.Hosting.Lifetime": "Information" - } - }, - "AllowedHosts": "*", + "Logging": { + "LogLevel": { + "Default": "Information", + "Microsoft": "Warning", + "Microsoft.Hosting.Lifetime": "Information" + } + }, + "AllowedHosts": "*", - "Consul_Enabled": false, - "DbSeed_Enabled": true, - "Apollo_Enabled": false, - "HealthCheck_Enabled": false, - "Cors_Enabled": true, - "RabbitMQ_Enabled": false, - "Redis_Enabled": false, - "RedisSet_Enabled": false, - "Kafka_Enabled": false, - "MutiDB_Enabled": false, - "DbList": ["Sqlite", "Mysql", "Sqlserver", "Oracle"], - "DbSelect": "Mysql", + "Consul_Enabled": false, + "DbSeed_Enabled": true, + "Apollo_Enabled": false, + "HealthCheck_Enabled": false, + "Cors_Enabled": true, + "RabbitMQ_Enabled": false, + "Redis_Enabled": true, + "RedisSeed_Enabled": true, + "Kafka_Enabled": false, + "MutiDB_Enabled": false, + "DbList": [ "Sqlite", "Mysql", "Sqlserver", "Oracle" ], + "DbSelect": "Mysql", - "DbConn": { - "WriteUrl": "server=118.195.191.41;port=3306;database=YIDB;user id=root;password=Qz52013142020.", - "ReadUrl": [ - "server=118.195.191.41;port=3306;database=YIDB;user id=root;password=Qz52013142020.", - "server=118.195.191.41;port=3306;database=YIDB;user id=root;password=Qz52013142020.", - "server=118.195.191.41;port=3306;database=YIDB;user id=root;password=Qz52013142020." - ] - }, - "Apollo": { - "AppId": "Yi.Framework.ApiMicroservice", - "Env": "DEV", - "MetaServer": "http://192.168.2.168:8080", - "ConfigServer": ["http://192.168.2.168:8080"] - }, - "JWTTokenOptions": { - "Audience": "http://localhost:7000", - "Issuer": "http://localhost:7000", - "SecurityKey": "MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDI2a2EJ7m872v0afyoSDJT2o1+SitIeJSWtLJU8/Wz2m7gStexajkeD+Lka6DSTy8gt9UwfgVQo6uKjVLG5Ex7PiGOODVqAEghBuS7JzIYU5RvI543nNDAPfnJsas96mSA7L/mD7RTE2drj6hf3oZjJpMPZUQI/B1Qjb5H3K3PNwIDAQAB" - }, - "RedisConn": { - "Host": "118.195.191.41", - "Prot": 6379, - "DB": 1, - "Password": "Qz52013142020." - }, - "KafkaOptions": { - "BrokerList": "192.168.3.230:9092", - "TopicName": "kafkalog" - }, - "ConsulClientOption": { - "IP": "192.168.2.128", - "Port": "8500", - "Datacenter": "dc1" - }, - "ConsulRegisterOption": { - "IP": "192.168.1.104", - "Port": "7001", - "GroupName": "ApiMicroservice", - "HealthCheckUrl": "/Health", - "Interval": 10, - "Timeout": 5, - "DeregisterCriticalServiceAfter": 60, - "Tag": "13" - }, - "IPLibraryServiceUrl": "http://gRPCIPLibraryService" + "DbConn": { + "WriteUrl": "server=118.195.191.41;port=3306;database=YIDB;user id=root;password=Qz52013142020.", + "ReadUrl": [ + "server=118.195.191.41;port=3306;database=YIDB;user id=root;password=Qz52013142020.", + "server=118.195.191.41;port=3306;database=YIDB;user id=root;password=Qz52013142020.", + "server=118.195.191.41;port=3306;database=YIDB;user id=root;password=Qz52013142020." + ] + }, + "Apollo": { + "AppId": "Yi.Framework.ApiMicroservice", + "Env": "DEV", + "MetaServer": "http://192.168.2.168:8080", + "ConfigServer": [ "http://192.168.2.168:8080" ] + }, + "JWTTokenOptions": { + "Audience": "http://localhost:7000", + "Issuer": "http://localhost:7000", + "SecurityKey": "MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDI2a2EJ7m872v0afyoSDJT2o1+SitIeJSWtLJU8/Wz2m7gStexajkeD+Lka6DSTy8gt9UwfgVQo6uKjVLG5Ex7PiGOODVqAEghBuS7JzIYU5RvI543nNDAPfnJsas96mSA7L/mD7RTE2drj6hf3oZjJpMPZUQI/B1Qjb5H3K3PNwIDAQAB" + }, + "RedisConnOptions": { + "Host": "118.195.191.41", + "Prot": 6379, + "DB": 1, + "Password": "Qz52013142020." + }, + "KafkaOptions": { + "BrokerList": "192.168.3.230:9092", + "TopicName": "kafkalog" + }, + "ConsulClientOption": { + "IP": "192.168.2.128", + "Port": "8500", + "Datacenter": "dc1" + }, + "ConsulRegisterOption": { + "IP": "192.168.1.104", + "Port": "7001", + "GroupName": "ApiMicroservice", + "HealthCheckUrl": "/Health", + "Interval": 10, + "Timeout": 5, + "DeregisterCriticalServiceAfter": 60, + "Tag": "13" + }, + "IPLibraryServiceUrl": "http://gRPCIPLibraryService" } \ No newline at end of file diff --git a/Yi.Framework/Yi.Framework.Core/CacheClientDB.cs b/Yi.Framework/Yi.Framework.Core/CacheClientDB.cs index 41d84a5c..32187406 100644 --- a/Yi.Framework/Yi.Framework.Core/CacheClientDB.cs +++ b/Yi.Framework/Yi.Framework.Core/CacheClientDB.cs @@ -44,9 +44,9 @@ namespace Yi.Framework.Core // } //} #endregion - public CacheClientDB(IOptionsMonitor jwtTokenOptions) + public CacheClientDB(IOptionsMonitor redisConnOptions) { - this._RedisOptions = jwtTokenOptions.CurrentValue; + this._RedisOptions = redisConnOptions.CurrentValue; client = new RedisClient(_RedisOptions.Host, _RedisOptions.Prot, _RedisOptions.Password, _RedisOptions.DB); } // 绠¢亾妯″紡 涓夌妯″紡 diff --git a/Yi.Framework/Yi.Framework.WebCore/Init/RedisInit.cs b/Yi.Framework/Yi.Framework.WebCore/Init/RedisInit.cs index 25888d21..da18bf72 100644 --- a/Yi.Framework/Yi.Framework.WebCore/Init/RedisInit.cs +++ b/Yi.Framework/Yi.Framework.WebCore/Init/RedisInit.cs @@ -16,6 +16,7 @@ namespace Yi.Framework.WebCore.Init if (_cacheClientDB.Get(RedisConst.key)==null) { + Newtonsoft.Json.JsonConvert.SerializeObject(); _cacheClientDB.Add(RedisConst.key, new SettingDto() { ImageList_key = { "榛樿鍥剧墖", "榛樿鍥剧墖" } , diff --git a/Yi.Framework/Yi.Framework.WebCore/MiddlewareExtend/RedisExtension.cs b/Yi.Framework/Yi.Framework.WebCore/MiddlewareExtend/RedisExtension.cs index f17beb8a..2d17b857 100644 --- a/Yi.Framework/Yi.Framework.WebCore/MiddlewareExtend/RedisExtension.cs +++ b/Yi.Framework/Yi.Framework.WebCore/MiddlewareExtend/RedisExtension.cs @@ -17,7 +17,7 @@ namespace Yi.Framework.WebCore.MiddlewareExtend { if (Appsettings.appBool("Redis_Enabled")) { - services.Configure(Appsettings.appConfiguration("RedisConn")); + services.Configure(Appsettings.appConfiguration("RedisConnOptions")); services.AddTransient(); } return services; diff --git a/Yi.Framework/Yi.Framework.WebCore/MiddlewareExtend/RedisInitExtend.cs b/Yi.Framework/Yi.Framework.WebCore/MiddlewareExtend/RedisInitExtend.cs index 8f813afd..010bb42e 100644 --- a/Yi.Framework/Yi.Framework.WebCore/MiddlewareExtend/RedisInitExtend.cs +++ b/Yi.Framework/Yi.Framework.WebCore/MiddlewareExtend/RedisInitExtend.cs @@ -15,10 +15,10 @@ namespace Yi.Framework.WebCore.MiddlewareExtend public static class RedisInitExtend { private static readonly ILog log = LogManager.GetLogger(typeof(RedisInitExtend)); - public static void UseRedisInitService(this IApplicationBuilder app, CacheClientDB _cacheClientDB) + public static void UseRedisSeedInitService(this IApplicationBuilder app, CacheClientDB _cacheClientDB) { - if (Appsettings.appBool("RedisSet_Enabled")) + if (Appsettings.appBool("RedisSeed_Enabled")) { if (app == null) throw new ArgumentNullException(nameof(app));