完成redis

This commit is contained in:
lzw
2021-11-03 18:26:13 +08:00
parent 7b994240d0
commit c4e13a4135
14 changed files with 115 additions and 265 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();
}