src/Biz/Article/Dao/Impl/ArticleDaoImpl.php

(开头部分) 1KB

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

<?php

namespace Biz\Article\Dao\Impl;

use Biz\Article\Dao\ArticleDao;
use Biz\Common\CommonException;
use Codeages\Biz\Framework\Dao\GeneralDaoImpl;

class ArticleDaoImpl extends GeneralDaoImpl implements ArticleDao
{
    protected $table = 'article';

    public function getPrevious($categoryId, $createdTime)
    {
        $sql = "SELECT * FROM {$this->table} WHERE `categoryId` = ? AND createdTime < ? ORDER BY `createdTime` DESC LIMIT 1";

        return $this->db()->fetchAssoc($sql, array($categoryId, $createdTime)) ?: array();
    }

    public function getNext($categoryId, $createdTime)
    {
        $sql = "SELECT * FROM {$this->table} WHERE  `categoryId` = ? AND createdTime > ? ORDER BY `createdTime` ASC LIMIT 1";

        return $this->db()->fetchAssoc($sql, array($categoryId, $createdTime)) ?: array();
    }

    public function findByIds(array $ids)
    {
        return $this->findInField('id', $ids);
    }

    public function findAll()
    {
        $sql = "SELECT * FROM {$this->table};";

        return $this->db()->fetchAll($sql, array()) ?: array();
    }

    public function searchByCategoryIds(array $categoryIds, $start, $limit)
    {
        return $this->search(
            array(
                'categoryIds' => $categoryIds,
            ),
            array('createdTime' => 'DESC'),
            $start,
            $limit
        );
    }

    public function countByCategoryIds(array $categoryIds)
    {
        if (empty($categoryIds)) {
            throw CommonException::ERROR_PARAMETER();
        }

        return $this->count(array('categoryIds' => $categoryIds));
    }

    public function waveArticle($id, $field, $diff)

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

AI 解读 AI

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

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