src/Biz/User/Service/Impl/MessageServiceImpl.php
(开头部分) 2KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
<?php
namespace Biz\User\Service\Impl;
use Biz\BaseService;
use AppBundle\Common\ArrayToolkit;
use Biz\Common\CommonException;
use Biz\User\MessageException;
use Biz\User\Service\MessageService;
class MessageServiceImpl extends BaseService implements MessageService
{
public function countMessages($conditions)
{
$conditions = $this->filterMessageConditions($conditions);
return $this->getMessageDao()->count($conditions);
}
public function searchMessages($conditions, $order, $start, $limit)
{
$conditions = $this->filterMessageConditions($conditions);
return $this->getMessageDao()->search($conditions, $order, $start, $limit);
}
public function sendMessage($fromId, $toId, $content, $type = 'text', $createdTime = null)
{
if (empty($fromId) || empty($toId)) {
$this->createNewException(MessageException::NOTFOUND_SENDER_OR_RECEIVER());
}
if ($fromId == $toId) {
$this->createNewException(MessageException::SEND_TO_SELF());
}
if (empty($content)) {
$this->createNewException(MessageException::EMPTY_MESSAGE());
}
$createdTime = empty($createdTime) ? time() : $createdTime;
$message = $this->addMessage($fromId, $toId, $content, $type, $createdTime);
$this->prepareConversationAndRelationForSender($message, $toId, $fromId, $createdTime);
$this->prepareConversationAndRelationForReceiver($message, $fromId, $toId, $createdTime);
$conversation = $this->getConversationDao()->getByFromIdAndToId($fromId, $toId);
if (1 == $conversation['unreadNum']) {
$this->getUserService()->waveUserCounter($toId, 'newMessageNum', 1);
}
return $message;
}
public function getConversation($conversationId)
{
return $this->getConversationDao()->get($conversationId);
}
public function deleteConversationMessage($conversationId, $messageId)
{
$relation = $this->getRelationDao()->getByConversationIdAndMessageId($conversationId, $messageId);
24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明
AI 解读 AI
登录后可用,每次 10 算力,解读结果公开显示在下面。
还没有人解读过这个文件。