fly пре 2 година
родитељ
комит
9723dfad52
1 измењених фајлова са 16 додато и 0 уклоњено
  1. 16 0
      Service/DeviceService.cs

+ 16 - 0
Service/DeviceService.cs

@@ -939,6 +939,22 @@ namespace WingDeviceService.Service
         public async Task<ReportVideoDeviceInfoResult> ReportVideoDeviceInfo(ReportVideoDeviceInfoRequest request)
         {
             var result = new ReportVideoDeviceInfoResult();
+            if (request.VideoDeviceInfos == null || request.VideoDeviceInfos.Count == 0)
+            {
+                //视屏设备画面信息为空
+                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");
+            }
             var deviceCode = await GetClientIdByTokenAsync(request.Token);
             var deviceDTO = await _deviceInfoDBServiceProxy.FindDeviceInfoByCodeAsync(deviceCode);
             deviceDTO.VideoDeviceInfos = request.VideoDeviceInfos;