Browse Source

上报画面尺寸信息调整

Jeremy 2 years ago
parent
commit
bd8472c24b
1 changed files with 13 additions and 14 deletions
  1. 13 14
      Service/DeviceService.cs

+ 13 - 14
Service/DeviceService.cs

@@ -1006,21 +1006,20 @@ namespace WingDeviceService.Service
         public async Task<ReportVideoDeviceInfoResult> ReportVideoDeviceInfoAsync(ReportVideoDeviceInfoRequest request)
         {
             var result = new ReportVideoDeviceInfoResult();
-            if (request.VideoDeviceInfos == null || request.VideoDeviceInfos.Count == 0)
+            request.VideoDeviceInfos = request.VideoDeviceInfos?.ToList() ?? new List<VideoDeviceInfo>();
+            if (request.VideoDeviceInfos.Any())
             {
-                //视屏设备画面信息为空
-                ThrowCustomerException(CustomerRpcCode.VideoDeviceInfosEmpty, "VideoDeviceInfosEmpty");
-            }
-            if (request.VideoDeviceInfos.Any(x => string.IsNullOrWhiteSpace(x.VideoDeviceId)))
-            {
-                //视屏设备ID为空
-                ThrowCustomerException(CustomerRpcCode.VideoDeviceIdEmpty, "VideoDeviceIdEmpty");
-            }
-            var videoDeviceIdCount = request.VideoDeviceInfos.Select(x => x.VideoDeviceId).Distinct().Count();
-            if (videoDeviceIdCount < request.VideoDeviceInfos.Count)
-            {
-                //视屏设备ID重复
-                ThrowCustomerException(CustomerRpcCode.VideoDeviceIdRepeatError, "VideoDeviceIdRepeatError");
+                if (request.VideoDeviceInfos.Any(x => string.IsNullOrWhiteSpace(x.VideoDeviceId)))
+                {
+                    //视屏设备ID为空
+                    ThrowCustomerException(CustomerRpcCode.VideoDeviceIdEmpty, "VideoDeviceIdEmpty");
+                }
+                var videoDeviceIdCount = request.VideoDeviceInfos.Select(x => x.VideoDeviceId).Distinct().Count();
+                if (videoDeviceIdCount < request.VideoDeviceInfos.Count)
+                {
+                    //视屏设备ID重复
+                    ThrowCustomerException(CustomerRpcCode.VideoDeviceIdRepeatError, "VideoDeviceIdRepeatError");
+                }
             }
             var deviceCode = await GetClientIdByTokenAsync(request.Token);
             var deviceDTO = await _deviceInfoDBServiceProxy.FindDeviceInfoByCodeAsync(deviceCode);