src/AppBundle/Controller/MaterialLib/GlobalFilePlayerController.php

(开头部分) 1KB

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

<?php

namespace AppBundle\Controller\MaterialLib;

use Biz\CloudFile\CloudFileException;
use Biz\CloudFile\Service\CloudFileService;
use Biz\CloudPlatform\CloudAPIFactory;
use AppBundle\Controller\BaseController;
use Biz\MaterialLib\Service\MaterialLibService;
use Biz\Player\PlayerException;
use Biz\User\TokenException;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;

class GlobalFilePlayerController extends BaseController
{
    public function playerAction(Request $request, $globalId)
    {
        $file = $this->getCloudFileService()->getByGlobalId($globalId);

        if (empty($file)) {
            $this->createNewException(CloudFileException::NOTFOUND_CLOUD_FILE());
        }
        if (in_array($file['type'], array('video', 'ppt', 'document'))) {
            return $this->globalPlayer($file, $request);
        } elseif ('audio' == $file['type']) {
            return $this->audioPlayer($file, $request);
        } elseif (in_array($file['type'], array('image', 'flash'))) {
            return $this->commonPlayer($file, $request);
        }

        $this->createNewException(PlayerException::NOT_SUPPORT_TYPE());
    }

    public function globalDocumentPlayerAction(Request $request, $globalId)
    {
        $token = $request->query->get('token');

        return $this->render(
            'material-lib/player/global-document-player.html.twig',
            array(
                'globalId' => $globalId,
                'token' => $token,
            )
        );
    }

    public function globalPlayer($file, $request)
    {
        $ssl = $request->isSecure() ? true : false;
        $player = $this->getMaterialLibService()->player($file['globalId'], $ssl);

        return $this->render('material-lib/player/global-player.html.twig', array(
            'file' => $file,
            'player' => $player,
        ));
    }

    public function commonPlayer($file, $request)
    {

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

AI 解读 AI

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

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