gq 7 years ago
parent
commit
a0df5635b5
1 changed files with 3 additions and 3 deletions
  1. 3 3
      server/app/Http/Controllers/Api/V1/IndexController.php

+ 3 - 3
server/app/Http/Controllers/Api/V1/IndexController.php

xqd
@@ -132,17 +132,17 @@ class IndexController extends Controller
         if ($type == 'trend') {
 //            潮流  发布三天之内的梦想
             $banners = $this->getBanner();
-            $dreams = DreamInfoModel::where('end_time','>',date('Y-m-d H:i:s'))->where('created_at','<',date('Y-m-d H:i:s'))->where('created_at','>',date('Y-m-d H:i:s',time()-3*24*3600))->orderBy('score','desc')->with('user')->paginate(20);
+            $dreams = DreamInfoModel::where('status',1)->where('end_time','>',date('Y-m-d H:i:s'))->where('created_at','<',date('Y-m-d H:i:s'))->where('created_at','>',date('Y-m-d H:i:s',time()-3*24*3600))->orderBy('score','desc')->with('user')->paginate(20);
             $this->dreams($dreams);
         } elseif ($type == 'news') {
 //            最新  发布不到一天前的梦想   ->whereNotIn('id', $id_arr2)
             $banners = $this->getBanner();
-            $dreams = DreamInfoModel::where('end_time','>',date('Y-m-d H:i:s'))->where('created_at','<',date('Y-m-d H:i:s'))->where('created_at','>',date('Y-m-d H:i:s',time()-1*24*3600))->orderBy('created_at','desc')->with('user')->paginate(20);
+            $dreams = DreamInfoModel::where('status',1)->where('end_time','>',date('Y-m-d H:i:s'))->where('created_at','<',date('Y-m-d H:i:s'))->where('created_at','>',date('Y-m-d H:i:s',time()-1*24*3600))->orderBy('created_at','desc')->with('user')->paginate(20);
             $this->dreams($dreams);
         } else{
 //            热门
             $banners = $this->getBanner();
-            $dreams = DreamInfoModel::where('end_time','>',date('Y-m-d H:i:s'))->orderBy('score','desc')->with('user')->paginate(15);
+            $dreams = DreamInfoModel::where('status',1)->where('end_time','>',date('Y-m-d H:i:s'))->orderBy('score','desc')->with('user')->paginate(15);
             $this->dreams($dreams);
         }
         foreach ($dreams as $dream) {