From 577f82657d12e10ee950ea60b23551bea77cd000 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=A9=99=E5=AD=90?= <454313500@qq.com> Date: Wed, 3 Nov 2021 15:32:45 +0800 Subject: [PATCH] =?UTF-8?q?=E8=AE=BE=E7=BD=AE=E6=A8=A1=E5=9D=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controllers/SettingController.cs | 55 +++++++++++++++++++ .../Yi.Framework.Common/Const/RedisConst.cs | 42 ++++++++++++++ .../Yi.Framework.DTOModel/SettingDto.cs | 12 ++++ 3 files changed, 109 insertions(+) create mode 100644 Yi.Framework/Yi.Framework.ApiMicroservice/Controllers/SettingController.cs create mode 100644 Yi.Framework/Yi.Framework.Common/Const/RedisConst.cs create mode 100644 Yi.Framework/Yi.Framework.DTOModel/SettingDto.cs diff --git a/Yi.Framework/Yi.Framework.ApiMicroservice/Controllers/SettingController.cs b/Yi.Framework/Yi.Framework.ApiMicroservice/Controllers/SettingController.cs new file mode 100644 index 00000000..f30ecc46 --- /dev/null +++ b/Yi.Framework/Yi.Framework.ApiMicroservice/Controllers/SettingController.cs @@ -0,0 +1,55 @@ +using Microsoft.AspNetCore.Authorization; +using Microsoft.AspNetCore.Mvc; +using Microsoft.Extensions.Logging; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using Yi.Framework.Common.Const; +using Yi.Framework.Common.Models; +using Yi.Framework.DTOModel; +using Yi.Framework.Interface; +using Yi.Framework.Model.Models; +using Yi.Framework.WebCore; + +namespace Yi.Framework.ApiMicroservice.Controllers +{ + [ApiController] + [Route("api/[controller]/[action]")] + [Authorize] + public class SettingController : ControllerBase + { + private readonly ILogger _logger; + + public SettingController(ILogger logger) + { + _logger = logger; + } + + + + /// + /// 查 + /// + /// + [HttpGet] + public async Task GetSetting() + { + var p = RedisConst.stringData[RedisConst.ImageList_key]; + return Result.Success(); + } + + /// + /// 更 + /// + /// + /// + [HttpPut] + public async Task UpdateSetting() + { + + return Result.Success(); + + } + } +} diff --git a/Yi.Framework/Yi.Framework.Common/Const/RedisConst.cs b/Yi.Framework/Yi.Framework.Common/Const/RedisConst.cs new file mode 100644 index 00000000..3a22a248 --- /dev/null +++ b/Yi.Framework/Yi.Framework.Common/Const/RedisConst.cs @@ -0,0 +1,42 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Yi.Framework.Common.Const +{ + public class RedisConst + { + /// + /// 前缀 + /// + private const string prefix = "Yi:"; + + /// + /// 初始化角色名 + /// + public const string InitRole_key = nameof(InitRole_key); + + /// + /// 标题名 + /// + public const string Title_key = nameof(Title_key); + + /// + /// 图片列表名 + /// + public const string ImageList_key = nameof(ImageList_key); + + public static Dictionary stringData = new Dictionary() + { + {prefix+nameof(InitRole_key), "普通用户"}, + {prefix+nameof(Title_key), "YiFramework"}, + }; + + public static Dictionary> listData = new Dictionary>() + { + {prefix+nameof(ImageList_key), new List(){"图片地址1", "图片地址2", "图片地址3", "图片地址4" } } + }; + } +} diff --git a/Yi.Framework/Yi.Framework.DTOModel/SettingDto.cs b/Yi.Framework/Yi.Framework.DTOModel/SettingDto.cs new file mode 100644 index 00000000..a327a37e --- /dev/null +++ b/Yi.Framework/Yi.Framework.DTOModel/SettingDto.cs @@ -0,0 +1,12 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Yi.Framework.DTOModel +{ + public class SettingDto + { + } +}