作者 何书鹏
1 个管道 的构建 通过 耗费 0 秒

排序优化

@@ -223,7 +223,7 @@ class Index extends Api @@ -223,7 +223,7 @@ class Index extends Api
223 } 223 }
224 $data = Job::where($where) 224 $data = Job::where($where)
225 ->field("*,{$distance} distance") 225 ->field("*,{$distance} distance")
226 - ->order(['is_top'=>'desc','top_time'=>'desc','distance'=>'asc','weigh'=>'asc']) 226 + ->order(['distance'=>'asc','weigh'=>'desc'])
227 ->paginate($page_num,false,['page'=>$page]) 227 ->paginate($page_num,false,['page'=>$page])
228 ->each(function($v){ 228 ->each(function($v){
229 $v->visible(['id','cover','job_name','salary','people_num','factory_price_total','factory_price','subsidy_price']); 229 $v->visible(['id','cover','job_name','salary','people_num','factory_price_total','factory_price','subsidy_price']);
@@ -308,7 +308,7 @@ class Index extends Api @@ -308,7 +308,7 @@ class Index extends Api
308 ->join('job_collect jc','jc.job_id = j.id and user_id = '.$this->auth->id) 308 ->join('job_collect jc','jc.job_id = j.id and user_id = '.$this->auth->id)
309 ->where($where) 309 ->where($where)
310 ->field('j.*') 310 ->field('j.*')
311 - ->order(['j.is_top'=>'desc','j.top_time'=>'desc','jc.createtime'=>'desc','weigh'=>'asc']) 311 + ->order(['jc.createtime'=>'desc','j.weigh'=>'desc'])
312 ->paginate($page_num,false,['page'=>$page]) 312 ->paginate($page_num,false,['page'=>$page])
313 ->each(function($v){ 313 ->each(function($v){
314 $v->visible(['id','cover','job_name','salary','people_num','factory_price_total','factory_price','subsidy_price']); 314 $v->visible(['id','cover','job_name','salary','people_num','factory_price_total','factory_price','subsidy_price']);