chuweiqiang 1 年之前
父節點
當前提交
c0ce3ae079
共有 2 個文件被更改,包括 6 次插入6 次删除
  1. 1 1
      .idea/workspace.xml
  2. 5 5
      application/api/controller/Recruit.php

+ 1 - 1
.idea/workspace.xml

@@ -557,7 +557,7 @@
       <workItem from="1709512809659" duration="8143000" />
       <workItem from="1709599461139" duration="16311000" />
       <workItem from="1709685213840" duration="22391000" />
-      <workItem from="1709771488709" duration="18862000" />
+      <workItem from="1709771488709" duration="19118000" />
     </task>
     <servers />
   </component>

+ 5 - 5
application/api/controller/Recruit.php

@@ -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();