From a4520041c96b3342a692a67476537111d4df8d9d Mon Sep 17 00:00:00 2001 From: Argo-Windows <5196060@qq.com> Date: Thu, 28 Feb 2019 16:44:50 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=8A=9F=E8=83=BD?= =?UTF-8?q?=EF=BC=9A=E5=A2=9E=E5=8A=A0=E5=9C=A8=E7=BA=BF=E7=94=A8=E6=88=B7?= =?UTF-8?q?=E7=BB=9F=E8=AE=A1=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controllers/Api/OnlineUsersController.cs | 23 ++++++ .../OnlineUsers/DefaultOnlineUsers.cs | 32 ++++++++ Bootstrap.Admin/OnlineUsers/IOnlineUsers.cs | 25 ++++++ Bootstrap.Admin/OnlineUsers/OnlineUser.cs | 80 +++++++++++++++++++ .../OnlineUsersMiddlewareExtensions.cs | 48 +++++++++++ ...OnlineUsersServicesCollectionExtensions.cs | 22 +++++ Bootstrap.Admin/Startup.cs | 2 + 7 files changed, 232 insertions(+) create mode 100644 Bootstrap.Admin/Controllers/Api/OnlineUsersController.cs create mode 100644 Bootstrap.Admin/OnlineUsers/DefaultOnlineUsers.cs create mode 100644 Bootstrap.Admin/OnlineUsers/IOnlineUsers.cs create mode 100644 Bootstrap.Admin/OnlineUsers/OnlineUser.cs create mode 100644 Bootstrap.Admin/OnlineUsers/OnlineUsersMiddlewareExtensions.cs create mode 100644 Bootstrap.Admin/OnlineUsers/OnlineUsersServicesCollectionExtensions.cs diff --git a/Bootstrap.Admin/Controllers/Api/OnlineUsersController.cs b/Bootstrap.Admin/Controllers/Api/OnlineUsersController.cs new file mode 100644 index 00000000..131969eb --- /dev/null +++ b/Bootstrap.Admin/Controllers/Api/OnlineUsersController.cs @@ -0,0 +1,23 @@ +using Microsoft.AspNetCore.Mvc; +using System.Collections.Generic; + +namespace Bootstrap.Admin.Controllers.Api +{ + /// + /// + /// + [Route("api/[controller]")] + [ApiController] + public class OnlineUsersController : ControllerBase + { + /// + /// + /// + /// + [HttpPost()] + public IEnumerable Post([FromServices]IOnlineUsers onlineUSers) + { + return onlineUSers.OnlineUsers; + } + } +} diff --git a/Bootstrap.Admin/OnlineUsers/DefaultOnlineUsers.cs b/Bootstrap.Admin/OnlineUsers/DefaultOnlineUsers.cs new file mode 100644 index 00000000..53d4875a --- /dev/null +++ b/Bootstrap.Admin/OnlineUsers/DefaultOnlineUsers.cs @@ -0,0 +1,32 @@ +using System; +using System.Collections.Concurrent; +using System.Collections.Generic; + +namespace Bootstrap.Admin +{ + /// + /// + /// + internal class DefaultOnlineUsers : IOnlineUsers + { + private ConcurrentDictionary _onlineUsers = new ConcurrentDictionary(); + + /// + /// + /// + /// + public IEnumerable OnlineUsers + { + get { return _onlineUsers.Values; } + } + + /// + /// + /// + /// + /// + /// + /// + public OnlineUser AddOrUpdate(string key, Func addValueFactory, Func updateValueFactory) => _onlineUsers.AddOrUpdate(key, addValueFactory, updateValueFactory); + } +} diff --git a/Bootstrap.Admin/OnlineUsers/IOnlineUsers.cs b/Bootstrap.Admin/OnlineUsers/IOnlineUsers.cs new file mode 100644 index 00000000..84123785 --- /dev/null +++ b/Bootstrap.Admin/OnlineUsers/IOnlineUsers.cs @@ -0,0 +1,25 @@ +using System; +using System.Collections.Generic; + +namespace Bootstrap.Admin +{ + /// + /// + /// + public interface IOnlineUsers + { + /// + /// + /// + IEnumerable OnlineUsers { get; } + + /// + /// + /// + /// + /// + /// + /// + OnlineUser AddOrUpdate(string key, Func addValueFactory, Func updateValueFactory); + } +} diff --git a/Bootstrap.Admin/OnlineUsers/OnlineUser.cs b/Bootstrap.Admin/OnlineUsers/OnlineUser.cs new file mode 100644 index 00000000..39720d73 --- /dev/null +++ b/Bootstrap.Admin/OnlineUsers/OnlineUser.cs @@ -0,0 +1,80 @@ +using System; +using System.Collections.Concurrent; +using System.Collections.Generic; + +namespace Bootstrap.Admin +{ + + /// + /// + /// + public class OnlineUser + { + private ConcurrentQueue> _requestUrls; + + /// + /// + /// + /// + /// + /// + public OnlineUser(string ip, string userName, string method) + { + Ip = ip; + UserName = userName; + Method = method; + FirstAccessTime = DateTime.Now; + LastAccessTime = DateTime.Now; + _requestUrls = new ConcurrentQueue>(); + } + + /// + /// + /// + public string UserName { get; } + + /// + /// + /// + public DateTime FirstAccessTime { get; } + + /// + /// + /// + public DateTime LastAccessTime { get; set; } + + /// + /// + /// + public string Method { get; set; } + + /// + /// + /// + public string Ip { get; set; } + + /// + /// + /// + public IEnumerable> RequestUrls + { + get + { + return _requestUrls.ToArray(); + } + } + + /// + /// + /// + /// + public void AddRequestUrl(string url) + { + _requestUrls.Enqueue(new KeyValuePair(DateTime.Now, url)); + if (_requestUrls.Count > 10) + { + _requestUrls.TryDequeue(out _); + } + } + } +} diff --git a/Bootstrap.Admin/OnlineUsers/OnlineUsersMiddlewareExtensions.cs b/Bootstrap.Admin/OnlineUsers/OnlineUsersMiddlewareExtensions.cs new file mode 100644 index 00000000..9275d165 --- /dev/null +++ b/Bootstrap.Admin/OnlineUsers/OnlineUsersMiddlewareExtensions.cs @@ -0,0 +1,48 @@ +using Bootstrap.Admin; +using Microsoft.AspNetCore.Http; +using Microsoft.Extensions.DependencyInjection; +using System; +using System.Linq; +using System.Threading.Tasks; + +namespace Microsoft.AspNetCore.Builder +{ + /// + /// + /// + public static class OnlineUsersMiddlewareExtensions + { + /// + /// + /// + /// + /// + public static IApplicationBuilder UseOnlineUsers(this IApplicationBuilder builder) => builder.UseWhen(context => context.Filter(), app => app.Use(async (context, next) => + { + await Task.Run(() => + { + var onlineUsers = context.RequestServices.GetService(); + var clientIp = context.Connection.RemoteIpAddress.ToString(); + onlineUsers.AddOrUpdate(clientIp, key => + { + var ou = new OnlineUser(key, context.User.Identity.Name, context.Request.Method); + ou.AddRequestUrl(context.Request.Path); + return ou; + }, (key, v) => + { + v.LastAccessTime = DateTime.Now; + v.Method = context.Request.Method; + v.AddRequestUrl(context.Request.Path); + return v; + }); + }); + await next(); + })); + + private static bool Filter(this HttpContext context) + { + var url = context.Request.Path; + return !new string[] { "/api", "/NotiHub", "/swagger" }.Any(r => url.StartsWithSegments(r, StringComparison.OrdinalIgnoreCase)); + } + } +} diff --git a/Bootstrap.Admin/OnlineUsers/OnlineUsersServicesCollectionExtensions.cs b/Bootstrap.Admin/OnlineUsers/OnlineUsersServicesCollectionExtensions.cs new file mode 100644 index 00000000..6cd77909 --- /dev/null +++ b/Bootstrap.Admin/OnlineUsers/OnlineUsersServicesCollectionExtensions.cs @@ -0,0 +1,22 @@ +using Bootstrap.Admin; +using Microsoft.Extensions.DependencyInjection.Extensions; + +namespace Microsoft.Extensions.DependencyInjection +{ + /// + /// + /// + public static class OnlineUsersServicesCollectionExtensions + { + /// + /// + /// + /// + /// + public static IServiceCollection AddOnlineUsers(this IServiceCollection services) + { + services.TryAddSingleton(); + return services; + } + } +} diff --git a/Bootstrap.Admin/Startup.cs b/Bootstrap.Admin/Startup.cs index bf51014d..ff603bc7 100644 --- a/Bootstrap.Admin/Startup.cs +++ b/Bootstrap.Admin/Startup.cs @@ -60,6 +60,7 @@ namespace Bootstrap.Admin services.AddConfigurationManager(Configuration); services.AddCacheManager(Configuration); services.AddDbAdapter(); + services.AddOnlineUsers(); var dataProtectionBuilder = services.AddDataProtection(op => op.ApplicationDiscriminator = Configuration["ApplicationDiscriminator"]) .SetApplicationName(Configuration["ApplicationName"]) .PersistKeysToFileSystem(new DirectoryInfo(Configuration["KeyPath"])); @@ -125,6 +126,7 @@ namespace Bootstrap.Admin app.UseStaticFiles(); app.UseAuthentication(); app.UseBootstrapAdminAuthorization(RoleHelper.RetrieveRolesByUserName, RoleHelper.RetrieveRolesByUrl, AppHelper.RetrievesByUserName); + app.UseOnlineUsers(); app.UseCacheManagerCorsHandler(); app.UseSignalR(routes => { routes.MapHub("/NotiHub"); }); app.UseMvc(routes => From 13cafbc41145f447199a4db9d821824cca9c9437 Mon Sep 17 00:00:00 2001 From: Argo-Windows <5196060@qq.com> Date: Fri, 1 Mar 2019 02:00:47 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E9=A1=B5=E9=9D=A2?= =?UTF-8?q?=EF=BC=9A=E5=A2=9E=E5=8A=A0=E5=9C=A8=E7=BA=BF=E7=94=A8=E6=88=B7?= =?UTF-8?q?Online=E8=A7=86=E5=9B=BE=E9=A1=B5=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controllers/AdminController.cs | 6 +++ .../Controllers/Api/OnlineUsersController.cs | 19 ++++++- Bootstrap.Admin/OnlineUsers/OnlineUser.cs | 11 ++-- .../OnlineUsersMiddlewareExtensions.cs | 5 +- Bootstrap.Admin/Views/Admin/Online.cshtml | 29 +++++++++++ Bootstrap.Admin/wwwroot/js/online.js | 52 +++++++++++++++++++ 6 files changed, 115 insertions(+), 7 deletions(-) create mode 100644 Bootstrap.Admin/Views/Admin/Online.cshtml create mode 100644 Bootstrap.Admin/wwwroot/js/online.js diff --git a/Bootstrap.Admin/Controllers/AdminController.cs b/Bootstrap.Admin/Controllers/AdminController.cs index 270b1772..a4ea5266 100644 --- a/Bootstrap.Admin/Controllers/AdminController.cs +++ b/Bootstrap.Admin/Controllers/AdminController.cs @@ -108,6 +108,12 @@ namespace Bootstrap.Admin.Controllers /// public ActionResult Mobile() => View(new NavigatorBarModel(this)); + /// + /// 在线用户 + /// + /// + public ActionResult Online() => View(new NavigatorBarModel(this)); + /// /// 用于测试ExceptionFilter /// diff --git a/Bootstrap.Admin/Controllers/Api/OnlineUsersController.cs b/Bootstrap.Admin/Controllers/Api/OnlineUsersController.cs index 131969eb..55409a44 100644 --- a/Bootstrap.Admin/Controllers/Api/OnlineUsersController.cs +++ b/Bootstrap.Admin/Controllers/Api/OnlineUsersController.cs @@ -1,17 +1,19 @@ using Microsoft.AspNetCore.Mvc; +using System; using System.Collections.Generic; +using System.Linq; namespace Bootstrap.Admin.Controllers.Api { /// - /// + /// 在线用户接口 /// [Route("api/[controller]")] [ApiController] public class OnlineUsersController : ControllerBase { /// - /// + /// 获取所有在线用户数据 /// /// [HttpPost()] @@ -19,5 +21,18 @@ namespace Bootstrap.Admin.Controllers.Api { return onlineUSers.OnlineUsers; } + + /// + /// 获取指定IP地址的在线用户请求地址明细数据 + /// + /// + /// + /// + [HttpGet("{id}")] + public IEnumerable> Get(string id, [FromServices]IOnlineUsers onlineUSers) + { + var user = onlineUSers.OnlineUsers.FirstOrDefault(u => u.Ip == id); + return user?.RequestUrls ?? new KeyValuePair[0]; + } } } diff --git a/Bootstrap.Admin/OnlineUsers/OnlineUser.cs b/Bootstrap.Admin/OnlineUsers/OnlineUser.cs index 39720d73..5e783877 100644 --- a/Bootstrap.Admin/OnlineUsers/OnlineUser.cs +++ b/Bootstrap.Admin/OnlineUsers/OnlineUser.cs @@ -17,12 +17,10 @@ namespace Bootstrap.Admin /// /// /// - /// - public OnlineUser(string ip, string userName, string method) + public OnlineUser(string ip, string userName) { Ip = ip; UserName = userName; - Method = method; FirstAccessTime = DateTime.Now; LastAccessTime = DateTime.Now; _requestUrls = new ConcurrentQueue>(); @@ -53,6 +51,11 @@ namespace Bootstrap.Admin /// public string Ip { get; set; } + /// + /// + /// + public string RequestUrl { get; set; } + /// /// /// @@ -71,7 +74,7 @@ namespace Bootstrap.Admin public void AddRequestUrl(string url) { _requestUrls.Enqueue(new KeyValuePair(DateTime.Now, url)); - if (_requestUrls.Count > 10) + if (_requestUrls.Count > 5) { _requestUrls.TryDequeue(out _); } diff --git a/Bootstrap.Admin/OnlineUsers/OnlineUsersMiddlewareExtensions.cs b/Bootstrap.Admin/OnlineUsers/OnlineUsersMiddlewareExtensions.cs index 9275d165..c1783293 100644 --- a/Bootstrap.Admin/OnlineUsers/OnlineUsersMiddlewareExtensions.cs +++ b/Bootstrap.Admin/OnlineUsers/OnlineUsersMiddlewareExtensions.cs @@ -25,13 +25,16 @@ namespace Microsoft.AspNetCore.Builder var clientIp = context.Connection.RemoteIpAddress.ToString(); onlineUsers.AddOrUpdate(clientIp, key => { - var ou = new OnlineUser(key, context.User.Identity.Name, context.Request.Method); + var ou = new OnlineUser(key, context.User.Identity.Name); + ou.Method = context.Request.Method; + ou.RequestUrl = context.Request.Path; ou.AddRequestUrl(context.Request.Path); return ou; }, (key, v) => { v.LastAccessTime = DateTime.Now; v.Method = context.Request.Method; + v.RequestUrl = context.Request.Path; v.AddRequestUrl(context.Request.Path); return v; }); diff --git a/Bootstrap.Admin/Views/Admin/Online.cshtml b/Bootstrap.Admin/Views/Admin/Online.cshtml new file mode 100644 index 00000000..57cd7357 --- /dev/null +++ b/Bootstrap.Admin/Views/Admin/Online.cshtml @@ -0,0 +1,29 @@ +@model NavigatorBarModel +@{ + ViewBag.Title = "在线用户"; +} +@section css { + + + + + + +} +@section javascript { + + + + + + + + + +} +
+
在线用户
+
+
+
+
\ No newline at end of file diff --git a/Bootstrap.Admin/wwwroot/js/online.js b/Bootstrap.Admin/wwwroot/js/online.js new file mode 100644 index 00000000..040a100a --- /dev/null +++ b/Bootstrap.Admin/wwwroot/js/online.js @@ -0,0 +1,52 @@ +$(function () { + var apiUrl = "api/OnlineUsers"; + var $table = $('table').smartTable({ + url: apiUrl, + method: "post", + sidePagination: "client", + showToggle: false, + showRefresh: false, + showColumns: false, + columns: [ + { + title: "序号", formatter: function (value, row, index) { + var options = $table.bootstrapTable('getOptions'); + return options.pageSize * (options.pageNumber - 1) + index + 1; + } + }, + { title: "登陆名称", field: "UserName" }, + { title: "显示名称", field: "DisplayName" }, + { title: "登录时间", field: "FirstAccessTime" }, + { title: "最近操作时间", field: "LastAccessTime" }, + { title: "请求方式", field: "Method" }, + { title: "IP地址", field: "Ip" }, + { title: "访问地址", field: "RequestUrl" }, + { + title: "历史地址", field: "Ip", formatter: function (value, row, index, field) { + return $.format('', value); + } + } + ] + }).on('click', 'button[data-id]', function () { + var $this = $(this); + if (!$this.data($.fn.popover.Constructor.DATA_KEY)) { + var id = $this.attr('data-id'); + $.bc({ + id: id, url: apiUrl, + callback: function (result) { + if (!result) return; + var content = result.map(function (item) { + return $.format("{0}{1}", item.Key, item.Value); + }).join(''); + content = $.format('
{0}
访问时间访问地址
', content); + $this.lgbPopover({ content: content, placement: $(window).width() < 768 ? 'top' : 'left' }); + $this.popover('show'); + } + }); + } + }); + + $('#refreshUsers').tooltip().on('click', function () { + $table.bootstrapTable('refresh'); + }); +}); \ No newline at end of file From 68c77a6b49785aece8e5bf8748453d3969f7582a Mon Sep 17 00:00:00 2001 From: Argo-Windows <5196060@qq.com> Date: Fri, 1 Mar 2019 02:19:19 +0800 Subject: [PATCH 3/3] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E8=84=9A=E6=9C=AC?= =?UTF-8?q?=EF=BC=9A=E6=9B=B4=E6=96=B0=E6=95=B0=E6=8D=AE=E5=BA=93=E8=84=9A?= =?UTF-8?q?=E6=9C=AC=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- DatabaseScripts/InitData.sql | 3 ++- .../MongoDB/BootstrapAdmin.Navigations.json | 14 +++++++++++++- DatabaseScripts/MySQL/initData.sql | 3 ++- DatabaseScripts/Postgresql/initData.sql | 3 ++- DatabaseScripts/SQLite/InitData.sql | 3 ++- 5 files changed, 21 insertions(+), 5 deletions(-) diff --git a/DatabaseScripts/InitData.sql b/DatabaseScripts/InitData.sql index 853b8538..68719da3 100644 --- a/DatabaseScripts/InitData.sql +++ b/DatabaseScripts/InitData.sql @@ -46,7 +46,8 @@ INSERT [dbo].[Navigations] ([ID], [ParentId], [Name], [Order], [Icon], [Url], [C INSERT [dbo].[Navigations] ([ID], [ParentId], [Name], [Order], [Icon], [Url], [Category]) VALUES (11, 0, N'任务管理', 110, N'fa fa fa-tasks', N'~/Admin/Tasks', N'0') INSERT [dbo].[Navigations] ([ID], [ParentId], [Name], [Order], [Icon], [Url], [Category]) VALUES (12, 0, N'通知管理', 120, N'fa fa-bell', N'~/Admin/Notifications', N'0') INSERT [dbo].[Navigations] ([ID], [ParentId], [Name], [Order], [Icon], [Url], [Category]) VALUES (13, 0, N'系统日志', 130, N'fa fa-gears', N'~/Admin/Logs', N'0') -INSERT [dbo].[Navigations] ([ID], [ParentId], [Name], [Order], [Icon], [Url], [Category]) VALUES (14, 0, N'程序异常', 140, N'fa fa-cubes', N'~/Admin/Exceptions', N'0') +INSERT [dbo].[Navigations] ([ID], [ParentId], [Name], [Order], [Icon], [Url], [Category]) VALUES (14, 0, N'在线用户', 140, N'fa fa-users', N'~/Admin/Online', N'0') +INSERT [dbo].[Navigations] ([ID], [ParentId], [Name], [Order], [Icon], [Url], [Category]) VALUES (15, 0, N'程序异常', 150, N'fa fa-cubes', N'~/Admin/Exceptions', N'0') INSERT [dbo].[Navigations] ([ID], [ParentId], [Name], [Order], [Icon], [Url], [Category]) VALUES (16, 0, N'工具集合', 160, N'fa fa-gavel', N'#', N'0') INSERT [dbo].[Navigations] ([ID], [ParentId], [Name], [Order], [Icon], [Url], [Category]) VALUES (17, 16, N'客户端测试', 10, N'fa fa-wrench', N'~/Admin/Mobile', N'0') INSERT [dbo].[Navigations] ([ID], [ParentId], [Name], [Order], [Icon], [Url], [Category]) VALUES (18, 16, N'API文档', 10, N'fa fa-wrench', N'~/swagger', N'0') diff --git a/DatabaseScripts/MongoDB/BootstrapAdmin.Navigations.json b/DatabaseScripts/MongoDB/BootstrapAdmin.Navigations.json index fd27cc74..e00a5823 100644 --- a/DatabaseScripts/MongoDB/BootstrapAdmin.Navigations.json +++ b/DatabaseScripts/MongoDB/BootstrapAdmin.Navigations.json @@ -155,11 +155,23 @@ "IsResource": NumberInt(0), "Application": "0" }, + { + "_id": ObjectId("5bd7b8445fa31256f77e4b89"), + "ParentId": "0", + "Name": "在线用户", + "Order": NumberInt(140), + "Icon": "fa fa-users", + "Url": "~/Admin/Online", + "Category": "0", + "Target": "_self", + "IsResource": NumberInt(0), + "Application": "0" + }, { "_id": ObjectId("5bd7b8445fa31256f77e4b9d"), "ParentId": "0", "Name": "程序异常", - "Order": NumberInt(140), + "Order": NumberInt(150), "Icon": "fa fa-cubes", "Url": "~/Admin/Exceptions", "Category": "0", diff --git a/DatabaseScripts/MySQL/initData.sql b/DatabaseScripts/MySQL/initData.sql index 014cecd3..d02e41e7 100644 --- a/DatabaseScripts/MySQL/initData.sql +++ b/DatabaseScripts/MySQL/initData.sql @@ -43,7 +43,8 @@ INSERT INTO Navigations (ID, ParentId, Name, `Order`, Icon, Url, Category) VALUE INSERT INTO Navigations (ID, ParentId, Name, `Order`, Icon, Url, Category) VALUES (11, 0, '任务管理', 110, 'fa fa fa-tasks', '~/Admin/Tasks', '0'); INSERT INTO Navigations (ID, ParentId, Name, `Order`, Icon, Url, Category) VALUES (12, 0, '通知管理', 120, 'fa fa-bell', '~/Admin/Notifications', '0'); INSERT INTO Navigations (ID, ParentId, Name, `Order`, Icon, Url, Category) VALUES (13, 0, '系统日志', 130, 'fa fa-gears', '~/Admin/Logs', '0'); -INSERT INTO Navigations (ID, ParentId, Name, `Order`, Icon, Url, Category) VALUES (14, 0, '程序异常', 140, 'fa fa-cubes', '~/Admin/Exceptions', '0'); +INSERT INTO Navigations (ID, ParentId, Name, `Order`, Icon, Url, Category) VALUES (14, 0, '在线用户', 140, 'fa fa-users', '~/Admin/Online', '0'); +INSERT INTO Navigations (ID, ParentId, Name, `Order`, Icon, Url, Category) VALUES (15, 0, '程序异常', 150, 'fa fa-cubes', '~/Admin/Exceptions', '0'); INSERT INTO Navigations (ID, ParentId, Name, `Order`, Icon, Url, Category) VALUES (16, 0, '工具集合', 160, 'fa fa-gavel', '#', '0'); INSERT INTO Navigations (ID, ParentId, Name, `Order`, Icon, Url, Category) VALUES (17, 16, '客户端测试', 10, 'fa fa-wrench', '~/Admin/Mobile', '0'); INSERT INTO Navigations (ID, ParentId, Name, `Order`, Icon, Url, Category) VALUES (18, 16, 'API文档', 10, 'fa fa-wrench', '~/swagger', '0'); diff --git a/DatabaseScripts/Postgresql/initData.sql b/DatabaseScripts/Postgresql/initData.sql index 2ff02fa1..abbcc8ab 100644 --- a/DatabaseScripts/Postgresql/initData.sql +++ b/DatabaseScripts/Postgresql/initData.sql @@ -43,7 +43,8 @@ INSERT INTO Navigations (ParentId, Name, "order", Icon, Url, Category) VALUES (0 INSERT INTO Navigations (ParentId, Name, "order", Icon, Url, Category) VALUES (0, '任务管理', 110, 'fa fa fa-tasks', '~/Admin/Tasks', '0'); INSERT INTO Navigations (ParentId, Name, "order", Icon, Url, Category) VALUES (0, '通知管理', 120, 'fa fa-bell', '~/Admin/Notifications', '0'); INSERT INTO Navigations (ParentId, Name, "order", Icon, Url, Category) VALUES (0, '系统日志', 130, 'fa fa-gears', '~/Admin/Logs', '0'); -INSERT INTO Navigations (ParentId, Name, "order", Icon, Url, Category) VALUES (0, '程序异常', 140, 'fa fa-cubes', '~/Admin/Exceptions', '0'); +INSERT INTO Navigations (ParentId, Name, "order", Icon, Url, Category) VALUES (0, '在线用户', 140, 'fa fa-users', '~/Admin/Online', '0'); +INSERT INTO Navigations (ParentId, Name, "order", Icon, Url, Category) VALUES (0, '程序异常', 150, 'fa fa-cubes', '~/Admin/Exceptions', '0'); INSERT INTO Navigations (ParentId, Name, "order", Icon, Url, Category) VALUES (0, '工具集合', 160, 'fa fa-gavel', '#', '0'); INSERT INTO Navigations (ParentId, Name, "order", Icon, Url, Category) VALUES (currval('navigations_id_seq') - 1, '客户端测试', 10, 'fa fa-wrench', '~/Admin/Mobile', '0'); INSERT INTO Navigations (ParentId, Name, "order", Icon, Url, Category) VALUES (currval('navigations_id_seq') - 2, 'API文档', 10, 'fa fa-wrench', '~/swagger', '0'); diff --git a/DatabaseScripts/SQLite/InitData.sql b/DatabaseScripts/SQLite/InitData.sql index 9d881338..fadaf135 100644 --- a/DatabaseScripts/SQLite/InitData.sql +++ b/DatabaseScripts/SQLite/InitData.sql @@ -40,7 +40,8 @@ INSERT INTO [Navigations] ([ID], [ParentId], [Name], [Order], [Icon], [Url], [Ca INSERT INTO [Navigations] ([ID], [ParentId], [Name], [Order], [Icon], [Url], [Category]) VALUES (11, 0, '任务管理', 110, 'fa fa fa-tasks', '~/Admin/Tasks', '0'); INSERT INTO [Navigations] ([ID], [ParentId], [Name], [Order], [Icon], [Url], [Category]) VALUES (12, 0, '通知管理', 120, 'fa fa-bell', '~/Admin/Notifications', '0'); INSERT INTO [Navigations] ([ID], [ParentId], [Name], [Order], [Icon], [Url], [Category]) VALUES (13, 0, '系统日志', 130, 'fa fa-gears', '~/Admin/Logs', '0'); -INSERT INTO [Navigations] ([ID], [ParentId], [Name], [Order], [Icon], [Url], [Category]) VALUES (14, 0, '程序异常', 140, 'fa fa-cubes', '~/Admin/Exceptions', '0'); +INSERT INTO [Navigations] ([ID], [ParentId], [Name], [Order], [Icon], [Url], [Category]) VALUES (14, 0, '在线用户', 140, 'fa fa-users', '~/Admin/Online', '0'); +INSERT INTO [Navigations] ([ID], [ParentId], [Name], [Order], [Icon], [Url], [Category]) VALUES (15, 0, '程序异常', 150, 'fa fa-cubes', '~/Admin/Exceptions', '0'); INSERT INTO [Navigations] ([ID], [ParentId], [Name], [Order], [Icon], [Url], [Category]) VALUES (16, 0, '工具集合', 160, 'fa fa-gavel', '#', '0'); INSERT INTO [Navigations] ([ID], [ParentId], [Name], [Order], [Icon], [Url], [Category]) VALUES (17, 16, '客户端测试', 10, 'fa fa-wrench', '~/Admin/Mobile', '0'); INSERT INTO [Navigations] ([ID], [ParentId], [Name], [Order], [Icon], [Url], [Category]) VALUES (18, 16, 'API文档', 10, 'fa fa-wrench', '~/swagger', '0');