src/AppBundle/Controller/GroupThreadController.php

(开头部分) 2KB

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

<?php

namespace AppBundle\Controller;

use AppBundle\Common\Exception\FileToolkitException;
use Biz\Content\FileException;
use Biz\Content\Service\FileService;
use Biz\File\Service\UploadFileService;
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\FileToolkit;
use AppBundle\Common\ArrayToolkit;
use Biz\User\UserException;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;

class GroupThreadController extends BaseController
{
    public function addThreadAction(Request $request, $id)
    {
        $user = $this->getCurrentUser();

        $groupinfo = $this->getGroupService()->getGroup($id);

        if (!$groupinfo) {
            return $this->createMessageResponse('info', '该小组已被关闭');
        }

        if (!$this->getGroupMemberRole($id)) {
            return $this->createMessageResponse('info', '只有小组成员可以发言');
        }

        if ($request->getMethod() == 'POST') {
            try {
                $threadData = $request->request->all();

                $info = array(
                    'title' => $threadData['thread']['title'],
                    'content' => $threadData['thread']['content'],
                    'groupId' => $id,
                    'userId' => $user['id'],
                );

                $thread = $this->getThreadService()->addThread($info);

                $attachment = $request->request->get('attachment');
                $this->getUploadFileService()->createUseFiles($attachment['fileIds'], $thread['id'], $attachment['targetType'], $attachment['type']);

                if (isset($threadData['file'])) {
                    $file = $threadData['file'];
                    $this->getThreadService()->addAttach($file, $thread['id']);
                }

                return $this->redirect($this->generateUrl('group_thread_show', array(
                    'id' => $id,
                    'threadId' => $thread['id'],

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

AI 解读 AI

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

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