mirror of
https://gitee.com/ccnetcore/Yi
synced 2026-04-01 22:56:36 +08:00
完成redis
This commit is contained in:
@@ -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();
|
||||
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
"Cors_Enabled": true,
|
||||
"RabbitMQ_Enabled": false,
|
||||
"Redis_Enabled": false,
|
||||
"RedisSet_Enabled": false,
|
||||
"Kafka_Enabled": false,
|
||||
"MutiDB_Enabled": false,
|
||||
"DbList": [ "Sqlite", "Mysql", "Sqlserver", "Oracle" ],
|
||||
@@ -40,10 +41,10 @@
|
||||
"SecurityKey": "MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDI2a2EJ7m872v0afyoSDJT2o1+SitIeJSWtLJU8/Wz2m7gStexajkeD+Lka6DSTy8gt9UwfgVQo6uKjVLG5Ex7PiGOODVqAEghBuS7JzIYU5RvI543nNDAPfnJsas96mSA7L/mD7RTE2drj6hf3oZjJpMPZUQI/B1Qjb5H3K3PNwIDAQAB"
|
||||
},
|
||||
"RedisConn": {
|
||||
"Host": "192.168.2.128",
|
||||
"Host": "118.195.191.41",
|
||||
"Prot": 6379,
|
||||
"DB": 0,
|
||||
"Password": "123456"
|
||||
"Password": "Qz52013142020."
|
||||
},
|
||||
"KafkaOptions": {
|
||||
"BrokerList": "192.168.3.230:9092",
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user