src/AppBundle/Controller/BaseController.php
(开头部分) 1KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
<?php
namespace AppBundle\Controller;
use Biz\Common\CommonException;
use Biz\User\CurrentUser;
use AppBundle\Common\ArrayToolkit;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\Security\Http\SecurityEvents;
use AppBundle\Common\Exception\ResourceNotFoundException;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Component\Security\Http\Event\InteractiveLoginEvent;
use Symfony\Component\Security\Core\Authentication\Token\UsernamePasswordToken;
use Codeages\Biz\Framework\Service\Exception\AccessDeniedException;
use AppBundle\Common\Exception\AbstractException;
use AppBundle\Common\JWTAuth;
class BaseController extends Controller
{
/**
* @return CurrentUser
*/
protected function getCurrentUser()
{
return $this->getUser();
}
protected function getBiz()
{
return $this->get('biz');
}
/**
* @return CurrentUser
*/
public function getUser()
{
$biz = $this->getBiz();
return $biz['user'];
}
/**
* switch current user.
*
* @param Request $request
* @param CurrentUser $user
*
* @return CurrentUser
*/
protected function switchUser(Request $request, CurrentUser $user)
{
$user['currentIp'] = $request->getClientIp();
$token = new UsernamePasswordToken($user, null, 'main', $user['roles']);
$this->container->get('security.token_storage')->setToken($token);
$biz = $this->getBiz();
24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明
AI 解读 AI
登录后可用,每次 10 算力,解读结果公开显示在下面。
还没有人解读过这个文件。