😎1、修复短信发送 2、代码清理
This commit is contained in:
parent
7718884dc3
commit
7e02e177b1
@ -49,7 +49,7 @@
|
||||
<PackageReference Include="SSH.NET" Version="2024.2.0" />
|
||||
<PackageReference Include="System.Linq.Dynamic.Core" Version="1.5.1" />
|
||||
<PackageReference Include="System.Net.Http" Version="4.3.4" />
|
||||
<PackageReference Include="TencentCloudSDK.Sms" Version="3.0.1170" />
|
||||
<PackageReference Include="TencentCloudSDK.Sms" Version="3.0.1171" />
|
||||
<PackageReference Include="UAParser" Version="3.1.47" />
|
||||
<PackageReference Include="Yitter.IdGenerator" Version="1.0.14" />
|
||||
</ItemGroup>
|
||||
|
||||
@ -86,7 +86,7 @@ public class SysSmsService : IDynamicApiController, ITransient
|
||||
PhoneNumbers = phoneNumber, // 待发送手机号, 多个以逗号分隔
|
||||
SignName = template.SignName, // 短信签名
|
||||
TemplateCode = template.TemplateCode, // 短信模板
|
||||
TemplateParam = templateParam.ToString(), // 模板中的变量替换JSON串
|
||||
TemplateParam = templateParam.ToJson(), // 模板中的变量替换JSON串
|
||||
OutId = YitIdHelper.NextId().ToString()
|
||||
};
|
||||
var sendSmsResponse = await client.SendSmsAsync(sendSmsRequest);
|
||||
|
||||
@ -188,11 +188,7 @@ public static class ComputerUtil
|
||||
}
|
||||
else
|
||||
{
|
||||
#if NET8_0 || NET9_0
|
||||
string output = ShellUtil.Cmd("wmic", "cpu get LoadPercentage");
|
||||
#else
|
||||
string output = ShellUtil.PowerShell("Get-CimInstance -ClassName Win32_Processor | Measure-Command {Start-Sleep -Seconds 1}");
|
||||
#endif
|
||||
cpuRates.AddRange(output.Replace("LoadPercentage", string.Empty).Trim().Split("\r\r\n"));
|
||||
}
|
||||
return cpuRates;
|
||||
@ -221,11 +217,7 @@ public static class ComputerUtil
|
||||
}
|
||||
else
|
||||
{
|
||||
#if NET8_0 || NET9_0
|
||||
string output = ShellUtil.Cmd("wmic", "OS get LastBootUpTime/Value");
|
||||
#else
|
||||
string output = ShellUtil.PowerShell("(Get-Date) - (Get-CimInstance -ClassName Win32_OperatingSystem).LastBootUpTime");
|
||||
#endif
|
||||
string[] outputArr = output.Split('=', (char)StringSplitOptions.RemoveEmptyEntries);
|
||||
if (outputArr.Length == 2)
|
||||
runTime = DateTimeUtil.FormatTime((DateTime.Now - outputArr[1].Split('.')[0].ParseToDateTime()).TotalMilliseconds.ToString().Split('.')[0].ParseToLong());
|
||||
@ -336,11 +328,7 @@ public class MemoryMetricsClient
|
||||
/// <returns></returns>
|
||||
public static MemoryMetrics GetWindowsMetrics()
|
||||
{
|
||||
#if NET8_0 || NET9_0
|
||||
string output = ShellUtil.Cmd("wmic", "OS get FreePhysicalMemory,TotalVisibleMemorySize /Value");
|
||||
#else
|
||||
string output = ShellUtil.PowerShell("Get-CimInstance -ClassName Win32_OperatingSystem | Select FreePhysicalMemory, TotalVisibleMemorySize");
|
||||
#endif
|
||||
var metrics = new MemoryMetrics();
|
||||
var lines = output.Trim().Split('\n', (char)StringSplitOptions.RemoveEmptyEntries);
|
||||
if (lines.Length <= 1) return metrics;
|
||||
@ -448,7 +436,6 @@ public class ShellUtil
|
||||
/// <returns></returns>
|
||||
public static string PowerShell(string script)
|
||||
{
|
||||
#if NET8_0 || NET9_0
|
||||
using var PowerShellInstance = System.Management.Automation.PowerShell.Create();
|
||||
PowerShellInstance.AddScript(script);
|
||||
var PSOutput = PowerShellInstance.Invoke();
|
||||
@ -459,9 +446,6 @@ public class ShellUtil
|
||||
output.AppendLine(outputItem.BaseObject.ToString());
|
||||
}
|
||||
return output.ToString();
|
||||
#else
|
||||
return "";
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
@ -523,7 +507,6 @@ public class ShellHelper
|
||||
/// <returns></returns>
|
||||
public static string PowerShell(string script)
|
||||
{
|
||||
#if NET8_0 || NET9_0
|
||||
using var PowerShellInstance = System.Management.Automation.PowerShell.Create();
|
||||
PowerShellInstance.AddScript(script);
|
||||
var PSOutput = PowerShellInstance.Invoke();
|
||||
@ -534,8 +517,5 @@ public class ShellHelper
|
||||
output.AppendLine(outputItem.BaseObject.ToString());
|
||||
}
|
||||
return output.ToString();
|
||||
#else
|
||||
return "";
|
||||
#endif
|
||||
}
|
||||
}
|
||||
@ -103,7 +103,7 @@ public class SuperApiAop : DefaultSuperApiAop
|
||||
|
||||
var logger = App.GetRequiredService<ILoggerFactory>().CreateLogger(CommonConst.SysLogCategoryName);
|
||||
using var scope = logger.ScopeContext(new Dictionary<object, object> {
|
||||
{ "loggingMonitor", apiInfo.ToString() }
|
||||
{ "loggingMonitor", apiInfo.ToJson() }
|
||||
});
|
||||
logger.Log(logLevel, "ReZero超级API接口日志");
|
||||
}
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
"name": "admin.net.pro",
|
||||
"type": "module",
|
||||
"version": "2.4.33",
|
||||
"lastBuildTime": "2025.01.23",
|
||||
"lastBuildTime": "2025.01.24",
|
||||
"description": "Admin.NET 站在巨人肩膀上的 .NET 通用权限开发框架",
|
||||
"author": "zuohuaijun",
|
||||
"license": "MIT",
|
||||
|
||||
Loading…
Reference in New Issue
Block a user