anycmd 4 år sedan
förälder
incheckning
f4a847bc92
34 ändrade filer med 219 tillägg och 307 borttagningar
  1. 0 4
      src/AppModels/AppStatic.cs
  2. 1 1
      src/AppModels/MinerStudio/Vms/ActionCountsViewModel.cs
  3. 1 1
      src/AppModels/MinerStudio/Vms/GpuNameCountsViewModel.cs
  4. 1 1
      src/AppModels/MinerStudio/Vms/WsServerNodePageViewModel.cs
  5. 0 10
      src/AppViews0/Views/Ucs/MainMenu.xaml
  6. 0 10
      src/NTMiner.Controllers/IActionCountController.cs
  7. 26 1
      src/NTMiner.Controllers/IAdminController.cs
  8. 0 10
      src/NTMiner.Controllers/IGpuNameController.cs
  9. 0 14
      src/NTMiner.Controllers/IMqCountController.cs
  10. 0 10
      src/NTMiner.Controllers/IRemoteIpController.cs
  11. 0 10
      src/NTMiner.Controllers/IWebApiServerNodeController.cs
  12. 0 5
      src/NTMiner.Controllers/NTMiner.Controllers.csproj
  13. 1 1
      src/NTMinerClient/Cpus/Impl/CpuPackage.cs
  14. 2 2
      src/NTMinerHub/Anonymous.cs
  15. 1 1
      src/NTMinerHub/Hub/IEvent.cs
  16. 20 1
      src/NTMinerHub/Hub/IMessagePathHub.cs
  17. 17 2
      src/NTMinerHub/Hub/IMessagePathId.cs
  18. 8 8
      src/NTMinerHub/Hub/MessagePathHub.cs
  19. 1 1
      src/NTMinerHub/NTMinerHub.csproj
  20. 1 4
      src/NTMinerRpcClient/NTMinerRpcClient.csproj
  21. 0 22
      src/NTMinerRpcClient/Services/Official/ActionCountService.cs
  22. 69 0
      src/NTMinerRpcClient/Services/Official/AdminService.cs
  23. 0 22
      src/NTMinerRpcClient/Services/Official/GpuNameService.cs
  24. 0 36
      src/NTMinerRpcClient/Services/Official/MqCountService.cs
  25. 0 22
      src/NTMinerRpcClient/Services/Official/WebApiServerNodeService.cs
  26. 1 4
      src/NTMinerRpcClient/Services/OfficialServices.cs
  27. 1 1
      src/NTMinerlib/VirtualRoot.partials.Common.cs
  28. 0 18
      src/WebApiServer/Controllers/ActionCountController.cs
  29. 68 1
      src/WebApiServer/Controllers/AdminController.cs
  30. 0 18
      src/WebApiServer/Controllers/GpuNameController.cs
  31. 0 23
      src/WebApiServer/Controllers/MqCountController.cs
  32. 0 17
      src/WebApiServer/Controllers/RemoteIpController.cs
  33. 0 21
      src/WebApiServer/Controllers/WebApiServerNodeController.cs
  34. 0 5
      src/WebApiServer/WebApiServer.csproj

+ 0 - 4
src/AppModels/AppStatic.cs

@@ -493,10 +493,6 @@ namespace NTMiner {
             Process.Start("control.exe", "system");
         });
 
-        public static ICommand ShowServerKernelOutputKeywords { get; private set; } = new DelegateCommand(() => {
-
-        });
-
         public static ICommand ShowSignUpPage { get; private set; } = new DelegateCommand(() => {
             VirtualRoot.Execute(new ShowSignUpPageCommand());
         });

+ 1 - 1
src/AppModels/MinerStudio/Vms/ActionCountsViewModel.cs

