src/Biz/Thread/Service/Impl/ThreadServiceImpl.php

(开头部分) 1KB

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

<?php

namespace Biz\Thread\Service\Impl;

use Biz\BaseService;
use Biz\Common\CommonException;
use Biz\Util\TextHelper;
use Biz\Thread\Dao\ThreadDao;
use AppBundle\Common\ArrayToolkit;
use Biz\Thread\Dao\ThreadPostDao;
use Biz\Thread\Dao\ThreadVoteDao;
use Biz\User\Service\UserService;
use Biz\System\Service\LogService;
use Biz\Thread\Dao\ThreadMemberDao;
use Biz\Thread\Service\ThreadService;
use Codeages\Biz\Framework\Event\Event;
use Biz\User\Service\NotificationService;
use Biz\Sensitive\Service\SensitiveService;
use Biz\Thread\ThreadException;

class ThreadServiceImpl extends BaseService implements ThreadService
{
    /*
     * thread
     */

    public function getThread($threadId)
    {
        return $this->getThreadDao()->get($threadId);
    }

    public function createThread($thread)
    {
        if (empty($thread['title'])) {
            $this->createNewException(ThreadException::TITLE_REQUIRED());
        }

        if (empty($thread['content'])) {
            $this->createNewException(ThreadException::CONTENT_REQUIRED());
        }

        if (empty($thread['targetId'])) {
            $this->createNewException(ThreadException::TARGETID_REQUIRED());
        }

        if (empty($thread['type']) || !in_array($thread['type'], array('discussion', 'question', 'event'))) {
            $this->createNewException(ThreadException::TYPE_INVALID());
        }

        $this->tryAccess('thread.create', $thread);

        $event = $this->dispatchEvent('thread.before_create', $thread);

        if ($event->isPropagationStopped()) {
            $this->createNewException(ThreadException::FORBIDDEN_TIME_LIMIT());
        }

        $thread = ArrayToolkit::parts($thread, array('targetType', 'targetId', 'relationId', 'categoryId', 'title', 'content', 'ats', 'location', 'userId', 'type', 'maxUsers', 'actvityPicture', 'status', 'startTime', 'endTIme'));

        $thread['title'] = $this->sensitiveFilter($thread['title'], $thread['targetType'].'-thread-create');

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

AI 解读 AI

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

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