wesmiler 1 year ago
parent
commit
f0653a472c
1 changed files with 5 additions and 3 deletions
  1. 5 3
      app/Services/Api/VideoService.php

+ 5 - 3
app/Services/Api/VideoService.php

@@ -235,6 +235,7 @@ class VideoService extends BaseService
                 ->orderByRaw($order)
                 ->paginate($pageSize > 0 ? $pageSize : 9999999);
             $list = $list ? $list->toArray() : [];
+            $list = isset($list['data']) && $list['data']? $list['data'] :[];
         }
 
         // 数据不够补充默认匹配数据
@@ -245,11 +246,12 @@ class VideoService extends BaseService
                 ->orderByRaw($order)
                 ->paginate($pageSize > 0 ? $pageSize : 9999999);
             $list1 = $list1 ? $list1->toArray() : [];
+            $list1 = isset($list1['data']) && $list1['data']? $list1['data'] :[];
             $list = array_merge($list, $list1);
         }
 
-        if ($list && $list['data']) {
-            foreach ($list['data'] as &$item) {
+        if ($list) {
+            foreach ($list as &$item) {
                 $item['time_text'] = isset($item['create_time']) ? dateFormat($item['create_time'], 'Y-m-d H:i') : '';
                 $item['thumb'] = isset($item['thumb']) && $item['thumb'] ? get_image_url($item['thumb']) : '';
                 if(isset($item['albums'])){
@@ -288,7 +290,7 @@ class VideoService extends BaseService
             "match"=> $match,
             'sss'=> $list,
             'sss1'=> $list1,
-            'total'    => isset($list['total']) ? $list['total'] : 0,
+            'total'    => count($list),
             'list'     => isset($list['data']) ? $list['data'] : []
         ];
     }