From 1fbf0ada64271c68a2311834b8c1375a53f581cb Mon Sep 17 00:00:00 2001 From: falcon <9504402@qq.com> Date: Mon, 27 Apr 2020 16:14:01 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E6=9F=A5=E8=AF=A2=E6=89=80?= =?UTF-8?q?=E6=9C=89=E7=94=A8=E6=88=B7=E7=9A=84=E6=96=B9=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- FAuth/Controllers/api/UserController.cs | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/FAuth/Controllers/api/UserController.cs b/FAuth/Controllers/api/UserController.cs index 0ee1ffc..43edbea 100644 --- a/FAuth/Controllers/api/UserController.cs +++ b/FAuth/Controllers/api/UserController.cs @@ -1,4 +1,5 @@ using System; +using System.Collections.Generic; using System.Linq; using Falcon.Extend; using FAuth.DataBase.Tables; @@ -107,6 +108,26 @@ namespace FAuth.Controllers.api }; } + /// + /// 获取用户信息列表 + /// + /// 用户信息列表 + [HttpGet] + [ProducesResponseType(typeof(IEnumerable),200)] + public IEnumerable GetUsers() { + var key = "FAuth:Users"; + var obj = this.Cache?.GetObj>(key); + if(obj == null) { + obj = this.Db.Users + .Select(m => new UserInfo { + Id = m.Id, + UserName = m.UserName, + }).ToList(); + this.Cache?.SetCache(key,obj,new TimeSpan(0,5,0)); + } + return obj; + } + /// /// 根据提供的登陆票据修改用户密码 ///