浏览代码

everedit编辑器存在试用期暂时改回npp

anycmd 4 年之前
父节点
当前提交
f9554da36d
共有 38 个文件被更改,包括 480 次插入169 次删除
  1. 5 0
      src/AppModels/AppModels.csproj
  2. 4 0
      src/AppModels/AppRoot.cs
  3. 5 0
      src/AppModels/FileOpeners/IFileOpener.cs
  4. 14 0
      src/AppModels/FileOpeners/Impl/EverFileOpener.cs
  5. 26 0
      src/AppModels/FileOpeners/Impl/FileOpenerBase.cs
  6. 14 0
      src/AppModels/FileOpeners/Impl/NppFileOpener.cs
  7. 1 42
      src/AppModels/Vms/LogFilesViewModel.cs
  8. 0 1
      src/AppViews0/Views/Ucs/LogFiles.xaml
  9. 2 2
      src/AppViews0/Views/Ucs/LogFiles.xaml.cs
  10. 4 0
      src/NTMiner.Controllers/IAdminController.cs
  11. 1 0
      src/NTMinerDataSchemas/NTMinerDataSchemas.csproj
  12. 20 0
      src/NTMinerDataSchemas/ServerNode/MqAppIds.cs
  13. 3 0
      src/NTMinerRpcClient/NTMinerRpcClient.csproj
  14. 9 10
      src/NTMinerRpcClient/Services/Official/AdminService.cs
  15. 0 4
      src/NTMinerRpcClient/Services/Official/AppSettingService.cs
  16. 38 0
      src/NTMinerRpcClient/Services/Official/BinaryRequestJsonResponseRpcHelperExtensions.cs
  17. 0 4
      src/NTMinerRpcClient/Services/Official/CalcConfigBinaryService.cs
  18. 0 6
      src/NTMinerRpcClient/Services/Official/CalcConfigService.cs
  19. 0 6
      src/NTMinerRpcClient/Services/Official/ClientDataService.cs
  20. 0 14
      src/NTMinerRpcClient/Services/Official/FileUrlService.cs
  21. 147 0
      src/NTMinerRpcClient/Services/Official/JsonRequestBinaryResponseRpcHelperExtensions.cs
  22. 165 0
      src/NTMinerRpcClient/Services/Official/JsonRpcHelperExtensions.cs
  23. 0 6
      src/NTMinerRpcClient/Services/Official/KernelOutputKeywordService.cs
  24. 0 6
      src/NTMinerRpcClient/Services/Official/NTMinerFileService.cs
  25. 0 6
      src/NTMinerRpcClient/Services/Official/NTMinerWalletService.cs
  26. 0 6
      src/NTMinerRpcClient/Services/Official/OverClockDataService.cs
  27. 0 2
      src/NTMinerRpcClient/Services/Official/ReportBinaryService.cs
  28. 0 4
      src/NTMinerRpcClient/Services/Official/ReportService.cs
  29. 0 2
      src/NTMinerRpcClient/Services/Official/ServerMessageBinaryService.cs
  30. 0 6
      src/NTMinerRpcClient/Services/Official/ServerMessageService.cs
  31. 0 2
      src/NTMinerRpcClient/Services/Official/UserAppSettingService.cs
  32. 0 10
      src/NTMinerRpcClient/Services/Official/UserMineWorkService.cs
  33. 0 6
      src/NTMinerRpcClient/Services/Official/UserMinerGroupService.cs
  34. 0 22
      src/NTMinerRpcClient/Services/Official/UserService.cs
  35. 0 2
      src/NTMinerRpcClient/Services/Official/WsServerNodeService.cs
  36. 16 0
      src/WebApiServer/Controllers/AdminController.cs
  37. 2 0
      src/WebApiServer/Core/IMqCountSet.cs
  38. 4 0
      src/WebApiServer/Core/Impl/MqCountSet.cs

+ 5 - 0
src/AppModels/AppModels.csproj

@@ -69,6 +69,10 @@
     <Compile Include="AppRoot.partials.CoinGroupViewModels.cs" />
     <Compile Include="AppRoot.partials.CoinKernelViewModels.cs" />
     <Compile Include="AppRoot.partials.CoinProfileViewModels.cs" />
+    <Compile Include="FileOpeners\IFileOpener.cs" />
+    <Compile Include="FileOpeners\Impl\EverFileOpener.cs" />
+    <Compile Include="FileOpeners\Impl\FileOpenerBase.cs" />
+    <Compile Include="FileOpeners\Impl\NppFileOpener.cs" />
     <Compile Include="MinerStudio\Impl\EmptyWsClient.cs" />
     <Compile Include="AppRoot.partials.CoinViewModels.cs" />
     <Compile Include="MinerStudio\MinerStudioRoot.partials.ColumnsShowViewModels.cs" />
@@ -289,6 +293,7 @@
     <None Include="app.config" />
     <None Include="packages.config" />
   </ItemGroup>
+  <ItemGroup />
   <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
   <Import Project="..\..\packages\Microsoft.Bcl.Build.1.0.21\build\Microsoft.Bcl.Build.targets" Condition="Exists('..\..\packages\Microsoft.Bcl.Build.1.0.21\build\Microsoft.Bcl.Build.targets')" />
   <Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">

+ 4 - 0
src/AppModels/AppRoot.cs

@@ -1,4 +1,6 @@
 using NTMiner.Core;
+using NTMiner.FileOpeners;
+using NTMiner.FileOpeners.Impl;
 using NTMiner.Hub;
 using NTMiner.RemoteDesktop;
 using NTMiner.Vms;
