gq 7 年之前
父节点
当前提交
5ce100d678
共有 1 个文件被更改,包括 2 次插入2 次删除
  1. 2 2
      server/app/Http/Controllers/Api/V1/IndexController.php

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

xqd xqd
@@ -114,7 +114,7 @@ class IndexController extends Controller
         $id = $login_user->id;
         $arr1 =DreamInfoModel::orderBy('score','desc')->limit(20)->select('id')->get()->toArray();
         $id_arr1 = array_column($arr1,'id');
-        $arr2 =DreamInfoModel::orderBy('score','desc')->limit(120)->select('id')->get()->toArray();
+        $arr2 =DreamInfoModel::orderBy('score','desc')->offset(20)->limit(120)->select('id')->get()->toArray();
         $id_arr2 = array_column($arr2,'id');
         $dtusers =UserCareUser::where('user_id',$id)->with('other_user')->
         where('dream_number','>',0)->orderBy('created_at')->get()->toArray();
@@ -135,7 +135,7 @@ class IndexController extends Controller
             $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::orderBy('score','desc')->orderBy('created_at','desc')->with('user')->whereNotIn('id', $id_arr2)->limit(500)->toSql();
             $this->dreams($dreams);
             return $this->api(compact('users','dreams'));
         } else{