|
@@ -102,6 +102,21 @@ class Api
|
|
|
return '';
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 获取顶级分类
|
|
|
+ *
|
|
|
+ * @return mixed
|
|
|
+ */
|
|
|
+ public function getTop($column)
|
|
|
+ {
|
|
|
+ $where = array();
|
|
|
+ if ($column > 0) {
|
|
|
+ $where['column_id'] = $column;
|
|
|
+ }
|
|
|
+ $result = Dever::db('category/info')->getTop($where);
|
|
|
+ return $result;
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 获取所有信息
|
|
|
*
|
|
@@ -154,8 +169,36 @@ class Api
|
|
|
return $name;
|
|
|
}
|
|
|
|
|
|
+ # 根据上级分类获取下级分类 按照info_id进行索引
|
|
|
+ public function getChild($info_id)
|
|
|
+ {
|
|
|
+ if (is_numeric($info_id)) {
|
|
|
+ $where['info_id'] = $info_id;
|
|
|
+ } else {
|
|
|
+ $where['info_id_in'] = $info_id;
|
|
|
+ }
|
|
|
+
|
|
|
+ $data = Dever::db('category/info')->getChild($where);
|
|
|
+
|
|
|
+ return $data;
|
|
|
+ }
|
|
|
+
|
|
|
+ # 根据上级分类获取下级分类
|
|
|
+ public function getList($info_id)
|
|
|
+ {
|
|
|
+ if (is_numeric($info_id)) {
|
|
|
+ $where['info_id'] = $info_id;
|
|
|
+ } else {
|
|
|
+ $where['info_id_in'] = $info_id;
|
|
|
+ }
|
|
|
+
|
|
|
+ $data = Dever::db('category/info')->getList($where);
|
|
|
+
|
|
|
+ return $data;
|
|
|
+ }
|
|
|
+
|
|
|
# 根据顶级分类获取最低级的分类
|
|
|
- public function getChild($top_id, $level = -1)
|
|
|
+ public function getChildByTop($top_id, $level = -1)
|
|
|
{
|
|
|
$where['top_id'] = $top_id;
|
|
|
$where['level'] = $level;
|