src/AppBundle/Controller/Admin/ArticleController.php
(开头部分) 1KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
<?php
namespace AppBundle\Controller\Admin;
use Biz\Article\Service\ArticleService;
use Biz\File\Service\UploadFileService;
use Biz\System\Service\SettingService;
use AppBundle\Common\Paginator;
use AppBundle\Common\ArrayToolkit;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\JsonResponse;
use Biz\Article\ArticleException;
class ArticleController extends BaseController
{
public function indexAction(Request $request)
{
$conditions = $request->query->all();
$categoryId = 0;
if (!empty($conditions['categoryId'])) {
$conditions['includeChildren'] = true;
$categoryId = $conditions['categoryId'];
}
$conditions = $this->fillOrgCode($conditions);
$paginator = new Paginator(
$request,
$this->getArticleService()->countArticles($conditions),
20
);
$articles = $this->getArticleService()->searchArticles(
$conditions,
'normal',
$paginator->getOffsetCount(),
$paginator->getPerPageCount()
);
$categoryIds = ArrayToolkit::column($articles, 'categoryId');
$categories = $this->getCategoryService()->findCategoriesByIds($categoryIds);
$categoryTree = $this->getCategoryService()->getCategoryTree();
return $this->render('admin/article/index.html.twig', array(
'articles' => $articles,
'categories' => $categories,
'paginator' => $paginator,
'categoryTree' => $categoryTree,
'categoryId' => $categoryId,
));
}
public function createAction(Request $request)
{
if ($request->getMethod() == 'POST') {
$formData = $request->request->all();
$article['tags'] = array_filter(explode(',', $formData['tags']));
24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明
AI 解读 AI
登录后可用,每次 10 算力,解读结果公开显示在下面。
还没有人解读过这个文件。