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

(开头部分) 1KB

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

<?php

namespace Biz\Content\Service\Impl;

use Biz\BaseService;
use Biz\Common\CommonException;
use Biz\Content\BlockException;
use Biz\Content\Dao\BlockDao;
use Biz\Content\Dao\BlockHistoryDao;
use Biz\Content\Dao\BlockTemplateDao;
use Biz\Content\Service\BlockService;
use Biz\System\Service\LogService;
use Biz\System\Service\SettingService;
use AppBundle\Common\ArrayToolkit;

class BlockServiceImpl extends BaseService implements BlockService
{
    public function createBlockTemplate($blockTemplate)
    {
        if (!ArrayToolkit::requireds($blockTemplate, array('code', 'mode', 'category', 'meta', 'data', 'templateName', 'title'))) {
            $this->createNewException(CommonException::ERROR_PARAMETER_MISSING());
        }
        $createdBlockTemplate = $this->getBlockTemplateDao()->create($blockTemplate);

        return $createdBlockTemplate;
    }

    public function findBlockHistoryCountByBlockId($blockId)
    {
        return $this->getBlockHistoryDao()->countByBlockId($blockId);
    }

    public function getLatestBlockHistory()
    {
        return $this->getBlockHistoryDao()->getLatest();
    }

    public function getLatestBlockHistoriesByBlockIds($blockIds)
    {
        $blockHistories = array();
        foreach ($blockIds as $key => $blockId) {
            $block = $this->getBlockDao()->get($blockId);
            $blockHistories[$block['blockTemplateId']] = $this->getBlockHistoryDao()->getLatestByBlockId($blockId);
        }

        return $blockHistories;
    }

    public function getBlock($id)
    {
        $result = $this->getBlockDao()->get($id);
        if (empty($result)) {
            $blockTemplate = $this->getBlockTemplate($id);

            if (empty($blockTemplate)) {
                $this->createNewException(BlockException::NOTFOUND_TEMPLATE());
            }

            $blockTemplate['blockTemplateId'] = $blockTemplate['id'];
            $blockTemplate['blockId'] = 0;

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

AI 解读 AI

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

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