@@ -15,6 +17,8 @@ namespace NTMiner {
         public static Action<RdpInput> RemoteDesktop;
         public static ExtendedNotifyIcon NotifyIcon;
         public const string LowWinMessage = "Windows版本较低,建议使用Win10系统";
+        // everedit存在试用期,试用期过后无法继续使用,所以需要改回使用notepad++
+        public static readonly IFileOpener FileOpener = new NppFileOpener();
 
         private static readonly List<IMessagePathId> _contextPathIds = new List<IMessagePathId>();
 

+ 5 - 0
src/AppModels/FileOpeners/IFileOpener.cs

@@ -0,0 +1,5 @@
+namespace NTMiner.FileOpeners {
+    public interface IFileOpener {
+        void Open(string fileFullName);
+    }
+}

+ 14 - 0
src/AppModels/FileOpeners/Impl/EverFileOpener.cs

@@ -0,0 +1,14 @@
+namespace NTMiner.FileOpeners.Impl {
+    public class EverFileOpener : FileOpenerBase, IFileOpener {
+        public EverFileOpener() { }
+
+        public void Open(string fileFullName) {
+            OpenLogFileBy(
+                downloadFileUrl: AppRoot.EvereditPackageUrl,
+                toolSubDirName: "everedit",
+                exeFileName: "EverEdit.exe",
+                downloadTitle: "EverEdit",
+                args: fileFullName);
+        }
+    }
+}

+ 26 - 0
src/AppModels/FileOpeners/Impl/FileOpenerBase.cs

@@ -0,0 +1,26 @@
+using System.IO;
+
+namespace NTMiner.FileOpeners.Impl {
+    public abstract class FileOpenerBase {
+        protected void OpenLogFileBy(string downloadFileUrl, string toolSubDirName, string exeFileName, string downloadTitle, string args) {
+            string dir = Path.Combine(MinerClientTempPath.ToolsDirFullName, toolSubDirName);
+            string exeFileFullName = Path.Combine(dir, exeFileName);
+            if (!Directory.Exists(dir)) {
+                Directory.CreateDirectory(dir);
+            }
+            if (!File.Exists(exeFileFullName)) {
+                VirtualRoot.Execute(new ShowFileDownloaderCommand(downloadFileUrl, downloadTitle, (window, isSuccess, message, saveFileFullName) => {
+                    if (isSuccess) {
+                        ZipUtil.DecompressZipFile(saveFileFullName, dir);
+                        File.Delete(saveFileFullName);
+                        window?.Close();
+                        Windows.Cmd.RunClose(exeFileFullName, args);
+                    }
+                }));
+            }
+            else {
+                Windows.Cmd.RunClose(exeFileFullName, args);
+            }
+        }
+    }
+}

+ 14 - 0
src/AppModels/FileOpeners/Impl/NppFileOpener.cs

@@ -0,0 +1,14 @@
+namespace NTMiner.FileOpeners.Impl {
+    public class NppFileOpener : FileOpenerBase, IFileOpener {
+        public NppFileOpener() { }
+
+        public void Open(string fileFullName) {
+            OpenLogFileBy(
+                downloadFileUrl: AppRoot.NppPackageUrl,
+                toolSubDirName: "Npp",
+                exeFileName: "notepad++.exe",
+                downloadTitle: "Notepad++",
+                args: $"-nosession -ro {fileFullName}");
+        }
+    }
+}

+ 1 - 42
src/AppModels/Vms/LogFilesViewModel.cs

@@ -28,7 +28,7 @@ namespace NTMiner.Vms {
                 return;
             }
             this.OpenLogFile = new DelegateCommand<string>((fileFullName) => {
-                OpenLogFileByEveredit(fileFullName);
+                AppRoot.FileOpener.Open(fileFullName);
             });
         }
 
@@ -84,46 +84,5 @@ namespace NTMiner.Vms {
             }
             return fileFullName;
         }
-
-        public void OpenLogFileByNpp(string fileFullName) {
-            OpenLogFileBy(
-                downloadFileUrl: AppRoot.NppPackageUrl,
-                toolSubDirName: "Npp",
-                exeFileName: "notepad++.exe",
-                downloadTitle: "Notepad++",
-                args: $"-nosession -ro {fileFullName}");
-        }
-
-        // 用户查看挖矿日志的时候会下载使用一个文本编辑器,因为日志文件可能很大直接使用windows自带
-        // 的记事本打开会很耗资源,不要使用notepad++,EverEdit是一个很好的替代,而且是国人开发的。
-        public void OpenLogFileByEveredit(string fileFullName) {
-            OpenLogFileBy(
-                downloadFileUrl: AppRoot.EvereditPackageUrl,
-                toolSubDirName: "everedit",
-                exeFileName: "EverEdit.exe",
-                downloadTitle: "EverEdit",
-                args: fileFullName);
-        }
-
-        private static void OpenLogFileBy(string downloadFileUrl, string toolSubDirName, string exeFileName, string downloadTitle, string args) {
-            string dir = Path.Combine(MinerClientTempPath.ToolsDirFullName, toolSubDirName);
-            string exeFileFullName = Path.Combine(dir, exeFileName);
-            if (!Directory.Exists(dir)) {
-                Directory.CreateDirectory(dir);
-            }
-            if (!File.Exists(exeFileFullName)) {
-                VirtualRoot.Execute(new ShowFileDownloaderCommand(downloadFileUrl, downloadTitle, (window, isSuccess, message, saveFileFullName) => {
-                    if (isSuccess) {
-                        ZipUtil.DecompressZipFile(saveFileFullName, dir);
-                        File.Delete(saveFileFullName);
-                        window?.Close();
-                        Windows.Cmd.RunClose(exeFileFullName, args);
-                    }
-                }));
-            }
-            else {
-                Windows.Cmd.RunClose(exeFileFullName, args);
-            }
-        }
     }
 }

+ 0 - 1
src/AppViews0/Views/Ucs/LogFiles.xaml

@@ -77,7 +77,6 @@
                                 <DataGridTemplateColumn.CellTemplate>
                                     <DataTemplate>
                                         <controls:KbLinkButton 
-                                            ToolTip="用EverEdit打开,无惧大文件"
 						                    KbDisplayLine="False"
                                             Background="Transparent"
                                             Content="{Binding FileName}" 

+ 2 - 2
src/AppViews0/Views/Ucs/LogFiles.xaml.cs

@@ -22,7 +22,7 @@ namespace NTMiner.Views.Ucs {
                 VirtualRoot.Out.ShowWarn("没有日志", autoHideSeconds: 2);
                 return;
             }
