mirror of
https://github.com/crmeb/CRMEB.git
synced 2026-10-30 22:40:48 +00:00
文章分类搜索
This commit is contained in:
parent
dccfdfbe5e
commit
5364f2d229
@ -32,11 +32,15 @@ class ArticleCategoryDao extends BaseDao
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取文章列表
|
||||
* 获取文章分类列表
|
||||
* @param array $where
|
||||
* @param int $page
|
||||
* @param int $limit
|
||||
* @return mixed
|
||||
* @throws \ReflectionException
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
* @throws \think\db\exception\DbException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
*/
|
||||
public function getList(array $where, int $page = 0, int $limit = 0)
|
||||
{
|
||||
|
||||
@ -39,23 +39,14 @@ class ArticleCategoryServices extends BaseServices
|
||||
* 获取文章分类列表
|
||||
* @param array $where
|
||||
* @return array
|
||||
* @throws \ReflectionException
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
* @throws \think\db\exception\DbException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
*/
|
||||
public function getList(array $where)
|
||||
{
|
||||
[$page, $limit] = $this->getPageValue();
|
||||
$list = $this->dao->getList($where);
|
||||
if (!empty($list) && $where['title'] !== '') {
|
||||
$pids = Arr::getUniqueKey($list, 'pid');
|
||||
$parentList = $this->dao->getList(['id' => $pids]);
|
||||
$list = array_merge($list, $parentList);
|
||||
foreach ($list as $key => $item) {
|
||||
$arr = $item;
|
||||
unset($list[$key]);
|
||||
if (!in_array($arr, $list)) {
|
||||
$list[] = $arr;
|
||||
}
|
||||
}
|
||||
}
|
||||
$list = get_tree_children($list);
|
||||
$count = $this->dao->count($where);
|
||||
return compact('list', 'count');
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user