src/Biz/Course/Dao/Impl/CourseNoteLikeDaoImpl.php

(开头部分) 1KB

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

<?php

namespace Biz\Course\Dao\Impl;

use Biz\Course\Dao\CourseNoteLikeDao;
use Codeages\Biz\Framework\Dao\GeneralDaoImpl;

class CourseNoteLikeDaoImpl extends GeneralDaoImpl implements CourseNoteLikeDao
{
    protected $table = 'course_note_like';

    public function getByNoteIdAndUserId($noteId, $userId)
    {
        return $this->getByFields(array(
            'noteId' => $noteId,
            'userId' => $userId,
        ));
    }

    public function deleteByNoteIdAndUserId($noteId, $userId)
    {
        return $this->db()->delete($this->table, array('noteId' => $noteId, 'userId' => $userId));
    }

    public function findByUserId($userId)
    {
        $sql = "SELECT * FROM {$this->table} WHERE userId = ? ORDER BY createdTime DESC";

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

    public function findByNoteId($noteId)
    {
        $sql = "SELECT * FROM {$this->table} WHERE noteId = ? ORDER BY createdTime DESC";

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

    public function findByNoteIds(array $noteIds)
    {
        return $this->findInField('noteId', $noteIds);
    }

    public function findByNoteIdsAndUserId(array $noteIds, $userId)
    {
        if (empty($noteIds) || empty($userId)) {
            return array();
        }
        $marks = str_repeat('?,', count($noteIds) - 1).'?';
        $sql = "SELECT * FROM {$this->table} WHERE userId = ? AND noteId IN ({$marks});";

        $noteIds = array_merge(array($userId), $noteIds);

        return $this->db()->fetchAll($sql, $noteIds);
    }

    public function deleteByNoteId($noteId)
    {
        return $this->db()->delete($this->table, array('noteId' => $noteId));
    }

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

AI 解读 AI

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

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