src/Biz/Content/Service/Impl/ContentServiceImpl.php

(开头部分) 1KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

<?php

namespace Biz\Content\Service\Impl;

use Biz\BaseService;
use Biz\Content\ContentException;
use Biz\Content\Dao\ContentDao;
use Biz\Content\Service\ContentService;
use Biz\Content\Type\ContentTypeFactory;
use Biz\System\Service\LogService;
use Biz\Taxonomy\Service\CategoryService;
use Codeages\Biz\Framework\Event\Event;
use AppBundle\Common\ArrayToolkit;

class ContentServiceImpl extends BaseService implements ContentService
{
    public function getContent($id)
    {
        return $this->getContentDao()->get($id);
    }

    public function getContentByAlias($alias)
    {
        return $this->getContentDao()->getByAlias($alias);
    }

    public function searchContents($conditions, $sort, $start, $limit)
    {
        switch ($sort) {
            default:
                $orderBy = array('createdTime' => 'DESC');
                break;
        }
        $conditions = $this->prepareSearchConditions($conditions);

        return $this->getContentDao()->search($conditions, $orderBy, $start, $limit);
    }

    public function searchContentCount($conditions)
    {
        $conditions = $this->prepareSearchConditions($conditions);

        return $this->getContentDao()->count($conditions);
    }

    protected function prepareSearchConditions($conditions)
    {
        $conditions = array_filter($conditions);
        if (isset($conditions['categoryId'])) {
            $childrenIds = $this->getCategoryService()->findCategoryChildrenIds($conditions['categoryId']);
            $conditions['categoryIds'] = array_merge(array($conditions['categoryId']), $childrenIds);
            unset($conditions['categoryId']);
        }

        return $conditions;
    }

    public function createContent($content)
    {
        $user = $this->getCurrentUser();

24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明

AI 解读 AI

登录后可用,每次 10 算力,解读结果公开显示在下面。

还没有人解读过这个文件。