ZxcZxc123 2 vuotta sitten
vanhempi
commit
8323d522f6
1 muutettua tiedostoa jossa 25 lisäystä ja 34 poistoa
  1. 25 34
      app/model/api/EducationModel.php

+ 25 - 34
app/model/api/EducationModel.php

@@ -3,9 +3,8 @@
 namespace app\model\api;
 
 use think\Model;
-use think\response\Json;
 
-/**
+    /**
     * 教育模型
     */
 class EducationModel extends Model
@@ -19,38 +18,30 @@ class EducationModel extends Model
         return new self;
     }
 
-    /**
-     * 获取所有分类
-     *
-     * @return \think\Response|Json
-     */
-    public function getCate()
-    {
-        $items = $this->table(self::CATE_TABLE_NAME)
-            ->where(['status' => 'Y'])
-            ->order('sort', 'asc')
-            ->column('id,pid,name,sort', 'id');
-
-        $tree = array();
-        foreach ($items as $key => $item) {
-            $items[$key]['oriName'] = $item['name'];
-            if (isset ($items [$item ['pid']])) {
-                $items [$item ['pid']] ['children'] [$item ['id']] = &$items [$item ['id']];
-            } else {
-                $tree [$item ['id']] = &$items [$item ['id']];
-            }
-        }
-
-        // 打印 $tree 数组
-        print_r($tree);
-
-        // 返回 JSON 响应对象
-        return \think\Response\Json::create([
-            'code' => 200,
-            'msg' => 'success',
-            'data' => $tree,
-        ]);
-    }
+//    /**
+//     * 获取所有分类
+//     *
+//     * @return mixed
+//     */
+//    public function getCate()
+//    {
+//        $items = $this->table(self::CATE_TABLE_NAME)
+//            ->where(['status' => 'Y'])
+//            ->order('sort', 'asc')
+//            ->column('id,pid,name,sort', 'id');
+//
+//        $tree = array();
+//        foreach ($items as $key => $item) {
+//            $items[$key]['oriName'] = $item['name'];
+//            if (isset ($items [$item ['pid']])) {
+//                $items [$item ['pid']] ['children'] [$item ['id']] = &$items [$item ['id']];
+//            } else {
+//                $tree [$item ['id']] = &$items [$item ['id']];
+//            }
+//        }
+//
+//        return  array_values($tree);
+//    }
 
 //    public function getGrList($userId)
 //    {