-            Vm.OpenLogFileByEveredit(fileFullName);
+            AppRoot.FileOpener.Open(fileFullName);
         }
 
         private void ButtonLogFiles_Click(object sender, RoutedEventArgs e) {
@@ -32,7 +32,7 @@ namespace NTMiner.Views.Ucs {
 
         private void LogFilesDataGrid_MouseDoubleClick(object sender, MouseButtonEventArgs e) {
             WpfUtil.DataGrid_MouseDoubleClick<LogFilesViewModel.LogFile>(sender, e, t => {
-                Vm.OpenLogFileByEveredit(t.FileFullName);
+                AppRoot.FileOpener.Open(t.FileFullName);
             });
         }
     }

+ 4 - 0
src/NTMiner.Controllers/IAdminController.cs

@@ -26,6 +26,10 @@ namespace NTMiner.Controllers {
         /// <summary>
         /// 需签名
         /// </summary>
+        DataResponse<MqAppIds> MqAppIds();
+        /// <summary>
+        /// 需签名
+        /// </summary>
         TopNRemoteIpsResponse TopNRemoteIps(DataRequest<int> request);
         /// <summary>
         /// 需签名

+ 1 - 0
src/NTMinerDataSchemas/NTMinerDataSchemas.csproj

@@ -96,6 +96,7 @@
     <Compile Include="ServerNode\IMqReceivedCount.cs" />
     <Compile Include="ServerNode\IMqSendCount.cs" />
     <Compile Include="ServerNode\IRemoteIpEntry.cs" />
+    <Compile Include="ServerNode\MqAppIds.cs" />
     <Compile Include="ServerNode\MqCountData.cs" />
     <Compile Include="ServerNode\MqReceivedCountData.cs" />
     <Compile Include="ServerNode\MqSendCountData.cs" />

+ 20 - 0
src/NTMinerDataSchemas/ServerNode/MqAppIds.cs

@@ -0,0 +1,20 @@
+using System.Collections.Generic;
+
+namespace NTMiner.ServerNode {
+    public class MqAppIds {
+        public MqAppIds() {
+            this.AppIds = new List<string>();
+        }
+
+        public List<string> AppIds { get; set; }
+
+        /// <summary>
+        /// 带出这个节点的数据
+        /// </summary>
+        public string AppId { get; set; }
+        /// <summary>
+        /// 带的节点的数据
+        /// </summary>
+        public MqCountData MqCountData { get; set; }
+    }
+}

+ 3 - 0
src/NTMinerRpcClient/NTMinerRpcClient.csproj

@@ -87,8 +87,11 @@
     <Compile Include="Services\Client\NTMinerClientService.cs" />
     <Compile Include="Services\Client\NTMinerDaemonService.cs" />
     <Compile Include="Core\Impl\KernelOutputKeywordSet.cs" />
+    <Compile Include="Services\Official\BinaryRequestJsonResponseRpcHelperExtensions.cs" />
     <Compile Include="Services\Official\CalcConfigBinaryService.cs" />
     <Compile Include="Services\Official\FileUrlService.cs" />
+    <Compile Include="Services\Official\JsonRequestBinaryResponseRpcHelperExtensions.cs" />
+    <Compile Include="Services\Official\JsonRpcHelperExtensions.cs" />
     <Compile Include="Services\Official\NTMinerFileService.cs" />
     <Compile Include="Services\Official\NTMinerWalletService.cs" />
     <Compile Include="Services\OfficialServices.cs" />

+ 9 - 10
src/NTMinerRpcClient/Services/Official/AdminService.cs

@@ -11,8 +11,6 @@ namespace NTMiner.Services.Official {
 
         public void QueryActionCountsAsync(QueryActionCountsRequest request, Action<QueryActionCountsResponse, Exception> callback) {
             RpcRoot.JsonRpc.SignPostAsync(
-                RpcRoot.OfficialServerHost,
-                RpcRoot.OfficialServerPort,
                 _controllerName,
                 nameof(IAdminController.QueryActionCounts),
                 request,
@@ -22,8 +20,6 @@ namespace NTMiner.Services.Official {
 
         public void QueryGpuNameCountsAsync(QueryGpuNameCountsRequest request, Action<QueryGpuNameCountsResponse, Exception> callback) {
             RpcRoot.JsonRpc.SignPostAsync(
-                RpcRoot.OfficialServerHost,
-                RpcRoot.OfficialServerPort,
                 _controllerName,
                 nameof(IAdminController.QueryGpuNameCounts),
                 request,
@@ -33,8 +29,6 @@ namespace NTMiner.Services.Official {
 
         public void GetMqCountsAsync(Action<DataResponse<MqCountData[]>, Exception> callback) {
             RpcRoot.JsonRpc.SignPostAsync(
-                RpcRoot.OfficialServerHost,
-                RpcRoot.OfficialServerPort,
                 _controllerName,
                 nameof(IAdminController.MqCounts),
                 null,
@@ -47,8 +41,6 @@ namespace NTMiner.Services.Official {
                 Data = appId
             };
             RpcRoot.JsonRpc.SignPostAsync(
-                RpcRoot.OfficialServerHost,
-                RpcRoot.OfficialServerPort,
                 _controllerName,
                 nameof(IAdminController.MqCount),
                 request,
@@ -56,10 +48,17 @@ namespace NTMiner.Services.Official {
                 timeountMilliseconds: 5 * 1000);
         }
 
+        public void GetMqAppIdsAsync(Action<DataResponse<MqAppIds>, Exception> callback) {
+            RpcRoot.JsonRpc.SignPostAsync(
+                _controllerName,
+                nameof(IAdminController.MqAppIds),
+                null,
+                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(),

+ 0 - 4
src/NTMinerRpcClient/Services/Official/AppSettingService.cs

@@ -25,8 +25,6 @@ namespace NTMiner.Services.Official {
                 MACAddress = macAddresses.ToArray()
             };
             RpcRoot.JsonRpc.PostAsync(
-                RpcRoot.OfficialServerHost,
-                RpcRoot.OfficialServerPort,
                 _controllerName,
                 nameof(IAppSettingController.GetServerState),
                 request,
@@ -54,8 +52,6 @@ namespace NTMiner.Services.Official {
                 Data = entity
             };
             RpcRoot.JsonRpc.SignPostAsync(
-                RpcRoot.OfficialServerHost, 
-                RpcRoot.OfficialServerPort, 
                 _controllerName, 
                 nameof(IAppSettingController.SetAppSetting), 
                 data: request, 

+ 38 - 0
src/NTMinerRpcClient/Services/Official/BinaryRequestJsonResponseRpcHelperExtensions.cs

@@ -0,0 +1,38 @@
+using NTMiner.Rpc;
+using System;
+using System.Collections.Generic;
+
+namespace NTMiner.Services.Official {
+    public static class BinaryRequestJsonResponseRpcHelperExtensions {
+        /// <summary>
+        /// 注意:Request时ByteArrayContent,Response时ReadAsAsync<TResponse>。
+        /// </summary>
+        /// <typeparam name="TResponse">post的data的类型</typeparam>
+        /// <param name="host">用于组装Url</param>
+        /// <param name="port">用于组装Url</param>
+        /// <param name="controller">用于组装Url</param>
+        /// <param name="action">用于组装Url</param>
+        /// <param name="query">Url上的查询参数,承载登录名、时间戳、签名</param>
+        /// <param name="data">字节数组</param>
+        /// <param name="callback"></param>
+        /// <param name="timeountMilliseconds"></param>
+        public static void PostAsync<TResponse>(
+            this IBinaryRequestJsonResponseRpcHelper rpcHelper,
+            string controller,
+            string action,
+            Dictionary<string, string> query,
+            object data,
+            Action<TResponse, Exception> callback,
+            int timeountMilliseconds = 0) {
+            rpcHelper.PostAsync(
+                RpcRoot.OfficialServerHost,
+                RpcRoot.OfficialServerPort,
+                controller,
+                action,
+                query,
+                data,
+                callback,
+                timeountMilliseconds);
+        }
+    }
+}

+ 0 - 4
src/NTMinerRpcClient/Services/Official/CalcConfigBinaryService.cs

@@ -14,8 +14,6 @@ namespace NTMiner.Services.Official {
         #region GetCalcConfigsAsync
         public void GetCalcConfigsAsync(Action<List<CalcConfigData>> callback) {
             RpcRoot.JsonRequestBinaryResponseRpcHelper.PostAsync(
-                RpcRoot.OfficialServerHost,
-                RpcRoot.OfficialServerPort,
                 _controllerName,
                 nameof(ICalcConfigBinaryController<HttpResponseMessage>.CalcConfigs),
                 null,
@@ -34,8 +32,6 @@ namespace NTMiner.Services.Official {
                 coinCodes = new List<string>();
             }
             RpcRoot.JsonRequestBinaryResponseRpcHelper.GetAsync(
-                RpcRoot.OfficialServerHost,
-                RpcRoot.OfficialServerPort,
                 _controllerName,
                 nameof(ICalcConfigBinaryController<HttpResponseMessage>.Query),
                 new Dictionary<string, string> {

+ 0 - 6
src/NTMinerRpcClient/Services/Official/CalcConfigService.cs

@@ -13,8 +13,6 @@ namespace NTMiner.Services.Official {
         #region GetCalcConfigsAsync
         public void GetCalcConfigsAsync(Action<List<CalcConfigData>> callback) {
             RpcRoot.JsonRpc.PostAsync(
-                RpcRoot.OfficialServerHost,
-                RpcRoot.OfficialServerPort,
                 _controllerName,
                 nameof(ICalcConfigController.CalcConfigs),
                 null,
@@ -33,8 +31,6 @@ namespace NTMiner.Services.Official {
                 coinCodes = new List<string>();
             }
             RpcRoot.JsonRpc.GetAsync(
-                RpcRoot.OfficialServerHost,
-                RpcRoot.OfficialServerPort,
                 _controllerName,
                 nameof(ICalcConfigController.Query),
                 new Dictionary<string, string> {
@@ -60,8 +56,6 @@ namespace NTMiner.Services.Official {
                 Data = configs
             };
             RpcRoot.JsonRpc.SignPostAsync(
-                RpcRoot.OfficialServerHost,
-                RpcRoot.OfficialServerPort,
                 _controllerName,
                 nameof(ICalcConfigController.SaveCalcConfigs),
                 data: request,

+ 0 - 6
src/NTMinerRpcClient/Services/Official/ClientDataService.cs

@@ -18,8 +18,6 @@ namespace NTMiner.Services.Official {
                 Value = value
             };
             RpcRoot.JsonRpc.SignPostAsync(
-                RpcRoot.OfficialServerHost, 
-                RpcRoot.OfficialServerPort, 
                 _controllerName, 
                 nameof(IClientDataController.UpdateClient), 
                 data: request, 
@@ -34,8 +32,6 @@ namespace NTMiner.Services.Official {
                 Values = values
             };
             RpcRoot.JsonRpc.SignPostAsync(
-                RpcRoot.OfficialServerHost, 
-                RpcRoot.OfficialServerPort, 
                 _controllerName, 
                 nameof(IClientDataController.UpdateClients), 
                 data: request, 
@@ -49,8 +45,6 @@ namespace NTMiner.Services.Official {
                 ObjectIds = objectIds
             };
             RpcRoot.JsonRpc.SignPostAsync(
-                RpcRoot.OfficialServerHost, 
-                RpcRoot.OfficialServerPort, 
                 _controllerName, 
                 nameof(IClientDataController.RemoveClients), 
                 data: request, 

+ 0 - 14
src/NTMinerRpcClient/Services/Official/FileUrlService.cs

@@ -16,8 +16,6 @@ namespace NTMiner.Services.Official {
                 FileName = fileName
             };
             RpcRoot.JsonRpc.PostAsync(
-                RpcRoot.OfficialServerHost,
-                RpcRoot.OfficialServerPort,
                 _controllerName,
                 nameof(IFileUrlController.NTMinerUrl),
                 request,
@@ -28,8 +26,6 @@ namespace NTMiner.Services.Official {
         #region GetLiteDbExplorerUrlAsync
         public void GetLiteDbExplorerUrlAsync(Action<string, Exception> callback) {
             RpcRoot.JsonRpc.PostAsync(
-                RpcRoot.OfficialServerHost, 
-                RpcRoot.OfficialServerPort, 
                 _controllerName, 
                 nameof(IFileUrlController.LiteDbExplorerUrl), 
                 callback);
@@ -39,8 +35,6 @@ namespace NTMiner.Services.Official {
         #region GetAtikmdagPatcherUrlAsync
         public void GetAtikmdagPatcherUrlAsync(Action<string, Exception> callback) {
             RpcRoot.JsonRpc.PostAsync(
-                RpcRoot.OfficialServerHost, 
-                RpcRoot.OfficialServerPort, 
                 _controllerName, 
                 nameof(IFileUrlController.AtikmdagPatcherUrl), 
                 callback);
@@ -50,8 +44,6 @@ namespace NTMiner.Services.Official {
         #region GetSwitchRadeonGpuUrlAsync
         public void GetSwitchRadeonGpuUrlAsync(Action<string, Exception> callback) {
             RpcRoot.JsonRpc.PostAsync(
-                RpcRoot.OfficialServerHost, 
-                RpcRoot.OfficialServerPort, 
                 _controllerName, 
                 nameof(IFileUrlController.SwitchRadeonGpuUrl), 
                 callback);
@@ -62,8 +54,6 @@ namespace NTMiner.Services.Official {
         // ReSharper disable once InconsistentNaming
         public void GetNTMinerUpdaterUrlAsync(Action<string, Exception> callback) {
             RpcRoot.JsonRpc.PostAsync(
-                RpcRoot.OfficialServerHost, 
-                RpcRoot.OfficialServerPort, 
                 _controllerName, 
                 nameof(IFileUrlController.NTMinerUpdaterUrl), 
                 callback, 
@@ -74,8 +64,6 @@ namespace NTMiner.Services.Official {
         #region GetMinerClientFinderUrlAsync
         public void GetMinerClientFinderUrlAsync(Action<string, Exception> callback) {
             RpcRoot.JsonRpc.PostAsync(
-                RpcRoot.OfficialServerHost, 
-                RpcRoot.OfficialServerPort, 
                 _controllerName, 
                 nameof(IFileUrlController.MinerClientFinderUrl), 
                 callback, 
@@ -89,8 +77,6 @@ namespace NTMiner.Services.Official {
                 Package = package
             };
             RpcRoot.JsonRpc.PostAsync(
-                RpcRoot.OfficialServerHost, 
-                RpcRoot.OfficialServerPort, 
                 _controllerName, 
                 nameof(IFileUrlController.PackageUrl), 
                 request, 

+ 147 - 0
src/NTMinerRpcClient/Services/Official/JsonRequestBinaryResponseRpcHelperExtensions.cs

@@ -0,0 +1,147 @@
+using NTMiner.Rpc;
+using System;
+using System.Collections.Generic;
+
+namespace NTMiner.Services.Official {
+    public static class JsonRequestBinaryResponseRpcHelperExtensions {
+        /// <summary>
+        /// 注意:Response时ReadAsByteArrayAsync后进行二进制反序列化。
+        /// </summary>
+        /// <typeparam name="TResponse"></typeparam>
+        /// <param name="host">用于组装Url</param>
+        /// <param name="port">用于组装Url</param>
+        /// <param name="controller">用于组装Url</param>
+        /// <param name="action">用于组装Url</param>
+        /// <param name="query">Url上的查询参数,承载登录名、时间戳、签名</param>
+        /// <param name="callback"></param>
+        public static void GetAsync<TResponse>(
+            this IJsonRequestBinaryResponseRpcHelper rpcHelper,
+            string controller,
+            string action,
+            Dictionary<string, string> query,
+            Action<TResponse, Exception> callback,
+            int? timeountMilliseconds = null) {
+            rpcHelper.GetAsync(
+                RpcRoot.OfficialServerHost,
+                RpcRoot.OfficialServerPort,
+                controller,
+                action,
+                query,
+                callback,
+                timeountMilliseconds);
+        }
+
+        /// <summary>
+        /// 注意:Request时PostAsJson,Response时ReadAsByteArrayAsync后进行二进制反序列化。
+        /// </summary>
+        /// <typeparam name="TResponse"></typeparam>
+        /// <param name="host">用于组装Url</param>
+        /// <param name="port">用于组装Url</param>
+        /// <param name="controller">用于组装Url</param>
+        /// <param name="action">用于组装Url</param>
+        /// <param name="callback"></param>
+        /// <param name="timeountMilliseconds"></param>
+        public static void PostAsync<TResponse>(
+            this IJsonRequestBinaryResponseRpcHelper rpcHelper,
+            string controller,
+            string action,
+            Action<TResponse, Exception> callback,
+            int timeountMilliseconds = 0) {
+            rpcHelper.PostAsync(
+                RpcRoot.OfficialServerHost,
+                RpcRoot.OfficialServerPort,
+                controller,
+                action,
+                callback,
+                timeountMilliseconds);
+        }
+
+        /// <summary>
+        /// 注意:Request时PostAsJson,Response时ReadAsByteArrayAsync后进行二进制反序列化。
+        /// </summary>
+        /// <typeparam name="TResponse"></typeparam>
+        /// <param name="host">用于组装Url</param>
+        /// <param name="port">用于组装Url</param>
+        /// <param name="controller">用于组装Url</param>
+        /// <param name="action">用于组装Url</param>
+        /// <param name="data">post的数据,PostAsJson</param>
+        /// <param name="callback"></param>
+        /// <param name="timeountMilliseconds"></param>
+        public static void PostAsync<TResponse>(
+            this IJsonRequestBinaryResponseRpcHelper rpcHelper,
+            string controller,
+            string action,
+            object data,
+            Action<TResponse, Exception> callback,
+            int timeountMilliseconds = 0) {
+            rpcHelper.PostAsync(
+                RpcRoot.OfficialServerHost,
+                RpcRoot.OfficialServerPort,
+                controller,
+                action,
+                data,
+                callback,
+                timeountMilliseconds);
+        }
+
+        /// <summary>
+        /// 注意:Request时PostAsJson,Response时ReadAsByteArrayAsync后进行二进制反序列化。
+        /// </summary>
+        /// <typeparam name="TResponse"></typeparam>
+        /// <param name="host">用于组装Url</param>
+        /// <param name="port">用于组装Url</param>
+        /// <param name="controller">用于组装Url</param>
+        /// <param name="action">用于组装Url</param>
+        /// <param name="signData">用于组装url查询字符串</param>
+        /// <param name="data">post的数据,PostAsJson</param>
+        /// <param name="callback"></param>
+        /// <param name="timeountMilliseconds"></param>
+        public static void SignPostAsync<TResponse>(
+            this IJsonRequestBinaryResponseRpcHelper rpcHelper,
+            string controller,
+            string action,
+            object data,
+            Action<TResponse, Exception> callback,
+            int timeountMilliseconds = 0) {
+            rpcHelper.SignPostAsync(
+                RpcRoot.OfficialServerHost,
+                RpcRoot.OfficialServerPort,
+                controller,
+                action,
+                data,
+                callback,
+                timeountMilliseconds);
+        }
+
+        /// <summary>
+        /// 注意:Request时PostAsJson,Response时ReadAsByteArrayAsync后进行二进制反序列化。
+        /// </summary>
+        /// <typeparam name="TResponse">post的data的类型</typeparam>
+        /// <param name="host">用于组装Url</param>
+        /// <param name="port">用于组装Url</param>
+        /// <param name="controller">用于组装Url</param>
+        /// <param name="action">用于组装Url</param>
+        /// <param name="query">Url上的查询参数,承载登录名、时间戳、签名</param>
+        /// <param name="data">post的数据,PostAsJson</param>
+        /// <param name="callback"></param>
+        /// <param name="timeountMilliseconds"></param>
+        public static void PostAsync<TResponse>(
+            this IJsonRequestBinaryResponseRpcHelper rpcHelper,
+            string controller,
+            string action,
+            Dictionary<string, string> query,
+            object data,
+            Action<TResponse, Exception> callback,
+            int timeountMilliseconds = 0) {
+            rpcHelper.PostAsync(
+                RpcRoot.OfficialServerHost,
+                RpcRoot.OfficialServerPort,
+                controller,
+                action,
+                query,
+                data,
+                callback,
+                timeountMilliseconds);
+        }
+    }
+}

+ 165 - 0
src/NTMinerRpcClient/Services/Official/JsonRpcHelperExtensions.cs

@@ -0,0 +1,165 @@
+using NTMiner.Rpc;
+using System;
+using System.Collections.Generic;
+
+namespace NTMiner.Services.Official {
+    public static class JsonRpcHelperExtensions {
+        /// <summary>
+        /// 
+        /// </summary>
+        /// <typeparam name="TResponse"></typeparam>
+        /// <param name="host">用于组装Url</param>
+        /// <param name="port">用于组装Url</param>
+        /// <param name="controller">用于组装Url</param>
+        /// <param name="action">用于组装Url</param>
+        /// <param name="query">Url上的查询参数,承载登录名、时间戳、签名</param>
+        /// <param name="callback"></param>
+        public static void GetAsync<TResponse>(
+            this IJsonRpcHelper rpcHelper,
+            string controller,
+            string action,
+            Dictionary<string, string> query,
+            Action<TResponse, Exception> callback,
+            int? timeountMilliseconds = null) {
+            rpcHelper.GetAsync(
+                RpcRoot.OfficialServerHost,
+                RpcRoot.OfficialServerPort,
+                controller,
+                action,
+                query,
+                callback,
+                timeountMilliseconds);
+        }
+        /// <summary>
+        /// 
+        /// </summary>
+        /// <typeparam name="TResponse"></typeparam>
+        /// <param name="host">用于组装Url</param>
+        /// <param name="port">用于组装Url</param>
+        /// <param name="controller">用于组装Url</param>
+        /// <param name="action">用于组装Url</param>
+        /// <param name="callback"></param>
+        /// <param name="timeountMilliseconds"></param>
+        public static void PostAsync<TResponse>(
+            this IJsonRpcHelper rpcHelper,
+            string controller,
+            string action,
+            Action<TResponse, Exception> callback,
+            int timeountMilliseconds = 0) {
+            rpcHelper.PostAsync(
+                RpcRoot.OfficialServerHost,
+                RpcRoot.OfficialServerPort,
+                controller,
+                action,
+                callback,
+                timeountMilliseconds);
+        }
+
+        /// <summary>
+        /// 
+        /// </summary>
+        /// <typeparam name="TResponse"></typeparam>
+        /// <param name="host">用于组装Url</param>
+        /// <param name="port">用于组装Url</param>
+        /// <param name="controller">用于组装Url</param>
+        /// <param name="action">用于组装Url</param>
+        /// <param name="data">post的数据</param>
+        /// <param name="callback"></param>
+        /// <param name="timeountMilliseconds"></param>
+        public static void PostAsync<TResponse>(
+            this IJsonRpcHelper rpcHelper,
+            string controller,
+            string action,
+            object data,
+            Action<TResponse, Exception> callback,
+            int timeountMilliseconds = 0) {
+            rpcHelper.PostAsync(
+                RpcRoot.OfficialServerHost,
+                RpcRoot.OfficialServerPort,
+                controller,
+                action,
+                data,
+                callback,
+                timeountMilliseconds);
+        }
+
+        /// <summary>
+        /// 
+        /// </summary>
+        /// <typeparam name="TResponse"></typeparam>
+        /// <param name="host">用于组装Url</param>
+        /// <param name="port">用于组装Url</param>
+        /// <param name="controller">用于组装Url</param>
+        /// <param name="action">用于组装Url</param>
+        /// <param name="signData">用于组装url查询字符串</param>
+        /// <param name="data">post的数据</param>
+        /// <param name="callback"></param>
+        /// <param name="timeountMilliseconds"></param>
+        public static void SignPostAsync<TResponse>(
+            this IJsonRpcHelper rpcHelper,
+            string controller,
+            string action,
+            object data,
+            Action<TResponse, Exception> callback,
+            int timeountMilliseconds = 0) {
+            rpcHelper.SignPostAsync(
+                RpcRoot.OfficialServerHost,
+                RpcRoot.OfficialServerPort,
+                controller,
+                action,
+                data,
+                callback,
+                timeountMilliseconds);
+        }
+
+        /// <summary>
+        /// 异步Post
+        /// </summary>
+        /// <typeparam name="TResponse">post的data的类型</typeparam>
+        /// <param name="host">用于组装Url</param>
+        /// <param name="port">用于组装Url</param>
+        /// <param name="controller">用于组装Url</param>
+        /// <param name="action">用于组装Url</param>
+        /// <param name="query">Url上的查询参数,承载登录名、时间戳、签名</param>
+        /// <param name="data">post的数据</param>
+        /// <param name="callback"></param>
+        /// <param name="timeountMilliseconds"></param>
+        public static void PostAsync<TResponse>(
+            this IJsonRpcHelper rpcHelper,
+            string controller,
+            string action,
+            Dictionary<string, string> query,
+            object data,
+            Action<TResponse, Exception> callback,
+            int timeountMilliseconds = 0) {
+            rpcHelper.PostAsync(
+                RpcRoot.OfficialServerHost,
+                RpcRoot.OfficialServerPort,
+                controller,
+                action,
+                query,
+                data,
+                callback,
+                timeountMilliseconds);
+        }
+
+        public static void FirePostAsync(
+            this IJsonRpcHelper rpcHelper,
+            string controller,
+            string action,
+            Dictionary<string, string> query,
+            object data,
+            Action callback = null,
+            int timeountMilliseconds = 0) {
+            rpcHelper.FirePostAsync(
+                RpcRoot.OfficialServerHost,
+                RpcRoot.OfficialServerPort,
+                controller,
+                action,
+                query,
+                data,
+                callback,
+                timeountMilliseconds);
+        }
+    }
+}

+ 0 - 6
src/NTMinerRpcClient/Services/Official/KernelOutputKeywordService.cs

@@ -14,8 +14,6 @@ namespace NTMiner.Services.Official {
         public void GetKernelOutputKeywords(Action<KernelOutputKeywordsResponse, Exception> callback) {
             object request = new object();
             RpcRoot.JsonRpc.PostAsync(
-                RpcRoot.OfficialServerHost, 
-                RpcRoot.OfficialServerPort, 
                 _controllerName, 
                 nameof(IKernelOutputKeywordController.KernelOutputKeywords), 
                 request, 
@@ -29,8 +27,6 @@ namespace NTMiner.Services.Official {
                 Data = entity
             };
             RpcRoot.JsonRpc.SignPostAsync(
-                RpcRoot.OfficialServerHost, 
-                RpcRoot.OfficialServerPort, 
                 _controllerName, 
                 nameof(IKernelOutputKeywordController.AddOrUpdateKernelOutputKeyword), 
                 data: request, 
@@ -44,8 +40,6 @@ namespace NTMiner.Services.Official {
                 Data = id
             };
             RpcRoot.JsonRpc.SignPostAsync(
-                RpcRoot.OfficialServerHost, 
-                RpcRoot.OfficialServerPort, 
                 _controllerName, 
                 nameof(IKernelOutputKeywordController.RemoveKernelOutputKeyword), 
                 data: request, 

+ 0 - 6
src/NTMinerRpcClient/Services/Official/NTMinerFileService.cs

@@ -13,8 +13,6 @@ namespace NTMiner.Services.Official {
         // ReSharper disable once InconsistentNaming
         public void GetNTMinerFilesAsync(DateTime timestamp, Action<NTMinerFilesResponse, Exception> callback) {
             RpcRoot.JsonRpc.PostAsync(
-                RpcRoot.OfficialServerHost,
-                RpcRoot.OfficialServerPort,
                 _controllerName,
                 nameof(INTMinerFileController.GetNTMinerFiles),
                 new NTMinerFilesRequest {
@@ -31,8 +29,6 @@ namespace NTMiner.Services.Official {
                 Data = entity
             };
             RpcRoot.JsonRpc.SignPostAsync(
-                RpcRoot.OfficialServerHost,
-                RpcRoot.OfficialServerPort,
                 _controllerName,
                 nameof(INTMinerFileController.AddOrUpdateNTMinerFile),
                 data: request,
@@ -47,8 +43,6 @@ namespace NTMiner.Services.Official {
                 Data = id
             };
             RpcRoot.JsonRpc.SignPostAsync(
-                RpcRoot.OfficialServerHost,
-                RpcRoot.OfficialServerPort,
                 _controllerName,
                 nameof(INTMinerFileController.RemoveNTMinerFile),
                 data: request,

+ 0 - 6
src/NTMinerRpcClient/Services/Official/NTMinerWalletService.cs

@@ -13,8 +13,6 @@ namespace NTMiner.Services.Official {
         #region GetNTMinerWalletsAsync
         public void GetNTMinerWalletsAsync(Action<DataResponse<List<NTMinerWalletData>>, Exception> callback) {
             RpcRoot.JsonRpc.PostAsync(
-                RpcRoot.OfficialServerHost, 
-                RpcRoot.OfficialServerPort, 
                 _controllerName, 
                 nameof(INTMinerWalletController.NTMinerWallets), 
                 null, 
@@ -28,8 +26,6 @@ namespace NTMiner.Services.Official {
                 Data = entity
             };
             RpcRoot.JsonRpc.SignPostAsync(
-                RpcRoot.OfficialServerHost, 
-                RpcRoot.OfficialServerPort, 
                 _controllerName, 
                 nameof(INTMinerWalletController.AddOrUpdateNTMinerWallet), 
                 data: request, 
@@ -43,8 +39,6 @@ namespace NTMiner.Services.Official {
                 Data = id
             };
             RpcRoot.JsonRpc.SignPostAsync(
-                RpcRoot.OfficialServerHost, 
-                RpcRoot.OfficialServerPort, 
                 _controllerName, 
                 nameof(INTMinerWalletController.RemoveNTMinerWallet), 
                 data: request, 

+ 0 - 6
src/NTMinerRpcClient/Services/Official/OverClockDataService.cs

@@ -14,8 +14,6 @@ namespace NTMiner.Services.Official {
         public void GetOverClockDatasAsync(Action<DataResponse<List<OverClockData>>, Exception> callback) {
             object request = new object();
             RpcRoot.JsonRpc.PostAsync(
-                RpcRoot.OfficialServerHost, 
-                RpcRoot.OfficialServerPort, 
                 _controllerName, 
                 nameof(IOverClockDataController.OverClockDatas), 
                 request, 
@@ -29,8 +27,6 @@ namespace NTMiner.Services.Official {
                 Data = entity
             };
             RpcRoot.JsonRpc.SignPostAsync(
-                RpcRoot.OfficialServerHost, 
-                RpcRoot.OfficialServerPort, 
                 _controllerName, 
                 nameof(IOverClockDataController.AddOrUpdateOverClockData), 
                 data: request, 
@@ -44,8 +40,6 @@ namespace NTMiner.Services.Official {
                 Data = id
             };
             RpcRoot.JsonRpc.SignPostAsync(
-                RpcRoot.OfficialServerHost, 
-                RpcRoot.OfficialServerPort, 
                 _controllerName, 
                 nameof(IOverClockDataController.RemoveOverClockData), 
                 data: request, 

+ 0 - 2
src/NTMinerRpcClient/Services/Official/ReportBinaryService.cs

@@ -11,8 +11,6 @@ namespace NTMiner.Services.Official {
 
         public void ReportSpeedAsync(SpeedDto speedDto, Action<ReportResponse, Exception> callback) {
             RpcRoot.BinaryRequestJsonResponseRpcHelper.PostAsync(
-                RpcRoot.OfficialServerHost, 
-                RpcRoot.OfficialServerPort, 
                 _controllerName, 
                 nameof(IReportBinaryController.ReportSpeed), 
                 query: null, 

+ 0 - 4
src/NTMinerRpcClient/Services/Official/ReportService.cs

@@ -11,8 +11,6 @@ namespace NTMiner.Services.Official {
 
         public void ReportSpeedAsync(SpeedDto speedDto, Action<ReportResponse, Exception> callback) {
             RpcRoot.JsonRpc.PostAsync(
-                RpcRoot.OfficialServerHost, 
-                RpcRoot.OfficialServerPort, 
                 _controllerName, 
                 nameof(IReportController.ReportSpeed), 
                 speedDto, 
@@ -26,8 +24,6 @@ namespace NTMiner.Services.Official {
                 IsMining = isMining
             };
             RpcRoot.JsonRpc.FirePostAsync(
-                RpcRoot.OfficialServerHost, 
-                RpcRoot.OfficialServerPort, 
                 _controllerName, 
                 nameof(IReportController.ReportState), 
                 null, 

+ 0 - 2
src/NTMinerRpcClient/Services/Official/ServerMessageBinaryService.cs

@@ -17,8 +17,6 @@ namespace NTMiner.Services.Official {
                 Timestamp = Timestamp.GetTimestamp(timestamp)
             };
             RpcRoot.JsonRequestBinaryResponseRpcHelper.PostAsync(
-                RpcRoot.OfficialServerHost, 
-                RpcRoot.OfficialServerPort, 
                 _controllerName, 
                 nameof(IServerMessageBinaryController<HttpResponseMessage>.ServerMessages), 
                 request, 

+ 0 - 6
src/NTMinerRpcClient/Services/Official/ServerMessageService.cs

@@ -16,8 +16,6 @@ namespace NTMiner.Services.Official {
                 Timestamp = Timestamp.GetTimestamp(timestamp)
             };
             RpcRoot.JsonRpc.PostAsync(
-                RpcRoot.OfficialServerHost, 
-                RpcRoot.OfficialServerPort, 
                 _controllerName, 
                 nameof(IServerMessageController.ServerMessages), 
                 request, 
@@ -31,8 +29,6 @@ namespace NTMiner.Services.Official {
                 Data = entity
             };
             RpcRoot.JsonRpc.SignPostAsync(
-                RpcRoot.OfficialServerHost, 
-                RpcRoot.OfficialServerPort, 
                 _controllerName, 
                 nameof(IServerMessageController.AddOrUpdateServerMessage), 
                 data: request, 
@@ -46,8 +42,6 @@ namespace NTMiner.Services.Official {
                 Data = id
             };
             RpcRoot.JsonRpc.SignPostAsync(
-                RpcRoot.OfficialServerHost, 
-                RpcRoot.OfficialServerPort, 
                 _controllerName, 
                 nameof(IServerMessageController.MarkDeleteServerMessage), 
                 data: request, 

+ 0 - 2
src/NTMinerRpcClient/Services/Official/UserAppSettingService.cs

@@ -15,8 +15,6 @@ namespace NTMiner.Services.Official {
                 Data = entity
             };
             RpcRoot.JsonRpc.SignPostAsync(
-                RpcRoot.OfficialServerHost, 
-                RpcRoot.OfficialServerPort, 
                 _controllerName, 
                 nameof(IUserAppSettingController.SetAppSetting), 
                 data: request, 

+ 0 - 10
src/NTMinerRpcClient/Services/Official/UserMineWorkService.cs

@@ -16,8 +16,6 @@ namespace NTMiner.Services.Official {
         public void GetMineWorksAsync(Action<DataResponse<List<UserMineWorkData>>, Exception> callback) {
             object request = new object();
             RpcRoot.JsonRpc.SignPostAsync(
-                RpcRoot.OfficialServerHost, 
-                RpcRoot.OfficialServerPort, 
                 _controllerName, 
                 nameof(IUserMineWorkController.MineWorks), 
                 data: request, 
@@ -33,8 +31,6 @@ namespace NTMiner.Services.Official {
                 Data = entity
             };
             RpcRoot.JsonRpc.SignPostAsync(
-                RpcRoot.OfficialServerHost, 
-                RpcRoot.OfficialServerPort, 
                 _controllerName, 
                 nameof(IUserMineWorkController.AddOrUpdateMineWork), 
                 data: request, 
@@ -48,8 +44,6 @@ namespace NTMiner.Services.Official {
                 Data = id
             };
             RpcRoot.JsonRpc.SignPostAsync(
-                RpcRoot.OfficialServerHost, 
-                RpcRoot.OfficialServerPort, 
                 _controllerName, 
                 nameof(IUserMineWorkController.RemoveMineWork), 
                 data: request, 
@@ -65,8 +59,6 @@ namespace NTMiner.Services.Official {
                 ServerJson = serverJson
             };
             RpcRoot.JsonRpc.SignPostAsync(
-                RpcRoot.OfficialServerHost, 
-                RpcRoot.OfficialServerPort, 
                 _controllerName, 
                 nameof(IUserMineWorkController.ExportMineWork), 
                 data: request, 
@@ -80,8 +72,6 @@ namespace NTMiner.Services.Official {
                 Data = workId
             };
             RpcRoot.JsonRpc.SignPostAsync(
-                RpcRoot.OfficialServerHost, 
-                RpcRoot.OfficialServerPort, 
                 _controllerName, 
                 nameof(IUserMineWorkController.GetLocalJson), 
                 data: request, 

+ 0 - 6
src/NTMinerRpcClient/Services/Official/UserMinerGroupService.cs

@@ -14,8 +14,6 @@ namespace NTMiner.Services.Official {
         #region GetMinerGroupsAsync
         public void GetMinerGroupsAsync(Action<DataResponse<List<UserMinerGroupData>>, Exception> callback) {
             RpcRoot.JsonRpc.SignPostAsync(
-                RpcRoot.OfficialServerHost, 
-                RpcRoot.OfficialServerPort, 
                 _controllerName, 
                 nameof(IUserMinerGroupController.MinerGroups), 
                 data: new object(), 
@@ -31,8 +29,6 @@ namespace NTMiner.Services.Official {
                 Data = entity
             };
             RpcRoot.JsonRpc.SignPostAsync(
-                RpcRoot.OfficialServerHost, 
-                RpcRoot.OfficialServerPort, 
                 _controllerName, 
                 nameof(IUserMinerGroupController.AddOrUpdateMinerGroup), 
                 data: request, 
@@ -46,8 +42,6 @@ namespace NTMiner.Services.Official {
                 Data = id
             };
             RpcRoot.JsonRpc.SignPostAsync(
-                RpcRoot.OfficialServerHost, 
-                RpcRoot.OfficialServerPort, 
                 _controllerName, 
                 nameof(IUserMinerGroupController.RemoveMinerGroup), 
                 data: request, 

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

@@ -13,8 +13,6 @@ namespace NTMiner.Services.Official {
         #region LoginAsync
         public void LoginAsync(string loginName, string password, Action<DataResponse<LoginedUser>, Exception> callback) {
             RpcRoot.JsonRpc.PostAsync(
-                RpcRoot.OfficialServerHost,
-                RpcRoot.OfficialServerPort,
                 _controllerName,
                 nameof(IUserController.Login),
                 RpcUser.GetSignData(loginName, password),
@@ -26,8 +24,6 @@ namespace NTMiner.Services.Official {
         #region IsLoginNameExistAsync
         public void IsLoginNameExistAsync(string loginName, Action<bool> callback) {
             RpcRoot.JsonRpc.GetAsync(
-                RpcRoot.OfficialServerHost,
-                RpcRoot.OfficialServerPort,
                 _controllerName,
                 nameof(IUserController.IsLoginNameExist),
                 new Dictionary<string, string> {
@@ -42,8 +38,6 @@ namespace NTMiner.Services.Official {
         #region QueryUsersAsync
         public void QueryUsersAsync(QueryUsersRequest request, Action<QueryUsersResponse, Exception> callback) {
             RpcRoot.JsonRpc.SignPostAsync(
-                RpcRoot.OfficialServerHost,
-                RpcRoot.OfficialServerPort,
                 _controllerName,
                 nameof(IUserController.QueryUsers),
                 data: request,
@@ -63,8 +57,6 @@ namespace NTMiner.Services.Official {
         #region RemoveUserAsync
         public void RemoveUserAsync(string loginName, Action<ResponseBase, Exception> callback) {
             RpcRoot.JsonRpc.SignPostAsync(
-                RpcRoot.OfficialServerHost,
-                RpcRoot.OfficialServerPort,
                 _controllerName,
                 nameof(IUserController.RemoveUser),
                 new DataRequest<string> {
@@ -76,8 +68,6 @@ namespace NTMiner.Services.Official {
         #region EnableUserAsync
         public void EnableUserAsync(string loginName, Action<ResponseBase, Exception> callback) {
             RpcRoot.JsonRpc.SignPostAsync(
-                RpcRoot.OfficialServerHost,
-                RpcRoot.OfficialServerPort,
                 _controllerName,
                 nameof(IUserController.EnableUser),
                 new DataRequest<string> {
@@ -89,8 +79,6 @@ namespace NTMiner.Services.Official {
         #region DisableUserAsync
         public void DisableUserAsync(string loginName, Action<ResponseBase, Exception> callback) {
             RpcRoot.JsonRpc.SignPostAsync(
-                RpcRoot.OfficialServerHost,
-                RpcRoot.OfficialServerPort,
                 _controllerName,
                 nameof(IUserController.DisableUser),
                 new DataRequest<string> {
@@ -102,8 +90,6 @@ namespace NTMiner.Services.Official {
         #region AddAdminRoleAsync
         public void AddAdminRoleAsync(string loginName, Action<ResponseBase, Exception> callback) {
             RpcRoot.JsonRpc.SignPostAsync(
-                RpcRoot.OfficialServerHost,
-                RpcRoot.OfficialServerPort,
                 _controllerName,
                 nameof(IUserController.AddAdminRole),
                 new DataRequest<string> {
@@ -115,8 +101,6 @@ namespace NTMiner.Services.Official {
         #region RemoveAdminRoleAsync
         public void RemoveAdminRoleAsync(string loginName, Action<ResponseBase, Exception> callback) {
             RpcRoot.JsonRpc.SignPostAsync(
-                RpcRoot.OfficialServerHost,
-                RpcRoot.OfficialServerPort,
                 _controllerName,
                 nameof(IUserController.RemoveAdminRole),
                 new DataRequest<string> {
@@ -128,8 +112,6 @@ namespace NTMiner.Services.Official {
         #region SignUpAsync
         public void SignUpAsync(SignUpRequest data, Action<ResponseBase, Exception> callback) {
             RpcRoot.JsonRpc.PostAsync(
-                RpcRoot.OfficialServerHost,
-                RpcRoot.OfficialServerPort,
                 _controllerName,
                 nameof(IUserController.SignUp),
                 data,
@@ -140,8 +122,6 @@ namespace NTMiner.Services.Official {
         #region UpdateUserAsync
         public void UpdateUserAsync(UserUpdateData data, Action<ResponseBase, Exception> callback) {
             RpcRoot.JsonRpc.SignPostAsync(
-                RpcRoot.OfficialServerHost,
-                RpcRoot.OfficialServerPort,
                 _controllerName,
                 nameof(IUserController.UpdateUser),
                 data,
@@ -152,8 +132,6 @@ namespace NTMiner.Services.Official {
         #region ChangePasswordAsync
         public void ChangePasswordAsync(ChangePasswordRequest request, Action<ResponseBase, Exception> callback) {
             RpcRoot.JsonRpc.SignPostAsync(
-                RpcRoot.OfficialServerHost,
-                RpcRoot.OfficialServerPort,
                 _controllerName,
                 nameof(IUserController.ChangePassword),
                 request,

+ 0 - 2
src/NTMinerRpcClient/Services/Official/WsServerNodeService.cs

@@ -15,8 +15,6 @@ namespace NTMiner.Services.Official {
                 UserId = outerUserId
             };
             RpcRoot.JsonRpc.PostAsync(
-                RpcRoot.OfficialServerHost, 
-                RpcRoot.OfficialServerPort, 
                 _controllerName, 
                 nameof(IWsServerNodeController.GetNodeAddress), 
                 data, 

+ 16 - 0
src/WebApiServer/Controllers/AdminController.cs

@@ -65,6 +65,22 @@ namespace NTMiner.Controllers {
             return DataResponse<MqCountData>.Ok(data);
         }
 
+        [Role.Admin]
+        [HttpPost]
+        public DataResponse<MqAppIds> MqAppIds() {
+            var appIds = AppRoot.MqCountSet.GetAppIds();
+            var appId = appIds.FirstOrDefault();
+            MqCountData mqCountData = null;
+            if (!string.IsNullOrEmpty(appId)) {
+                mqCountData = AppRoot.MqCountSet.GetByAppId(appId);
+            }
+            return DataResponse<MqAppIds>.Ok(new MqAppIds {
+                AppIds = appIds,
+                AppId = appId,
+                MqCountData = mqCountData
+            });
+        }
+
         [Role.Admin]
         [HttpPost]
         public TopNRemoteIpsResponse TopNRemoteIps([FromBody] DataRequest<int> request) {

+ 2 - 0
src/WebApiServer/Core/IMqCountSet.cs

@@ -1,9 +1,11 @@
 using NTMiner.ServerNode;
+using System.Collections.Generic;
 
 namespace NTMiner.Core {
     public interface IMqCountSet {
         MqCountData[] GetAll();
         MqCountData GetByAppId(string appId);
+        List<string> GetAppIds();
         void Clear();
     }
 }

+ 4 - 0
src/WebApiServer/Core/Impl/MqCountSet.cs

@@ -25,6 +25,10 @@ namespace NTMiner.Core.Impl {
             return null;
         }
 
+        public List<string> GetAppIds() {
+            return _dicByAppId.Keys.ToList();
+        }
+
         public void Clear() {
             _dicByAppId.Clear();
         }