src/AppBundle/Controller/Admin/ContentController.php
(开头部分) 1KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
<?php
namespace AppBundle\Controller\Admin;
use Biz\Content\Type\ContentTypeFactory;
use Symfony\Component\HttpFoundation\Request;
use AppBundle\Common\Paginator;
use AppBundle\Common\ArrayToolkit;
class ContentController extends BaseController
{
public function indexAction(Request $request)
{
$conditions = array_filter($request->query->all());
$paginator = new Paginator(
$request,
$this->getContentService()->searchContentCount($conditions),
20
);
$contents = $this->getContentService()->searchContents(
$conditions,
array('createdTime' => 'DESC'),
$paginator->getOffsetCount(),
$paginator->getPerPageCount()
);
$userIds = ArrayToolkit::column($contents, 'userId');
$users = $this->getUserService()->findUsersByIds($userIds);
$categoryIds = ArrayToolkit::column($contents, 'categoryId');
$categories = $this->getCategoryService()->findCategoriesByIds($categoryIds);
return $this->render('admin/content/index.html.twig', array(
'contents' => $contents,
'users' => $users,
'categories' => $categories,
'paginator' => $paginator,
));
}
public function createAction(Request $request, $type)
{
$type = ContentTypeFactory::create($type);
if ($request->getMethod() == 'POST') {
$content = $request->request->all();
$content['type'] = $type->getAlias();
$file = $request->files->get('picture');
if (!empty($file)) {
$record = $this->getFileService()->uploadFile('default', $file);
$content['picture'] = $record['uri'];
}
$content = $this->filterEditorField($content);
$content = $this->getContentService()->createContent($this->convertContent($content));
return $this->render('admin/content/content-tr.html.twig', array(
24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明
AI 解读 AI
登录后可用,每次 10 算力,解读结果公开显示在下面。
还没有人解读过这个文件。