Browse Source

修复启动网络参数判断

refactor/permission-config
root 3 months ago
parent
commit
ee9ed1fd50
  1. 8
      src/X1.Application/ApplicationServices/DeviceRuntimeService.cs

8
src/X1.Application/ApplicationServices/DeviceRuntimeService.cs

@ -380,9 +380,9 @@ public class DeviceRuntimeService : IDeviceRuntimeCoreService
try
{
_logger.LogInformation("开始批量启动设备运行时状态,设备数量: {DeviceCount}", deviceRequests?.Count ?? 0);
bool checkRequestsParameter = deviceRequests != null && deviceRequests.Any() && deviceRequests.All(d => !string.IsNullOrEmpty(d.DeviceCode) && !string.IsNullOrEmpty(d.NetworkStackCode));
// 验证命令参数
if (deviceRequests != null && deviceRequests.Any() && deviceRequests.All(d => !string.IsNullOrEmpty(d.DeviceCode) && !string.IsNullOrEmpty(d.NetworkStackCode)))
if (!checkRequestsParameter)
{
_logger.LogWarning("命令参数验证失败");
return OperationResult<StartDeviceRuntimeResponse>.CreateFailure("命令参数验证失败");
@ -826,9 +826,11 @@ public class DeviceRuntimeService : IDeviceRuntimeCoreService
try
{
bool checkRequestsParameter = deviceCodes != null && deviceCodes.Any() && deviceCodes.All(code => !string.IsNullOrEmpty(code));
// 验证请求参数
_logger.LogDebug("[{RequestId}] 开始验证请求参数", requestId);
if (deviceCodes != null && deviceCodes.Any() && deviceCodes.All(code => !string.IsNullOrEmpty(code)))
if (!checkRequestsParameter)
{
_logger.LogWarning("[{RequestId}] 请求参数验证失败", requestId);
return OperationResult<StopDeviceRuntimeResponse>.CreateFailure("请求参数无效");

Loading…
Cancel
Save