src/Biz/Article/Service/Impl/ArticleServiceImpl.php

(开头部分) 1KB

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

<?php

namespace Biz\Article\Service\Impl;

use AppBundle\Common\SimpleValidator;
use Biz\Article\ArticleException;
use Biz\Article\CategoryException;
use Biz\BaseService;
use Biz\Article\Dao\ArticleDao;
use AppBundle\Common\ArrayToolkit;
use Biz\Common\CommonException;
use Biz\System\Service\LogService;
use Biz\Article\Dao\ArticleLikeDao;
use Biz\Taxonomy\Service\TagService;
use Biz\Article\Service\ArticleService;
use Biz\User\UserException;
use Codeages\Biz\Framework\Event\Event;
use Biz\Article\Service\CategoryService;

class ArticleServiceImpl extends BaseService implements ArticleService
{
    public function getArticle($id)
    {
        return $this->getArticleDao()->get($id);
    }

    public function getArticlePrevious($currentArticleId)
    {
        $article = $this->getArticle($currentArticleId);

        if (empty($article)) {
            $this->createNewException(ArticleException::NOTFOUND());
        }

        $createdTime = $article['createdTime'];
        $categoryId = $article['categoryId'];
        $category = $this->getCategoryService()->getCategory($categoryId);

        if (empty($category)) {
            $this->createNewException(CategoryException::NOTFOUND_CATEGORY());
        }

        return $this->getArticleDao()->getPrevious($categoryId, $createdTime);
    }

    public function getArticleNext($currentArticleId)
    {
        $article = $this->getArticle($currentArticleId);

        if (empty($article)) {
            $this->createNewException(ArticleException::NOTFOUND());
        }

        $createdTime = $article['createdTime'];
        $categoryId = $article['categoryId'];
        $category = $this->getCategoryService()->getCategory($categoryId);

        if (empty($category)) {
            $this->createNewException(CategoryException::NOTFOUND_CATEGORY());
        }

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

AI 解读 AI

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

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