src/Biz/OpenCourse/Dao/Impl/RecommendedCourseDaoImpl.php
(开头部分) 1KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
<?php
namespace Biz\OpenCourse\Dao\Impl;
use Biz\OpenCourse\Dao\RecommendedCourseDao;
use Codeages\Biz\Framework\Dao\AdvancedDaoImpl;
class RecommendedCourseDaoImpl extends AdvancedDaoImpl implements RecommendedCourseDao
{
protected $table = 'open_course_recommend';
public function declares()
{
return array(
'timestamps' => array('createdTime'),
'orderbys' => array('createdTime', 'recommendedSeq', 'studentNum', 'hitNum', 'seq'),
'conditions' => array(
'id = :id',
'id IN (:ids)',
'userId = :userId',
'openCourseId = :openCourseId',
'recommendCourseId = :recommendCourseId',
'type = :type',
'createdTime >= :startTimeGreaterThan',
'createdTime < :startTimeLessThan',
),
);
}
public function getByCourseIdAndType($openCourseId, $recommendCourseId, $type)
{
$sql = "SELECT * FROM {$this->table()} WHERE openCourseId = ? AND recommendCourseId = ? AND type = ? ORDER BY seq ASC;";
return $this->db()->fetchAssoc($sql, array($openCourseId, $recommendCourseId, $type)) ?: null;
}
public function findByOpenCourseId($openCourseId)
{
$sql = "SELECT * FROM {$this->table()} WHERE openCourseId = ? ORDER BY seq ASC;";
return $this->db()->fetchAll($sql, array($openCourseId)) ?: array();
}
public function deleteByOpenCourseIdAndRecommendCourseId($openCourseId, $recommendCourseId)
{
$sql = "DELETE FROM {$this->table()} WHERE openCourseId = ? AND recommendCourseId= ?";
return $this->db()->executeUpdate($sql, array($openCourseId, $recommendCourseId));
}
public function findRandomRecommendCourses($courseId, $num)
{
$conditions = array(
'openCourseId' => $courseId,
);
$count = $this->count($conditions);
$num = (int) $num;
$max = $count - $num - 1;
if ($max < 0) {
24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明
AI 解读 AI
登录后可用,每次 10 算力,解读结果公开显示在下面。
还没有人解读过这个文件。