src/Topxia/MobileBundleV2/Processor/Impl/UserProcessorImpl.php
(开头部分) 2KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
<?php
namespace Topxia\MobileBundleV2\Processor\Impl;
use AppBundle\Common\FileToolkit;
use AppBundle\Common\ArrayToolkit;
use AppBundle\Common\MathToolkit;
use AppBundle\Common\SmsToolkit;
use AppBundle\Common\SimpleValidator;
use AppBundle\Common\ExtensionManager;
use AppBundle\Common\EncryptionToolkit;
use Codeages\Biz\Framework\Event\Event;
use Topxia\Service\Common\ServiceKernel;
use Symfony\Component\HttpFoundation\File\File;
use Topxia\MobileBundleV2\Processor\BaseProcessor;
use Topxia\MobileBundleV2\Processor\UserProcessor;
use Topxia\MobileBundleV2\Controller\MobileBaseController;
class UserProcessorImpl extends BaseProcessor implements UserProcessor
{
public function getVersion()
{
return $this->formData;
}
public function uploadAvatar()
{
$groupCode = 'tmp';
$user = $this->controller->getUserByToken($this->request);
if (empty($user)) {
return $this->createErrorResponse('not_login', '您尚未登录!');
}
$file = $this->request->files->get('file');
if (empty($file)) {
return $this->createErrorResponse('error', '没有选择上传文件!');
}
if (!FileToolkit::isImageFile($file)) {
return $this->createErrorResponse('error', '您上传的不是图片文件,请重新上传。');
}
$record = $this->getFileService()->uploadFile($groupCode, $file);
if (empty($record)) {
return $this->createErrorResponse('error', '上传失败 ~请重新尝试!');
}
$urlPath = $this->controller->get('web.twig.extension')->getFilePath($record['uri']);
if ($this->isAbsoluteUrl($urlPath)) {
$url = $this->request->getScheme().':'.ltrim($urlPath, ':');
} else {
$url = $this->getBaseUrl().$urlPath;
}
$record['url'] = $url;
$record['createdTime'] = date('c', $record['createdTime']);
unset($record['uri']);
return $record;
}
public function updateUserProfile()
24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明
AI 解读 AI
登录后可用,每次 10 算力,解读结果公开显示在下面。
还没有人解读过这个文件。