src/AppBundle/Controller/Course/CourseOrderController.php

(开头部分) 2KB

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

<?php

namespace AppBundle\Controller\Course;

use AppBundle\Util\AvatarAlert;
use Biz\Course\Service\CourseSetService;
use Biz\User\UserException;
use Symfony\Component\HttpFoundation\Request;
use AppBundle\Controller\BaseController;

class CourseOrderController extends BaseController
{
    public function buyAction(Request $request, $id)
    {
        $course = $this->getCourseService()->getCourse($id);
        $user = $this->getCurrentUser();

        if (!$user->isLogin()) {
            $this->createNewException(UserException::UN_LOGIN());
        }

        $member = $this->getCourseMemberService()->getCourseMember($course['id'], $user['id']);
        if (!empty($member)) {
            return $this->render(
                'course/order/is-member.html.twig',
                array(
                    'course' => $course,
                )
            );
        }

        $vipJoinEnabled = false;
        if ($this->isPluginInstalled('Vip') && $this->setting('vip.enabled')) {
            $vipJoinEnabled = 'ok' === $this->getVipService()->checkUserInMemberLevel($user['id'], $course['vipLevelId']);
        }

        $paymentSetting = $this->setting('payment');
        if ($course['price'] > 0 && !$paymentSetting['enabled'] && !$vipJoinEnabled) {
            return $this->render(
                'buy-flow/payments-disabled-modal.html.twig',
                array(
                    'course' => $course,
                )
            );
        }

        $userInfo = $this->getUserService()->getUserProfile($user['id']);
        $userInfo['approvalStatus'] = $user['approvalStatus'];
        if ($course['approval'] == 1 && ($userInfo['approvalStatus'] != 'approved')) {
            return $this->render(
                'course/order/approve-modal.html.twig',
                array(
                    'course' => $course,
                )
            );
        }

        $remainingStudentNum = $this->getRemainStudentNum($course);
        if ($remainingStudentNum <= 0 && $course['type'] == 'live') {
            return $this->render(

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

AI 解读 AI

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

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