@@ -37,7 +37,7 @@ namespace NTMiner.MinerStudio.Vms {
         }
 
         public void Query() {
-            RpcRoot.OfficialServer.ActionCountService.QueryActionCountsAsync(new QueryActionCountsRequest {
+            RpcRoot.OfficialServer.AdminService.QueryActionCountsAsync(new QueryActionCountsRequest {
                 PageIndex = this.PageIndex,
                 PageSize = this.PageSize,
                 Keyword = this.Keyword

+ 1 - 1
src/AppModels/MinerStudio/Vms/GpuNameCountsViewModel.cs

@@ -37,7 +37,7 @@ namespace NTMiner.MinerStudio.Vms {
         }
 
         public void Query() {
-            RpcRoot.OfficialServer.GpuNameService.QueryGpuNameCountsAsync(new QueryGpuNameCountsRequest {
+            RpcRoot.OfficialServer.AdminService.QueryGpuNameCountsAsync(new QueryGpuNameCountsRequest {
                 PageIndex = this.PageIndex,
                 PageSize = this.PageSize,
                 Keyword = this.Keyword

+ 1 - 1
src/AppModels/MinerStudio/Vms/WsServerNodePageViewModel.cs

@@ -19,7 +19,7 @@ namespace NTMiner.MinerStudio.Vms {
         }
 
         public void DoRefresh() {
-            RpcRoot.OfficialServer.WebApiServerNodeService.GetServerStateAsync((response, e) => {
+            RpcRoot.OfficialServer.AdminService.GetServerStateAsync((response, e) => {
                 if (response.IsSuccess()) {
                     UIThread.Execute(() => {
                         if (_webApiServerStateVm == null) {

+ 0 - 10
src/AppViews0/Views/Ucs/MainMenu.xaml

@@ -227,16 +227,6 @@
 							Stretch="Fill" />
                     </MenuItem.Icon>
                 </MenuItem>
-                <MenuItem Header="内核输出关键字" Command="{x:Static app:AppStatic.ShowServerKernelOutputKeywords}">
-                    <MenuItem.Icon>
-                        <Path
-							Width="16"
-							Height="16"
-							Data="{StaticResource Icon_KernelOutput}"
-							Fill="{StaticResource BtnBackground}"
-							Stretch="Fill" />
-                    </MenuItem.Icon>
-                </MenuItem>
                 <MenuItem Header="收益计算器设置" Command="{x:Static app:AppStatic.ShowCalcConfig}">
 					<MenuItem.Icon>
 						<Path

+ 0 - 10
src/NTMiner.Controllers/IActionCountController.cs

@@ -1,10 +0,0 @@
-using NTMiner.ServerNode;
-
-namespace NTMiner.Controllers {
-    public interface IActionCountController {
-        /// <summary>
-        /// 需签名
-        /// </summary>
-        QueryActionCountsResponse QueryActionCounts(QueryActionCountsRequest request);
-    }
-}

+ 26 - 1
src/NTMiner.Controllers/IAdminController.cs

@@ -1,4 +1,5 @@
-using NTMiner.ServerNode;
+using NTMiner.Gpus;
+using NTMiner.ServerNode;
 
 namespace NTMiner.Controllers {
     public interface IAdminController {
@@ -6,5 +7,29 @@ namespace NTMiner.Controllers {
         /// 需签名
         /// </summary>
         ResponseBase SetClientTestId(DataRequest<ClientTestIdData> request);
+        /// <summary>
+        /// 需签名
+        /// </summary>
+        QueryActionCountsResponse QueryActionCounts(QueryActionCountsRequest request);
+        /// <summary>
+        /// 需签名
+        /// </summary>
+        QueryGpuNameCountsResponse QueryGpuNameCounts(QueryGpuNameCountsRequest request);
+        /// <summary>
+        /// 需签名
+        /// </summary>
+        DataResponse<MqCountData[]> MqCounts();
+        /// <summary>
+        /// 需签名
+        /// </summary>
+        DataResponse<MqCountData> MqCount(DataRequest<string> request);
+        /// <summary>
+        /// 需签名
+        /// </summary>
+        TopNRemoteIpsResponse TopNRemoteIps(DataRequest<int> request);
+        /// <summary>
+        /// 需签名
+        /// </summary>
+        DataResponse<WebApiServerState> GetServerState(object request);
     }
 }

+ 0 - 10
src/NTMiner.Controllers/IGpuNameController.cs

@@ -1,10 +0,0 @@
-using NTMiner.Gpus;
-
-namespace NTMiner.Controllers {
-    public interface IGpuNameController {
-        /// <summary>
-        /// 需签名
-        /// </summary>
-        QueryGpuNameCountsResponse QueryGpuNameCounts(QueryGpuNameCountsRequest request);
-    }
-}

+ 0 - 14
src/NTMiner.Controllers/IMqCountController.cs

@@ -1,14 +0,0 @@
-using NTMiner.ServerNode;
-
-namespace NTMiner.Controllers {
-    public interface IMqCountController {
-        /// <summary>
-        /// 需签名
-        /// </summary>
-        DataResponse<MqCountData[]> MqCounts();
-        /// <summary>
-        /// 需签名
-        /// </summary>
-        DataResponse<MqCountData> MqCount(DataRequest<string> request);
-    }
-}

+ 0 - 10
src/NTMiner.Controllers/IRemoteIpController.cs

@@ -1,10 +0,0 @@
-using NTMiner.ServerNode;
-
-namespace NTMiner.Controllers {
-    public interface IRemoteIpController {
-        /// <summary>
-        /// 需签名
-        /// </summary>
-        TopNRemoteIpsResponse TopNRemoteIps(DataRequest<int> request);
-    }
-}

+ 0 - 10
src/NTMiner.Controllers/IWebApiServerNodeController.cs

@@ -1,10 +0,0 @@
-using NTMiner.ServerNode;
-
-namespace NTMiner.Controllers {
-    public interface IWebApiServerNodeController {
-        /// <summary>
-        /// 需签名
-        /// </summary>
-        DataResponse<WebApiServerState> GetServerState(object request);
-    }
-}

+ 0 - 5
src/NTMiner.Controllers/NTMiner.Controllers.csproj

@@ -38,20 +38,15 @@
   </ItemGroup>
   <ItemGroup>
     <Compile Include="ControllerUtil.cs" />
-    <Compile Include="IActionCountController.cs" />
     <Compile Include="IAdminController.cs" />
     <Compile Include="ICalcConfigBinaryController`1.cs" />
     <Compile Include="ICaptchaController`1.cs" />
     <Compile Include="IClientDataBinaryController`1.cs" />
-    <Compile Include="IGpuNameController.cs" />
     <Compile Include="IMinerClientController.cs" />
-    <Compile Include="IMqCountController.cs" />
     <Compile Include="INTMinerFileController.cs" />
-    <Compile Include="IRemoteIpController.cs" />
     <Compile Include="IReportBinaryController.cs" />
     <Compile Include="IServerMessageBinaryController`1.cs" />
     <Compile Include="IUserAppSettingController.cs" />
-    <Compile Include="IWebApiServerNodeController.cs" />
     <Compile Include="IWsServerNodeController.cs" />
     <Compile Include="IUserController.cs" />
     <Compile Include="IAppSettingController.cs" />

+ 1 - 1
src/NTMinerClient/Cpus/Impl/CpuPackage.cs

@@ -62,7 +62,7 @@ namespace NTMiner.Cpus.Impl {
                                     }
                                     if ((message.BornOn - LowPerformanceOn).TotalSeconds >= _minerProfile.HighCpuSeconds) {
                                         LowPerformanceOn = message.BornOn;
-                                        VirtualRoot.ThisLocalWarn(nameof(CpuPackage), $"CPU使用率过高:连续{_minerProfile.HighCpuSeconds.ToString()}秒不低于{_minerProfile.HighCpuBaseline.ToString()}%");
+                                        VirtualRoot.ThisLocalWarn(nameof(CpuPackage), $"CPU使用率过高:连续{_minerProfile.HighCpuSeconds.ToString()}秒不低于{_minerProfile.HighCpuBaseline.ToString()}%,如果有杀毒软件需关闭或卸载杀毒软件。");
                                     }
                                 }
                             });

+ 2 - 2
src/NTMinerHub/AnonymousMessagePath.cs → src/NTMinerHub/Anonymous.cs

@@ -1,10 +1,10 @@
 using System;
 
 namespace NTMiner {
-    public static class AnonymousMessagePath {
+    public static class Anonymous {
         /// <summary>
         /// 路径通常在同一地点是不应重复的,但个别正常需求确实会在同一地点重复创建相同的路径,比如借助Per1SecondEvent实现的SecondsDelay方法。
         /// </summary>
-        public static Type Location { get; } = typeof(AnonymousMessagePath);
+        public static Type Location { get; } = typeof(Anonymous);
     }
 }

+ 1 - 1
src/NTMinerHub/Hub/IEvent.cs

@@ -3,7 +3,7 @@
 
     public interface IEvent : IMessage {
         /// <summary>
-        /// 事件的目的路径,该事件将会被泵到该路径去,取值PathId.Empty表示不特定标识,只特定消息类型。
+        /// 事件的目的路径,该事件将会被泵到该路径去,取值PathId.Empty表示不特定标识,只特定消息类型。
         /// </summary>
         PathId TargetPathId { get; }
         /// <summary>

+ 20 - 1
src/NTMinerHub/Hub/IMessagePathHub.cs

@@ -8,7 +8,26 @@ namespace NTMiner.Hub {
     public interface IMessagePathHub {
         void Route<TMessage>(TMessage message) where TMessage : IMessage;
 
-        IMessagePathId AddPath<TMessage>(Type location, string description, LogEnum logType, PathId pathId, PathPriority priority, Action<TMessage> action, int viaTimesLimit = -1);
+        /// <summary>
+        /// 添加消息路径
+        /// </summary>
+        /// <typeparam name="TMessage">该消息路径可通行的消息的类型。</typeparam>
+        /// <param name="location"><see cref="IMessagePathId.Location"/></param>
+        /// <param name="description"><see cref="IMessagePathId.Description"/></param>
+        /// <param name="logType"><see cref="IMessagePathId.LogType"/></param>
+        /// <param name="pathId"><see cref="IMessagePathId.PathId"/></param>
+        /// <param name="priority"><see cref="IMessagePathId.Priority"/></param>
+        /// <param name="action">真正的下层的运行时层次的路径,CPU行走的路径,CPU行走在运行时的基本类型空间中,基本类型空间是比如int、bool、string等。</param>
+        /// <param name="viaTimesLimit"><see cref="IMessagePathId.ViaTimesLimit"/></param>
+        /// <returns></returns>
+        IMessagePathId AddPath<TMessage>(
+            Type location, 
+            string description, 
+            LogEnum logType, 
+            PathId pathId, 
+            PathPriority priority, 
+            Action<TMessage> action, 
+            int viaTimesLimit = -1);
 
         void RemovePath(IMessagePathId pathId);
 

+ 17 - 2
src/NTMinerHub/Hub/IMessagePathId.cs

@@ -3,19 +3,34 @@
 namespace NTMiner.Hub {
     
     public interface IMessagePathId {
+        /// <summary>
+        /// 该消息路径的标识,是个Guid。
+        /// </summary>
         PathId PathId { get; }
+        /// <summary>
+        /// 消息路径优先级,相同消息类型的路径可能有多条,该优先级定义了路径的行走顺序。
+        /// </summary>
         PathPriority Priority { get; }
         DateTime CreatedOn { get; }
         /// <summary>
-        /// 表示该条消息路径允许消息通过的次数
+        /// 该路径可以通行消息的次数,如果限定了次数则达到通行次数后路径消失,-1表示不限制次数。
         /// </summary>
         int ViaTimesLimit { get; }
         Type MessageType { get; }
         MessageTypeAttribute MessageTypeAttribute { get; }
         bool IsEnabled { get; set; }
+        /// <summary>
+        /// 该消息路径所处的位置(对程序员有意义的编码时源码位置,对运行时无意义)。
+        /// </summary>
         Type Location { get; }
-        string Path { get; }
+        string PathName { get; }
+        /// <summary>
+        /// 日志类型,表示消息每通过一次是否记录日志以及记录什么日志,对程序员编程时有意义对运行时无意义。
+        /// </summary>
         LogEnum LogType { get; }
+        /// <summary>
+        /// 描述该消息类型,对程序员编程时有意义,对运行时无意义。
+        /// </summary>
         string Description { get; }
     }
 }

+ 8 - 8
src/NTMinerHub/Hub/MessagePathHub.cs

@@ -153,13 +153,13 @@
                             throw new Exception($"一种命令只应被一个处理器处理:{typeof(TMessage).Name}");
                         }
                     }
-                    else if (messagePath.Location != AnonymousMessagePath.Location) {
-                        var paths = _messagePaths.Where(a => a.Path == messagePath.Path && a.PathId == messagePath.PathId && a.Priority == messagePath.Priority).ToArray();
+                    else if (messagePath.Location != Anonymous.Location) {
+                        var paths = _messagePaths.Where(a => a.PathName == messagePath.PathName && a.PathId == messagePath.PathId && a.Priority == messagePath.Priority).ToArray();
                         if (paths.Length != 0) {
                             foreach (var path in paths) {
-                                NTMinerConsole.DevWarn(() => $"重复的路径:{path.Path} {path.Description}");
+                                NTMinerConsole.DevWarn(() => $"重复的路径:{path.PathName} {path.Description}");
                             }
-                            NTMinerConsole.DevWarn(() => $"重复的路径:{messagePath.Path} {messagePath.Description}");
+                            NTMinerConsole.DevWarn(() => $"重复的路径:{messagePath.PathName} {messagePath.Description}");
                         }
                     }
                     _messagePaths.Add(messagePath);
@@ -173,7 +173,7 @@
                     if (item != null) {
                         _messagePaths.Remove(item);
                         Sort();
-                        NTMinerConsole.DevDebug(() => "拆除路径" + messagePathId.Path + messagePathId.Description);
+                        NTMinerConsole.DevDebug(() => "拆除路径" + messagePathId.PathName + messagePathId.Description);
                     }
                 }
             }
@@ -238,7 +238,7 @@
 
                 MessageType = messageType;
                 Location = location;
-                Path = path;
+                PathName = path;
                 Description = description;
                 LogType = logType;
                 PathId = pathId;
@@ -273,7 +273,7 @@
                 }
             }
             public Type Location { get; private set; }
-            public string Path { get; private set; }
+            public string PathName { get; private set; }
             public LogEnum LogType { get; private set; }
             public string Description { get; private set; }
             public bool IsEnabled {
@@ -291,7 +291,7 @@
                     _action?.Invoke(message);
                 }
                 catch (Exception e) {
-                    Logger.ErrorDebugLine(Path + ":" + e.Message, e);
+                    Logger.ErrorDebugLine(PathName + ":" + e.Message, e);
                 }
             }
         }

+ 1 - 1
src/NTMinerHub/NTMinerHub.csproj

@@ -37,7 +37,7 @@
     <Reference Include="System" />
   </ItemGroup>
   <ItemGroup>
-    <Compile Include="AnonymousMessagePath.cs" />
+    <Compile Include="Anonymous.cs" />
     <Compile Include="Hub\Cmd.cs" />
     <Compile Include="PathPriority.cs" />
     <Compile Include="Hub\SourcedEvent`1.cs" />

+ 1 - 4
src/NTMinerRpcClient/NTMinerRpcClient.csproj

@@ -81,15 +81,13 @@
     <Compile Include="RpcUser.cs" />
     <Compile Include="Rpc\Impl\JsonRpcHelper.cs" />
     <Compile Include="Services\ClientServices.cs" />
-    <Compile Include="Services\Official\ActionCountService.cs" />
+    <Compile Include="Services\Official\AdminService.cs" />
     <Compile Include="Services\Official\AppSettingService.cs" />
     <Compile Include="Services\Client\MinerStudioService.cs" />
     <Compile Include="Services\Client\NTMinerClientService.cs" />
     <Compile Include="Services\Client\NTMinerDaemonService.cs" />
     <Compile Include="Core\Impl\KernelOutputKeywordSet.cs" />
     <Compile Include="Services\Official\FileUrlService.cs" />
-    <Compile Include="Services\Official\GpuNameService.cs" />
-    <Compile Include="Services\Official\MqCountService.cs" />
     <Compile Include="Services\Official\NTMinerFileService.cs" />
     <Compile Include="Services\Official\NTMinerWalletService.cs" />
     <Compile Include="Services\OfficialServices.cs" />
@@ -100,7 +98,6 @@
     <Compile Include="Services\Official\ReportBinaryService.cs" />
     <Compile Include="Services\Official\UserAppSettingService.cs" />
     <Compile Include="Services\Official\UserService.cs" />
-    <Compile Include="Services\Official\WebApiServerNodeService.cs" />
     <Compile Include="Services\Official\WsServerNodeService.cs" />
     <Compile Include="Services\Official\ClientDataService.cs" />
     <Compile Include="Services\Official\UserMinerGroupService.cs" />

+ 0 - 22
src/NTMinerRpcClient/Services/Official/ActionCountService.cs

@@ -1,22 +0,0 @@
-using NTMiner.Controllers;
-using NTMiner.ServerNode;
-using System;
-
-namespace NTMiner.Services.Official {
-    public class ActionCountService {
-        private readonly string _controllerName = ControllerUtil.GetControllerName<IActionCountController>();
-
-        internal ActionCountService() { }
-
-        public void QueryActionCountsAsync(QueryActionCountsRequest request, Action<QueryActionCountsResponse, Exception> callback) {
-            RpcRoot.JsonRpc.SignPostAsync(
-                RpcRoot.OfficialServerHost,
-                RpcRoot.OfficialServerPort,
-                _controllerName,
-                nameof(IActionCountController.QueryActionCounts),
-                request,
-                callback,
-                timeountMilliseconds: 5 * 1000);
-        }
-    }
-}

+ 69 - 0
src/NTMinerRpcClient/Services/Official/AdminService.cs

@@ -0,0 +1,69 @@
+using NTMiner.Controllers;
+using NTMiner.Gpus;
+using NTMiner.ServerNode;
+using System;
+
+namespace NTMiner.Services.Official {
+    public class AdminService {
+        private readonly string _controllerName = ControllerUtil.GetControllerName<IAdminController>();
+
+        internal AdminService() { }
+
+        public void QueryActionCountsAsync(QueryActionCountsRequest request, Action<QueryActionCountsResponse, Exception> callback) {
+            RpcRoot.JsonRpc.SignPostAsync(
+                RpcRoot.OfficialServerHost,
+                RpcRoot.OfficialServerPort,
+                _controllerName,
+                nameof(IAdminController.QueryActionCounts),
+                request,
+                callback,
+                timeountMilliseconds: 5 * 1000);
+        }
+
+        public void QueryGpuNameCountsAsync(QueryGpuNameCountsRequest request, Action<QueryGpuNameCountsResponse, Exception> callback) {
+            RpcRoot.JsonRpc.SignPostAsync(
+                RpcRoot.OfficialServerHost,
+                RpcRoot.OfficialServerPort,
+                _controllerName,
+                nameof(IAdminController.QueryGpuNameCounts),
+                request,
+                callback,
+                timeountMilliseconds: 5 * 1000);
+        }
+
+        public void GetMqCountsAsync(Action<DataResponse<MqCountData[]>, Exception> callback) {
+            RpcRoot.JsonRpc.SignPostAsync(
+                RpcRoot.OfficialServerHost,
+                RpcRoot.OfficialServerPort,
+                _controllerName,
+                nameof(IAdminController.MqCounts),
+                null,
+                callback,
+                timeountMilliseconds: 5 * 1000);
+        }
+
+        public void GetMqCountAsync(string appId, Action<DataResponse<MqCountData>, Exception> callback) {
+            DataRequest<string> request = new DataRequest<string> {
+                Data = appId
+            };
+            RpcRoot.JsonRpc.SignPostAsync(
+                RpcRoot.OfficialServerHost,
+                RpcRoot.OfficialServerPort,
+                _controllerName,
+                nameof(IAdminController.MqCount),
+                request,
+                callback,
+                timeountMilliseconds: 5 * 1000);
+        }
+
+        public void GetServerStateAsync(Action<DataResponse<WebApiServerState>, Exception> callback) {
+            RpcRoot.JsonRpc.SignPostAsync(
+                RpcRoot.OfficialServerHost,
+                RpcRoot.OfficialServerPort,
+                _controllerName,
+                nameof(IAdminController.GetServerState),
+                new object(),
+                callback);
+        }
+    }
+}

+ 0 - 22
src/NTMinerRpcClient/Services/Official/GpuNameService.cs

@@ -1,22 +0,0 @@
-using NTMiner.Controllers;
-using NTMiner.Gpus;
-using System;
-
-namespace NTMiner.Services.Official {
-    public class GpuNameService {
-        private readonly string _controllerName = ControllerUtil.GetControllerName<IGpuNameController>();
-
-        internal GpuNameService() { }
-
-        public void QueryGpuNameCountsAsync(QueryGpuNameCountsRequest request, Action<QueryGpuNameCountsResponse, Exception> callback) {
-            RpcRoot.JsonRpc.SignPostAsync(
-                RpcRoot.OfficialServerHost, 
-                RpcRoot.OfficialServerPort, 
-                _controllerName, 
-                nameof(IGpuNameController.QueryGpuNameCounts), 
-                request, 
-                callback, 
-                timeountMilliseconds: 5 * 1000);
-        }
-    }
-}

+ 0 - 36
src/NTMinerRpcClient/Services/Official/MqCountService.cs

@@ -1,36 +0,0 @@
-using NTMiner.Controllers;
-using NTMiner.ServerNode;
-using System;
-
-namespace NTMiner.Services.Official {
-    public class MqCountService {
-        private readonly string _controllerName = ControllerUtil.GetControllerName<IMqCountController>();
-
-        internal MqCountService() { }
-
-        public void GetMqCountsAsync(Action<DataResponse<MqCountData[]>, Exception> callback) {
-            RpcRoot.JsonRpc.SignPostAsync(
-                RpcRoot.OfficialServerHost,
-                RpcRoot.OfficialServerPort,
-                _controllerName,
-                nameof(IMqCountController.MqCounts),
-                null,
-                callback,
-                timeountMilliseconds: 5 * 1000);
-        }
-
-        public void GetMqCountAsync(string appId, Action<DataResponse<MqCountData>, Exception> callback) {
-            DataRequest<string> request = new DataRequest<string> {
-                Data = appId
-            };
-            RpcRoot.JsonRpc.SignPostAsync(
-                RpcRoot.OfficialServerHost,
-                RpcRoot.OfficialServerPort,
-                _controllerName,
-                nameof(IMqCountController.MqCount),
-                request,
-                callback,
-                timeountMilliseconds: 5 * 1000);
-        }
-    }
-}

+ 0 - 22
src/NTMinerRpcClient/Services/Official/WebApiServerNodeService.cs

@@ -1,22 +0,0 @@
-using NTMiner.Controllers;
-using NTMiner.ServerNode;
-using System;
-
-namespace NTMiner.Services.Official {
-    public class WebApiServerNodeService {
-        private readonly string _controllerName = ControllerUtil.GetControllerName<IWebApiServerNodeController>();
-
-        internal WebApiServerNodeService() {
-        }
-
-        public void GetServerStateAsync(Action<DataResponse<WebApiServerState>, Exception> callback) {
-            RpcRoot.JsonRpc.SignPostAsync(
-                RpcRoot.OfficialServerHost, 
-                RpcRoot.OfficialServerPort, 
-                _controllerName, 
-                nameof(IWebApiServerNodeController.GetServerState), 
-                new object(), 
-                callback);
-        }
-    }
-}

+ 1 - 4
src/NTMinerRpcClient/Services/OfficialServices.cs

@@ -3,7 +3,6 @@
 
     public class OfficialServices {
         public readonly WsServerNodeService WsServerNodeService = new WsServerNodeService();
-        public readonly WebApiServerNodeService WebApiServerNodeService = new WebApiServerNodeService();
         public readonly FileUrlService FileUrlService = new FileUrlService();
         public readonly NTMinerFileService NTMinerFileService = new NTMinerFileService();
         public readonly OverClockDataService OverClockDataService = new OverClockDataService();
@@ -19,9 +18,7 @@
         public readonly ClientDataService ClientDataService = new ClientDataService();
         public readonly UserMinerGroupService UserMinerGroupService = new UserMinerGroupService();
         public readonly UserMineWorkService UserMineWorkService = new UserMineWorkService();
-        public readonly GpuNameService GpuNameService = new GpuNameService();
-        public readonly ActionCountService ActionCountService = new ActionCountService();
-        public readonly MqCountService MqCountService = new MqCountService();
+        public readonly AdminService AdminService = new AdminService();
 
         internal OfficialServices() {
         }

+ 1 - 1
src/NTMinerlib/VirtualRoot.partials.Common.cs

@@ -132,7 +132,7 @@ namespace NTMiner {
 
         public static Task SecondsDelay(this int n) {
             var tcs = new TaskCompletionSource<object>();
-            BuildViaTimesLimitPath<Per1SecondEvent>("倒计时", LogEnum.None, viaTimesLimit: n, AnonymousMessagePath.Location, PathPriority.Normal, message => {
+            BuildViaTimesLimitPath<Per1SecondEvent>("倒计时", LogEnum.None, viaTimesLimit: n, Anonymous.Location, PathPriority.Normal, message => {
                 n--;
                 if (n == 0) {
                     tcs.SetResult(null);

+ 0 - 18
src/WebApiServer/Controllers/ActionCountController.cs

@@ -1,18 +0,0 @@
-using NTMiner.ServerNode;
-using System.Web.Http;
-
-namespace NTMiner.Controllers {
-    public class ActionCountController : ApiControllerBase, IActionCountController {
-        [Role.Admin]
-        [HttpPost]
-        public QueryActionCountsResponse QueryActionCounts([FromBody] QueryActionCountsRequest request) {
-            if (request == null) {
-                return ResponseBase.InvalidInput<QueryActionCountsResponse>("参数错误");
-            }
-            request.PagingTrim();
-            var data = ActionCountRoot.QueryActionCounts(request, out int total);
-
-            return QueryActionCountsResponse.Ok(data, total);
-        }
-    }
-}

+ 68 - 1
src/WebApiServer/Controllers/AdminController.cs

@@ -1,5 +1,7 @@
-using NTMiner.ServerNode;
+using NTMiner.Gpus;
+using NTMiner.ServerNode;
 using System;
+using System.Linq;
 using System.Web.Http;
 
 namespace NTMiner.Controllers {
@@ -21,5 +23,70 @@ namespace NTMiner.Controllers {
                 return ResponseBase.ServerError(e.Message);
             }
         }
+
+        [Role.Admin]
+        [HttpPost]
+        public QueryActionCountsResponse QueryActionCounts([FromBody] QueryActionCountsRequest request) {
+            if (request == null) {
+                return ResponseBase.InvalidInput<QueryActionCountsResponse>("参数错误");
+            }
+            request.PagingTrim();
+            var data = ActionCountRoot.QueryActionCounts(request, out int total);
+
+            return QueryActionCountsResponse.Ok(data, total);
+        }
+
+        [Role.Admin]
+        [HttpPost]
+        public QueryGpuNameCountsResponse QueryGpuNameCounts([FromBody] QueryGpuNameCountsRequest request) {
+            if (request == null) {
+                return ResponseBase.InvalidInput<QueryGpuNameCountsResponse>("参数错误");
+            }
+            request.PagingTrim();
+            var data = AppRoot.GpuNameSet.QueryGpuNameCounts(request, out int total);
+
+            return QueryGpuNameCountsResponse.Ok(data, total);
+        }
+
+        [Role.Admin]
+        [HttpPost]
+        public DataResponse<MqCountData[]> MqCounts() {
+            var data = AppRoot.MqCountSet.GetAll();
+            return DataResponse<MqCountData[]>.Ok(data);
+        }
+
+        [Role.Admin]
+        [HttpPost]
+        public DataResponse<MqCountData> MqCount(DataRequest<string> request) {
+            if (request == null || string.IsNullOrEmpty(request.Data)) {
+                return ResponseBase.InvalidInput<DataResponse<MqCountData>>("参数错误");
+            }
+            MqCountData data = AppRoot.MqCountSet.GetByAppId(request.Data);
+            return DataResponse<MqCountData>.Ok(data);
+        }
+
+        [Role.Admin]
+        [HttpPost]
+        public TopNRemoteIpsResponse TopNRemoteIps([FromBody] DataRequest<int> request) {
+            if (request == null || request.Data <= 0) {
+                return ResponseBase.InvalidInput<TopNRemoteIpsResponse>("参数错误");
+            }
+            var data = ServerRoot.RemoteIpSet.GetTopNRemoteIpEntries(request.Data).Select(a => a.ToDto()).ToList();
+            return TopNRemoteIpsResponse.Ok(data, ServerRoot.RemoteIpSet.Count);
+        }
+
+        [Role.Admin]
+        [HttpPost]
+        public DataResponse<WebApiServerState> GetServerState([FromBody] object request) {
+            if (request == null) {
+                return ResponseBase.InvalidInput<DataResponse<WebApiServerState>>("参数错误");
+            }
+            return new DataResponse<WebApiServerState> {
+                StateCode = 200,
+                ReasonPhrase = "Ok",
+                Description = "成功",
+                Data = AppRoot.GetServerState()
+            };
+        }
     }
 }

+ 0 - 18
src/WebApiServer/Controllers/GpuNameController.cs

@@ -1,18 +0,0 @@
-using NTMiner.Gpus;
-using System.Web.Http;
-
-namespace NTMiner.Controllers {
-    public class GpuNameController : ApiControllerBase, IGpuNameController {
-        [Role.Admin]
-        [HttpPost]
-        public QueryGpuNameCountsResponse QueryGpuNameCounts([FromBody]QueryGpuNameCountsRequest request) {
-            if (request == null) {
-                return ResponseBase.InvalidInput<QueryGpuNameCountsResponse>("参数错误");
-            }
-            request.PagingTrim();
-            var data = AppRoot.GpuNameSet.QueryGpuNameCounts(request, out int total);
-
-            return QueryGpuNameCountsResponse.Ok(data, total);
-        }
-    }
-}

+ 0 - 23
src/WebApiServer/Controllers/MqCountController.cs

@@ -1,23 +0,0 @@
-using NTMiner.ServerNode;
-using System.Web.Http;
-
-namespace NTMiner.Controllers {
-    public class MqCountController : ApiControllerBase, IMqCountController {
-        [Role.Admin]
-        [HttpPost]
-        public DataResponse<MqCountData[]> MqCounts() {
-            var data = AppRoot.MqCountSet.GetAll();
-            return DataResponse<MqCountData[]>.Ok(data);
-        }
-
-        [Role.Admin]
-        [HttpPost]
-        public DataResponse<MqCountData> MqCount(DataRequest<string> request) {
-            if (request == null || string.IsNullOrEmpty(request.Data)) {
-                return ResponseBase.InvalidInput<DataResponse<MqCountData>>("参数错误");
-            }
-            MqCountData data = AppRoot.MqCountSet.GetByAppId(request.Data);
-            return DataResponse<MqCountData>.Ok(data);
-        }
-    }
-}

+ 0 - 17
src/WebApiServer/Controllers/RemoteIpController.cs

@@ -1,17 +0,0 @@
-using NTMiner.ServerNode;
-using System.Linq;
-using System.Web.Http;
-
-namespace NTMiner.Controllers {
-    public class RemoteIpController : ApiControllerBase, IRemoteIpController {
-        [Role.Admin]
-        [HttpPost]
-        public TopNRemoteIpsResponse TopNRemoteIps([FromBody] DataRequest<int> request) {
-            if (request == null || request.Data <= 0) {
-                return ResponseBase.InvalidInput<TopNRemoteIpsResponse>("参数错误");
-            }
-            var data = ServerRoot.RemoteIpSet.GetTopNRemoteIpEntries(request.Data).Select(a => a.ToDto()).ToList();
-            return TopNRemoteIpsResponse.Ok(data, ServerRoot.RemoteIpSet.Count);
-        }
-    }
-}

+ 0 - 21
src/WebApiServer/Controllers/WebApiServerNodeController.cs

@@ -1,21 +0,0 @@
-using NTMiner.ServerNode;
-using System.Web.Http;
-
-namespace NTMiner.Controllers {
-    public class WebApiServerNodeController : ApiControllerBase, IWebApiServerNodeController {
-        [Role.Admin]
-        [HttpGet]
-        [HttpPost]
-        public DataResponse<WebApiServerState> GetServerState([FromBody]object request) {
-            if (request == null) {
-                return ResponseBase.InvalidInput<DataResponse<WebApiServerState>>("参数错误");
-            }
-            return new DataResponse<WebApiServerState> {
-                StateCode = 200,
-                ReasonPhrase = "Ok",
-                Description = "成功",
-                Data = AppRoot.GetServerState()
-            };
-        }
-    }
-}

+ 0 - 5
src/WebApiServer/WebApiServer.csproj

@@ -97,14 +97,10 @@
       <Link>HttpServer.cs</Link>
     </Compile>
     <Compile Include="ActionCountRoot.cs" />
-    <Compile Include="Controllers\ActionCountController.cs" />
     <Compile Include="Controllers\AdminController.cs" />
     <Compile Include="Controllers\CalcConfigBinaryController.cs" />
     <Compile Include="Controllers\ClientDataBinaryController.cs" />
-    <Compile Include="Controllers\GpuNameController.cs" />
-    <Compile Include="Controllers\MqCountController.cs" />
     <Compile Include="Controllers\NTMinerFileController.cs" />
-    <Compile Include="Controllers\RemoteIpController.cs" />
     <Compile Include="Controllers\ReportBinaryController.cs" />
     <Compile Include="Controllers\ServerMessageBinaryController.cs" />
     <Compile Include="Core\IGpuNameSet.cs" />
@@ -151,7 +147,6 @@
     <Compile Include="Controllers\UserController.cs" />
     <Compile Include="Controllers\OverClockDataController.cs" />
     <Compile Include="Controllers\ReportController.cs" />
-    <Compile Include="Controllers\WebApiServerNodeController.cs" />
     <Compile Include="Controllers\WsServerNodeController.cs" />
     <Compile Include="Core\ICalcConfigSet.cs" />
     <Compile Include="Core\IClientDataSet.cs" />