Ken 4 days ago
parent
commit
156aebd7ae
1 changed files with 8 additions and 4 deletions
  1. 8 4
      app/Services/BackflowService.php

+ 8 - 4
app/Services/BackflowService.php

@@ -74,12 +74,10 @@ class BackflowService extends BaseService
     {
         $date = Carbon::now('Asia/Shanghai')->format('Y-m');
         $limit = isset($search['limit']) ? $search['limit'] : 15;
-        $query = self::$MODEL::where(self::getWhere($search))
+        $query = self::$MODEL::where(self::getWhere($search));
 
 //            ->where('date', '<', $date)
-            ->with(['member'])
-            ->orderByDesc('date')
-            ->orderBy('status');
+
 
 
         if (isset($search['username']) && !empty($search['username'])) {
@@ -88,6 +86,12 @@ class BackflowService extends BaseService
                 $query1->where('username', $username);
             });
         }
+
+
+        $query->with(['member'])
+            ->orderByDesc('date')
+            ->orderBy('status');
+
         $paginator = $query->paginate($limit);
         return ['total' => $paginator->total(), 'data' => $paginator->items()];
     }