zhuchengjie 2 лет назад
Родитель
Сommit
38519ca150
1 измененных файлов с 8 добавлено и 5 удалено
  1. 8 5
      app/Http/Controllers/QuickApp/User/ReadRecordController.php

+ 8 - 5
app/Http/Controllers/QuickApp/User/ReadRecordController.php

@@ -116,11 +116,14 @@ class ReadRecordController extends BaseController
                 }
             }
         }
-        usort($res, function ($a, $b) {
-            if ($a['time'] >= $b['time']) return -1;
-            return 1;
-        });
-        return response()->collection(new ReadRecordTransformer(), array_to_object($res));
+        if($res){
+            usort($res, function ($a, $b) {
+                if ($a['time'] >= $b['time']) return -1;
+                return 1;
+            });
+            return response()->collection(new ReadRecordTransformer(), array_to_object($res));
+        }
+        return response();
     }