src/AppBundle/Controller/Course/CourseBaseController.php
(开头部分) 1KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
<?php
namespace AppBundle\Controller\Course;
use Biz\Course\CourseException;
use Biz\Course\CourseSetException;
use Biz\Course\Service\CourseService;
use Biz\Course\Service\MemberService;
use Biz\Course\Service\CourseSetService;
use Biz\Taxonomy\Service\TagService;
use Symfony\Component\HttpFoundation\Request;
use AppBundle\Controller\BaseController;
use AppBundle\Common\ArrayToolkit;
abstract class CourseBaseController extends BaseController
{
protected function tryGetCourseSetAndCourse($id)
{
$course = $this->getCourseService()->getCourse($id);
if (empty($course)) {
$this->createNewException(CourseException::NOTFOUND_COURSE());
}
$courseSet = $this->getCourseSetService()->getCourseSet($course['courseSetId']);
if (empty($courseSet)) {
$this->createNewException(CourseSetException::NOTFOUND_COURSESET());
}
return array($courseSet, $course);
}
protected function buildCourseLayoutData(Request $request, $courseId)
{
$course = $this->getCourseService()->getCourse($courseId);
if (empty($course)) {
$this->createNewException(CourseException::NOTFOUND_COURSE());
}
$member = $this->getCourseMember($request, $course);
return array($course, $member);
}
protected function tryBuildCourseLayoutData($request, $courseId)
{
list($course, $member) = $this->buildCourseLayoutData($request, $courseId);
$response = null;
$courseSet = $this->getCourseSetService()->getCourseSet($course['courseSetId']);
$user = $this->getCurrentUser();
if (!$user->isLogin()) {
$response = $this->createMessageResponse('info', '你好像忘了登录哦?', null, 3000, $this->generateUrl('login'));
}
if (!$this->getCourseService()->canTakeCourse($course)) {
$response = $this->createMessageResponse(
'info',
24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明
AI 解读 AI
登录后可用,每次 10 算力,解读结果公开显示在下面。
还没有人解读过这个文件。