gq 7 anos atrás
pai
commit
b52a323cfb

+ 4 - 2
server/app/Http/Controllers/Api/V1/DreamController.php

xqd xqd
@@ -219,7 +219,9 @@ class DreamController extends Controller
             if(count($top3user) <= 2) $top3user[] = $user ;
         }
         if ($type == 'paihang') return $this->api($topuser);
-        $interactions = InteractionInfo::where('dream_id',$id)->with('comments')->orderBy('id','desc')->get();
+        $interactions = InteractionInfo::where('dream_id',$id)->with(['comments' => function ($query) {
+            $query->orderBy('created_at');
+        }])->orderBy('id','desc')->get();
         /*dd($interactions);
         foreach ($interactions as $item) {
             $item->comments;
@@ -258,7 +260,7 @@ class DreamController extends Controller
         $dream->show_button = $show_button;
 //        梦想互动
         $interactions = InteractionInfo::where('dream_id',$id)->with(['comments' => function ($query) {
-            $query->orderBy('created_at','desc');
+            $query->orderBy('created_at');
         }])->orderBy('created_at','desc')->get();
         $dream->interactions = $interactions;
 //        dd($interactions);