|
|
@@ -18,30 +18,30 @@ class EducationModel extends Model
|
|
|
return new self;
|
|
|
}
|
|
|
|
|
|
-// /**
|
|
|
-// * 获取所有分类
|
|
|
-// *
|
|
|
-// * @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);
|
|
|
-// }
|
|
|
+ /**
|
|
|
+ * 获取所有分类
|
|
|
+ *
|
|
|
+ * @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)
|
|
|
// {
|