合并同步

This commit is contained in:
橙子
2021-11-03 18:28:51 +08:00
12 changed files with 178 additions and 328 deletions

View File

@@ -7,6 +7,7 @@ using System.Linq;
using System.Threading.Tasks;
using Yi.Framework.Common.Const;
using Yi.Framework.Common.Models;
using Yi.Framework.Core;
using Yi.Framework.DTOModel;
using Yi.Framework.Interface;
using Yi.Framework.Model.Models;
@@ -20,10 +21,12 @@ namespace Yi.Framework.ApiMicroservice.Controllers
public class SettingController : ControllerBase
{
private readonly ILogger<SettingController> _logger;
private readonly CacheClientDB _cacheClientDB;
public SettingController(ILogger<SettingController> logger)
public SettingController(ILogger<SettingController> logger, CacheClientDB cacheClientDB)
{
_logger = logger;
_cacheClientDB = cacheClientDB;
}
@@ -33,21 +36,20 @@ namespace Yi.Framework.ApiMicroservice.Controllers
/// </summary>
/// <returns></returns>
[HttpGet]
public async Task<Result> GetSetting()
{
var p = RedisConst.stringData[RedisConst.ImageList_key];
return Result.Success();
public Result GetSetting()
{
return Result.Success().SetData( _cacheClientDB.Get<SettingDto>(RedisConst.key));
}
/// <summary>
/// 更
/// </summary>
/// <param name="_Setting"></param>
/// <param name="settingDto"></param>
/// <returns></returns>
[HttpPut]
public async Task<Result> UpdateSetting()
public Result UpdateSetting(SettingDto settingDto)
{
_cacheClientDB.Set(RedisConst.key, settingDto);
return Result.Success();
}

View File

@@ -4,6 +4,7 @@ using Microsoft.AspNetCore.Hosting;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Yi.Framework.Core;
using Yi.Framework.Model.ModelFactory;
using Yi.Framework.WebCore.MiddlewareExtend;
using Yi.Framework.WebCore.Utility;
@@ -83,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())
{
@@ -141,7 +142,7 @@ namespace Yi.Framework.ApiMicroservice
//数据库种子注入
#endregion
app.UseDbSeedInitService(_DbFactory);
app.UseRedisInitService(_cacheClientDB);
#region
//Endpoints注入
#endregion

View File

@@ -1,68 +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,
"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": false,
"RedisSet_Enabled": false,
"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"
},
"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"
}