src/Topxia/MobileBundleV2/Processor/Impl/CategoryProcessorImpl.php
(开头部分) 1KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
<?php
namespace Topxia\MobileBundleV2\Processor\Impl;
use Topxia\MobileBundleV2\Processor\BaseProcessor;
use Topxia\MobileBundleV2\Processor\CategoryProcessor;
class CategoryProcessorImpl extends BaseProcessor implements CategoryProcessor
{
public function getTags()
{
$tags = $this->getTagService()->findAllTags(0, 100);
$tags = array_map(function ($tag) {
$tag['createdTime'] = date('c', $tag['createdTime']);
return $tag;
}, $tags);
return $tags;
}
public function getCategories()
{
$category = $this->getParam('category');
if (empty($category)) {
$categories = $this->controller->getCategoryService()->findGroupRootCategories('course');
} else {
$group = $this->controller->getCategoryService()->getCategoryByCode($category);
if (empty($group)) {
$categories = array();
} else {
$ids = $this->controller->getCategoryService()->findCategoryChildrenIds($group['id']);
$categories = $this->controller->getCategoryService()->findCategoriesByIds($ids);
$categories = array_values($categories);
}
}
return $categories;
}
private function coverCategoryChilds($categories)
{
$realityDepth = 0;
$categorieStack = array();
foreach ($categories as $key => $categorie) {
if (empty($categorieStack)) {
array_push($categorieStack, $categorie);
continue;
}
$popCategory = &$categorieStack[count($categorieStack) - 1];
$popDepth = $popCategory['depth'];
$depth = $categorie['depth'];
if ($depth > 0 && $depth > $popDepth) {
if (!isset($popCategory['childs'])) {
$popCategory['childs'] = array();
}
24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明
AI 解读 AI
登录后可用,每次 10 算力,解读结果公开显示在下面。
还没有人解读过这个文件。