* Refactor getListCount function.
This commit is contained in:
@@ -465,24 +465,24 @@ class searchModel extends model
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* 获取可访问的有索引的模块。
|
||||||
* Get counts of keyword search results.
|
* Get counts of keyword search results.
|
||||||
*
|
*
|
||||||
* @param string $keywords
|
* @param string|array $type
|
||||||
* @param string $type
|
|
||||||
* @access public
|
* @access public
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public function getListCount(array|string $type = 'all')
|
public function getListCount(array|string $type = 'all'): array
|
||||||
{
|
{
|
||||||
$allowedObjects = $this->searchTao->getAllowedObjects($type);
|
$allowedObjects = $this->searchTao->getAllowedObjects($type);
|
||||||
|
|
||||||
$filterObject = array();
|
$filterObjects = array();
|
||||||
foreach($allowedObjects as $index => $object)
|
foreach($allowedObjects as $index => $object)
|
||||||
{
|
{
|
||||||
if(strpos(',feedback,ticket,', ",$object,") !== false)
|
if(strpos(',feedback,ticket,', ",$object,") !== false)
|
||||||
{
|
{
|
||||||
unset($allowedObjects[$index]);
|
unset($allowedObjects[$index]);
|
||||||
$filterObject[] = $object;
|
$filterObjects[] = $object;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -494,7 +494,7 @@ class searchModel extends model
|
|||||||
->markRight(2)
|
->markRight(2)
|
||||||
->andWhere('addedDate')->le(helper::now())
|
->andWhere('addedDate')->le(helper::now())
|
||||||
->groupBy('objectType')
|
->groupBy('objectType')
|
||||||
->fetchPairs('objectType', 'objectCount');
|
->fetchPairs();
|
||||||
arsort($typeCount);
|
arsort($typeCount);
|
||||||
return $typeCount;
|
return $typeCount;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user