src/AppBundle/Controller/Classroom/ClassroomBuyController.php

(开头部分) 1KB

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

<?php

namespace AppBundle\Controller\Classroom;

use AppBundle\Controller\BuyFlowController;
use Biz\Classroom\Service\ClassroomService;

class ClassroomBuyController extends BuyFlowController
{
    protected $targetType = 'classroom';

    protected function needOpenPayment($id)
    {
        $payment = $this->getSettingService()->get('payment');
        $classroom = $this->getClassroomService()->getClassroom($id);
        $vipJoinEnabled = false;
        if ($this->isPluginInstalled('Vip') && $this->setting('vip.enabled')) {
            $user = $this->getCurrentUser();
            $vipJoinEnabled = 'ok' === $this->getVipService()->checkUserInMemberLevel($user['id'], $classroom['vipLevelId']);
        }

        return $classroom['price'] > 0 && !$payment['enabled'] && !$vipJoinEnabled;
    }

    protected function tryFreeJoin($id)
    {
        $this->getClassroomService()->tryFreeJoin($id);
    }

    protected function getSuccessUrl($id)
    {
        return $this->generateUrl('classroom_courses', array('classroomId' => $id));
    }

    protected function isJoined($id)
    {
        $user = $this->getUser();

        return $this->getClassroomService()->isClassroomStudent($id, $user['id']);
    }

    /**
     * @return ClassroomService
     */
    private function getClassroomService()
    {
        return $this->createService('Classroom:ClassroomService');
    }

    /**
     * @return VipService
     */
    protected function getVipService()
    {
        return $this->createService('VipPlugin:Vip:VipService');
    }
}

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

AI 解读 AI

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

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