gq 7 vuotta sitten
vanhempi
commit
ac958e28db

+ 1 - 1
server/app/Http/Controllers/Api/V1/Controller.php

xqd
@@ -30,7 +30,7 @@ class Controller extends BaseController
         $this->middleware('auth:api', [
             'except' => [
                 'upload', 'getCode', 'login', 'wechatLogin', 'alipayNotify', 'wechatpayNotify',
-                'download',  'test',
+                'download',  'test'
             ]
         ]);
 

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

xqd xqd
@@ -133,16 +133,16 @@ class IndexController extends Controller
         }*/
         $type = $request->type;
         if ($type == 'trend') {
-            $dreams = DreamInfoModel::orderBy('score','desc')->with('user')->whereNotIn('id', $id_arr1)->limit(100)->paginate(20);
+            $dreams = DreamInfoModel::where('end_time','<',date('Y-m-d H:i:s'))->orderBy('score','desc')->with('user')->whereNotIn('id', $id_arr1)->limit(100)->paginate(20);
             $this->dreams($dreams);
             return $this->api(compact('users','dreams'));
         } elseif ($type == 'news') {
-            $dreams = DreamInfoModel::orderBy('score','desc')->orderBy('created_at','desc')->with('user')->whereNotIn('id', $id_arr2)->limit(500)->paginate(20);
+            $dreams = DreamInfoModel::where('end_time','<',date('Y-m-d H:i:s'))->orderBy('score','desc')->orderBy('created_at','desc')->with('user')->whereNotIn('id', $id_arr2)->limit(500)->paginate(20);
             $this->dreams($dreams);
             return $this->api(compact('users','dreams'));
         } else{
             $banners = $this->getBanner();
-            $dreams = DreamInfoModel::orderBy('score','desc')->with('user')->limit(15)->paginate(15);
+            $dreams = DreamInfoModel::where('end_time','<',date('Y-m-d H:i:s'))->orderBy('score','desc')->with('user')->limit(15)->paginate(15);
             $this->dreams($dreams);
             return $this->api(compact('banners','users','dreams'));
         }
@@ -465,16 +465,16 @@ class IndexController extends Controller
         }
         $type = $request->type;
         if ($type == 'trend') {
-            $dreams = $query->orderBy('score','desc')->with('user')->whereNotIn('id', $id_arr1)->limit(100)->paginate(20);
+            $dreams = $query->where('end_time','<',date('Y-m-d H:i:s'))->orderBy('score','desc')->with('user')->whereNotIn('id', $id_arr1)->limit(100)->paginate(20);
             $this->dreams($dreams);
             return $this->api(compact('users','dreams'));
         } elseif ($type == 'news') {
-            $dreams = $query->orderBy('score','desc')->orderBy('created_at','desc')->with('user')->whereNotIn('id', $id_arr2)->limit(500)->paginate(20);
+            $dreams = $query->where('end_time','<',date('Y-m-d H:i:s'))->orderBy('score','desc')->orderBy('created_at','desc')->with('user')->whereNotIn('id', $id_arr2)->limit(500)->paginate(20);
             $this->dreams($dreams);
             return $this->api(compact('users','dreams'));
         } else{
             $banners = $this->getBanner();
-            $dreams = $query->orderBy('score','desc')->with('user')->limit(20)->paginate(20);
+            $dreams = $query->where('end_time','<',date('Y-m-d H:i:s'))->orderBy('score','desc')->with('user')->limit(20)->paginate(20);
             $this->dreams($dreams);
             return $this->api(compact('banners','users','dreams'));
         }