src/ApiBundle/Api/Resource/Page/PageSetting.php
(开头部分) 1KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
<?php
namespace ApiBundle\Api\Resource\Page;
use ApiBundle\Api\ApiRequest;
use ApiBundle\Api\Annotation\ApiConf;
use ApiBundle\Api\Resource\AbstractResource;
use Biz\User\UserException;
use ApiBundle\Api\Annotation\Access;
use ApiBundle\Api\Resource\Filter;
class PageSetting extends AbstractResource
{
/**
* @ApiConf(isRequiredAuth=false)
*/
public function get(ApiRequest $request, $portal, $type)
{
$mode = $request->query->get('mode', 'published');
if (!in_array($mode, array('draft', 'published'))) {
throw PageException::ERROR_MODE();
}
$type = 'course' == $type ? 'courseCondition' : $type;
if (!in_array($type, array('courseCondition', 'discovery'))) {
throw PageException::ERROR_TYPE();
}
if (!in_array($portal, array('h5', 'miniprogram'))) {
throw PageException::ERROR_PORTAL();
}
$method = 'get'.ucfirst($type);
return $this->$method($portal, $mode);
}
/**
* @Access(roles="ROLE_ADMIN,ROLE_SUPER_ADMIN")
*/
public function add(ApiRequest $request, $portal)
{
$mode = $request->query->get('mode');
if (!in_array($mode, array('draft', 'published'))) {
throw PageException::ERROR_MODE();
}
$type = $request->query->get('type');
if (!in_array($type, array('discovery'))) {
throw PageException::ERROR_TYPE();
}
if (!in_array($portal, array('h5', 'miniprogram'))) {
throw PageException::ERROR_PORTAL();
}
$content = $request->request->all();
$method = 'add'.ucfirst($type);
return $this->$method($portal, $mode, $content);
}
/**
24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明
AI 解读 AI
登录后可用,每次 10 算力,解读结果公开显示在下面。
还没有人解读过这个文件。