src/AppBundle/Controller/GroupController.php

(开头部分) 2KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

<?php

namespace AppBundle\Controller;

use Biz\Common\CommonException;
use Biz\Content\Service\FileService;
use Biz\Group\Service\GroupService;
use Biz\Group\Service\ThreadService;
use Biz\System\Service\SettingService;
use Biz\User\Service\NotificationService;
use Biz\User\Service\UserService;
use AppBundle\Common\Paginator;
use AppBundle\Common\ArrayToolkit;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;

class GroupController extends BaseController
{
    public function indexAction()
    {
        $activeGroup = $this->getGroupService()->searchGroups(array('status' => 'open'), array('memberNum' => 'DESC'), 0, 12);
        $recentlyThread = $this->getThreadService()->searchThreads(
            array(
                'createdTime' => time() - 30 * 24 * 60 * 60,
                'status' => 'open',
            ),
            $this->filterSort('byStick'), 0, 25
        );

        $ownerIds = ArrayToolkit::column($recentlyThread, 'userId');
        $groupIds = ArrayToolkit::column($recentlyThread, 'groupId');
        $userIds = ArrayToolkit::column($recentlyThread, 'lastPostMemberId');

        $lastPostMembers = $this->getUserService()->findUsersByIds($userIds);

        $owners = $this->getUserService()->findUsersByIds($ownerIds);

        $groups = $this->getGroupService()->getGroupsByids($groupIds);

        list($user, $myJoinGroup, $newGroups) = $this->_getGroupList();

        return $this->render('group/index.html.twig', array(
            'activeGroup' => $activeGroup,
            'myJoinGroup' => $myJoinGroup,
            'lastPostMembers' => $lastPostMembers,
            'owners' => $owners,
            'newGroups' => $newGroups,
            'groupinfo' => $groups,
            'user' => $user,
            'recentlyThread' => $recentlyThread,
        ));
    }

    public function addGroupAction(Request $request)
    {
        if ($this->get('security.authorization_checker')->isGranted('ROLE_ADMIN') !== true) {
            return $this->createMessageResponse('info', '目前只允许管理员创建小组!');
        }

        $user = $this->getCurrentUser();

24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明

AI 解读 AI

登录后可用,每次 10 算力,解读结果公开显示在下面。

还没有人解读过这个文件。