|
@@ -103,19 +103,19 @@ class Recruit extends Base
|
|
|
}
|
|
|
switch ($sort_type) {
|
|
|
case 1:
|
|
|
- $order = ['sort'=>'desc','id'=>'asc'];
|
|
|
+ $order = 'sort desc,id asc';
|
|
|
break;
|
|
|
case 2:
|
|
|
- $order = ['id'=>'asc','sort'=>'desc'];
|
|
|
+ $order = 'id asc,sort desc';
|
|
|
break;
|
|
|
case 3:
|
|
|
- $order = ['id'=>'desc','sort'=>'desc'];
|
|
|
+ $order = 'id desc,sort desc';
|
|
|
break;
|
|
|
}
|
|
|
if(input('pid')) $where[] = ['id','=',input('pid')];
|
|
|
- $list = RecruitCate::where($where)->field('id,title,pid,lev')->order($order)->select()->toArray();
|
|
|
+ $list = RecruitCate::where($where)->field('id,title,pid,lev')->order('sort desc,id asc')->select()->toArray();
|
|
|
foreach ($list as &$v) {
|
|
|
- $v['children'] = RecruitCate::where([['is_deleted','=',0],['pid','=',$v['id']]])->field('id,title,pid,lev')->order('sort desc,id asc')->select()->toArray();
|
|
|
+ $v['children'] = RecruitCate::where([['is_deleted','=',0],['pid','=',$v['id']]])->field('id,title,pid,lev')->order($order)->select()->toArray();
|
|
|
foreach ($v['children'] as $key => $val){
|
|
|
//third_classify
|
|
|
$v['children'][$key]['recruit'] = RecruitModel::where('third_classify',$val['id'])->limit(2)->select();
|