src/AppBundle/Controller/BuyFlowController.php

(开头部分) 1KB

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

<?php

namespace AppBundle\Controller;

use AppBundle\Common\UserToolkit;
use AppBundle\Util\AvatarAlert;
use Biz\System\Service\SettingService;
use Biz\User\Service\UserFieldService;
use Biz\User\UserException;
use Symfony\Component\HttpFoundation\Request;

abstract class BuyFlowController extends BaseController
{
    protected $targetType = '';

    public function buyAction(Request $request, $id)
    {
        $this->checkUserLogin();

        if ($this->needApproval($id)) {
            return $this->render('buy-flow/approve-modal.html.twig');
        }

        if ($this->needNoStudentNumTip($id)) {
            return $this->render('buy-flow/no-remain-modal.html.twig');
        }

        if ($this->needUploadAvatar()) {
            return $this->render('buy-flow/avatar-alert-modal.html.twig');
        }

        if ($this->needFillUserInfo()) {
            $userFields = $this->getUserFieldService()->getEnabledFieldsOrderBySeq();
            $user = $this->getUser();
            $userInfo = $this->getUserService()->getUserProfile($user['id']);
            $userInfo['approvalStatus'] = $user['approvalStatus'];

            return $this->render('buy-flow/fill-user-info-modal.html.twig', array(
                'userFields' => $userFields,
                'user' => $userInfo,
            ));
        }

        if ($this->needOpenPayment($id)) {
            return $this->render('buy-flow/payments-disabled-modal.html.twig');
        }

        $this->tryFreeJoin($id);

        if ($this->isJoined($id)) {
            return $this->createJsonResponse(array('url' => $this->getSuccessUrl($id)));
        }

        return $this->createJsonResponse(array('url' => $this->generateUrl('order_show', array('targetId' => $id, 'targetType' => $this->targetType))));
    }

    private function needUploadAvatar()
    {
        return AvatarAlert::alertJoinCourse($this->getUser());
    }

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

AI 解读 AI

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

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