src/ApiBundle/Api/ResourceKernel.php

(开头部分) 1KB

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

<?php

namespace ApiBundle\Api;

use ApiBundle\Api\Resource\ResourceManager;
use ApiBundle\Api\Util\ExceptionUtil;
use ApiBundle\ApiBundle;
use Codeages\Biz\Framework\Context\Biz;
use Doctrine\Common\Annotations\CachedReader;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\HttpFoundation\Request;
use Biz\Common\CommonException;

class ResourceKernel
{
    /**
     * @var ContainerInterface
     */
    private $container;

    /**
     * @var CachedReader
     */
    private $annotationReader;

    /**
     * @var Biz
     */
    private $biz;

    /**
     * @var PathParser
     */
    private $pathParser;

    /**
     * @var ResourceManager
     */
    private $resManager;

    public function __construct(ContainerInterface $container)
    {
        $this->container = $container;
        $this->annotationReader = $container->get('annotation_reader');
        $this->biz = $container->get('biz');
        $this->pathParser = $container->get('api.path.parser');
        $this->resManager = $container->get('api.resource.manager');
    }

    public function handle(Request $request)
    {
        $this->parseRequestBody($request);

        $this->container->get('api_firewall')->handle($request);

        $this->biz['user'] = $this->container->get('security.token_storage')->getToken()->getUser();

        if ($this->isBatchRequest($request)) {
            return $this->batchRequest($request);
        } else {

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

AI 解读 AI

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

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