1C-Bitrix
25.700.0
Загрузка...
Поиск...
Не найдено
PushService.php
См. документацию.
1
<?php
2
3
namespace
Bitrix\Im\V2\Message\Inform
;
4
5
use
Bitrix\Im\V2\Chat\PrivateChat
;
6
use
Bitrix\Im\V2\Message
;
7
use
Bitrix\Im\V2\Message\PushFormat
;
8
9
class
PushService
10
{
11
public
function
isPullEnable
(): bool
12
{
13
static
$enable;
14
if
($enable ===
null
)
15
{
16
$enable =
\Bitrix\Main\Loader::includeModule
(
'pull'
);
17
}
18
return
$enable;
19
}
20
21
public
function
sendInformPushPrivateChat
(
Message
$message
): void
22
{
23
if
(!$this->
isPullEnable
())
24
{
25
return
;
26
}
27
28
$fromUserId =
$message
->getAuthorId();
29
$toUserId =
$message
->getChat()->getCompanion()->getId();
30
31
$pushFormat =
new
PushFormat
(
$message
);
32
33
$pullMessage = [
34
'module_id'
=>
'im'
,
35
'command'
=>
'informMessage'
,
36
'params'
=> $pushFormat->format(),
37
'extra'
=>
\Bitrix\Im\Common::getPullExtra
(),
38
];
39
40
$pullMessageTo = $pullMessage;
41
$pullMessageTo[
'params'
][
'dialogId'
] = $fromUserId;
42
43
if
($fromUserId != $toUserId)
44
{
45
\Bitrix\Pull\Event::add
($toUserId, $pullMessageTo);
46
}
47
}
48
}
Bitrix\Im\Common\getPullExtra
static getPullExtra()
Определения
common.php:127
Bitrix\Im\V2\Chat\PrivateChat
Определения
PrivateChat.php:33
Bitrix\Im\V2\Message\Inform\PushService
Определения
PushService.php:10
Bitrix\Im\V2\Message\Inform\PushService\sendInformPushPrivateChat
sendInformPushPrivateChat(Message $message)
Определения
PushService.php:21
Bitrix\Im\V2\Message\Inform\PushService\isPullEnable
isPullEnable()
Определения
PushService.php:11
Bitrix\Im\V2\Message\PushFormat
Определения
PushFormat.php:19
Bitrix\Main\Loader\includeModule
static includeModule($moduleName)
Определения
loader.php:67
Bitrix\Pull\Event\add
static add($recipient, array $parameters, $channelType=\CPullChannel::TYPE_PRIVATE)
Определения
event.php:22
Bitrix\Im\Message
Определения
Uuid.php:3
Bitrix\Im\V2\Message\Inform
Определения
PushService.php:3
Bitrix\Im\V2\Message
Определения
AdditionalMessagePopupItem.php:3
$message
$message
Определения
payment.php:8
bitrix
modules
im
lib
V2
Message
Inform
PushService.php
Создано системой
1.14.0