李昊 4 years ago
parent
commit
3e462618b3

+ 5 - 2
gx_api/GxPress/Service/GxPress.Service.Implement/Category/CategoryService.cs

@@ -51,8 +51,11 @@ namespace GxPress.Service.Implement.Category
         public async Task<CategoryResult> GetAsync(int id)
         {
             var result = await categoryRepository.GetAsync(id);
-            var mediaIds = await systemLableMediaRepository.GetMediaIdsAsync(id, result.TypeValue == 0 ? 0 : 1);
-            result.MediaIds = mediaIds.ToList();
+            if (result != null)
+            {
+                var mediaIds = await systemLableMediaRepository.GetMediaIdsAsync(id,1);
+                result.MediaIds = mediaIds.ToList();
+            }
             return result;
         }
     }