Bitrix-D7
23.9
Загрузка...
Поиск...
Не найдено
ReplyService.php
1
<?php
2
3
namespace
Bitrix\Im\V2\Message\Reply
;
4
5
use
Bitrix\Im\V2\Chat
;
6
use Bitrix\Im\V2\Common\ContextCustomer;
7
use
Bitrix\Im\V2\Message
;
8
use
Bitrix\Im\V2\Result
;
9
10
class
ReplyService
11
{
12
use ContextCustomer;
13
19
public
function
createMessage
(
Message
$replyingMessage,
string
$comment):
Result
20
{
21
$result =
new
Result
();
22
if
(!$replyingMessage->
getChat
()->hasAccess($this->getContext()->getUserId()))
23
{
24
return
$result->addError(
new
Chat
\
ChatError
(
Chat
\
ChatError::ACCESS_DENIED
));
25
}
26
27
$messageId = \CIMMessenger::Add([
28
"MESSAGE_TYPE"
=> $replyingMessage->
getChat
()->getType(),
29
"MESSAGE"
=> $comment,
30
"PARAMS"
=> [
31
"REPLY_ID"
=> $replyingMessage->
getMessageId
(),
32
],
33
"TO_CHAT_ID"
=> $replyingMessage->
getChat
()->getChatId(),
34
"FROM_USER_ID"
=> $this->getContext()->getUserId(),
35
]);
36
37
if
(!$messageId)
38
{
39
return
$result->addError(
new
Message
\
MessageError
(
Message
\
MessageError::SENDING_FAILED
));
40
}
41
42
return
$result->setResult(
new
Message
($messageId));
43
}
44
45
}
Bitrix\Im\Chat
Definition
chat.php:19
Bitrix\Im\V2\Chat\ChatError
Definition
ChatError.php:9
Bitrix\Im\V2\Chat\ChatError\ACCESS_DENIED
const ACCESS_DENIED
Definition
ChatError.php:21
Bitrix\Im\V2\Message\MessageError
Definition
MessageError.php:9
Bitrix\Im\V2\Message\MessageError\SENDING_FAILED
const SENDING_FAILED
Definition
MessageError.php:27
Bitrix\Im\V2\Message\Reply\ReplyService
Definition
ReplyService.php:11
Bitrix\Im\V2\Message\Reply\ReplyService\createMessage
createMessage(Message $replyingMessage, string $comment)
Definition
ReplyService.php:19
Bitrix\Im\V2\Message
Definition
Message.php:44
Bitrix\Im\V2\Message\getMessageId
getMessageId()
Definition
Message.php:816
Bitrix\Im\V2\Message\getChat
getChat()
Definition
Message.php:872
Bitrix\Im\V2\Result
Definition
Result.php:9
Bitrix\Im\V2\Chat
Definition
ChannelChat.php:3
Bitrix\Im\V2\Message\Reply
Definition
ReplayedMessageCollection.php:3
Bitrix\Im\V2\Message
Definition
AdditionalMessagePopupItem.php:3
modules
im
lib
V2
Message
Reply
ReplyService.php
Создано системой
1.10.0