/** * 课程学习人数++ */ function incrCourseViewNum() { $controllers = array("Section" => array("info" => 1, "answer" => 1)); if (isset($controllers[$this->controllerName][$this->actionName])) { //课程学习人数 $courseModel = new CourseModel(); $courseModel->incrViewNum($this->course['id']); } }
function playAction() { //视频观看次数++ $videoId = (int) $this->get("video_id", 0); $videoModel = new VideoModel(); $videoModel->incrViewNum($videoId); $videoModel->insert($this->uid, $videoId); //用户人数 $section = $videoModel->getVideoBelongSection($videoId); if ($section) { $courseModel = new CourseModel(); $courseModel->incrViewNum($section['course_id']); } $this->displayJson(Common_Error::ERROR_SUCCESS); }