src/ApiBundle/Api/Resource/Uploader/UploaderInit.php

(开头部分) 1KB

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

<?php

namespace ApiBundle\Api\Resource\Uploader;

use ApiBundle\Api\ApiRequest;
use ApiBundle\Api\Resource\AbstractResource;
use Biz\Common\CommonException;
use Biz\System\SettingException;

class UploaderInit extends AbstractResource
{
    public function get(ApiRequest $request, $targetType, $targetId)
    {
        $cloudAttachment = $this->getSettingService()->get('cloud_attachment', array());
        if (!($cloudAttachment['course'])) {
            throw SettingException::FORBIDDEN_CLOUD_ATTACHMENT();
        }

        $user = $this->getCurrentUser();
        $params = array(
            'targetType' => $targetType,
            'targetId' => $targetId,
            'userId' => $user['id'],
            'bucket' => 'private',
        );
        $params = array_merge($request->query->all(), $params);

        if (!$params) {
            throw CommonException::ERROR_PARAMETER_MISSING();
        }

        $result = $this->getUploadFileService()->initFormUpload($params);

        return $result;
    }

    /**
     * @return \Biz\System\Service\Impl\SettingServiceImpl
     */
    protected function getSettingService()
    {
        return $this->service('System:SettingService');
    }

    protected function getUploadFileService()
    {
        return $this->service('File:UploadFileService');
    }

    /**
     * @return \Biz\Course\Service\Impl\CourseServiceImpl
     */
    protected function getCourseService()
    {
        return $this->service('Course:CourseService');
    }

    /**
     * @return \Biz\Course\Service\Impl\ThreadServiceImpl
     */

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

AI 解读 AI

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

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