src/AppBundle/Controller/Admin/FileController.php
(开头部分) 1KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
<?php
namespace AppBundle\Controller\Admin;
use Symfony\Component\HttpFoundation\Request;
class FileController extends BaseController
{
public function indexAction(Request $request)
{
$form = $this->buildFileSearchForm();
$form->handleRequest($request);
$conditions = $form->getData();
$group = empty($conditions['group']) ? null : $conditions['group'];
$files = $this->getFileService()->getFiles($group, 0, 30);
return $this->render('admin/file/index.html.twig', array(
'files' => $files,
'form' => $form->createView(),
));
}
public function deleteAction(Request $request, $id)
{
$this->getFileService()->deleteFile($id);
return $this->createNewJsonResponse(true);
}
protected function buildFileSearchForm()
{
$groups = $this->getFileService()->getAllFileGroups();
$groupChoices = array();
foreach ($groups as $group) {
$groupChoices[$group['code']] = $group['name'];
}
return $this->createFormBuilder()
->add('group', 'choice', array(
'choices' => $groupChoices,
'empty_value' => '--文件组--',
'required' => false,
))
->getForm();
}
protected function getFileService()
{
return $this->createService('Content:FileService');
}
}
24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明
AI 解读 AI
登录后可用,每次 10 算力,解读结果公开显示在下面。
还没有人解读过这个文件。