1C-Bitrix
25.700.0
Загрузка...
Поиск...
Не найдено
PrivatePushService.php
См. документацию.
1
<?php
2
3
namespace
Bitrix\Im\V2\Message\Send\Push;
4
5
use Bitrix\Im\V2\Message\Send\PushService;
6
7
class
PrivatePushService
extends
PushService
8
{
9
public
function
sendPush
(
array
$counters
= []): void
10
{
11
if
(!$this->
isPullEnable
() || !$this->sendingConfig->addRecent())
12
{
13
return
;
14
}
15
16
$pullMessages = $this->
getPullMessages
(
$counters
);
17
18
foreach
($pullMessages as
$userId
=> $pullMessage)
19
{
20
\Bitrix\Pull\Event::add
(
$userId
, $pullMessage);
21
$this->mobilePush->sendForPrivateMessage(
$userId
, $pullMessage);
22
}
23
}
24
25
protected
function
getPullMessages
(
array
$counters
):
array
26
{
27
$chat = $this->message->getChat();
28
$fromUserId = $this->message->getAuthorId();
29
$toUserId = $chat->getCompanion($fromUserId)->getId();
30
$basePullMessage = $this->
getBasePullMessage
();
31
32
if
($fromUserId === $toUserId)
33
{
34
return
[$toUserId => $this->
getPullMessage
($basePullMessage, $toUserId, $toUserId,
$counters
)];
35
}
36
37
return
[
38
$toUserId => $this->
getPullMessage
($basePullMessage, $toUserId, $fromUserId,
$counters
),
39
$fromUserId => $this->
getPullMessage
($basePullMessage, $fromUserId, $toUserId,
$counters
),
40
];
41
}
42
43
protected
function
getBasePullMessage
():
array
44
{
45
return
[
46
'module_id'
=>
'im'
,
47
'command'
=>
'message'
,
48
'params'
=> $this->pushFormatter->format(),
49
'extra'
=>
\Bitrix\Im\Common::getPullExtra
(),
50
];
51
}
52
53
protected
function
getPullMessage
(
array
$basePullMessage,
int
$userId
,
int
$opponentId,
array
$counters
):
array
54
{
55
$basePullMessage[
'params'
][
'dialogId'
] = $opponentId;
56
$basePullMessage[
'params'
][
'counter'
] =
$counters
[
$userId
] ?? 0;
57
58
return
$basePullMessage;
59
}
60
}
$userId
if(!is_object($USER)||! $USER->IsAuthorized()) $userId
Определения
check_mail.php:18
Bitrix\Im\Common\getPullExtra
static getPullExtra()
Определения
common.php:127
Bitrix\Im\V2\Message\Param\PushService
Определения
PushService.php:11
Bitrix\Im\V2\Message\Param\PushService\isPullEnable
isPullEnable()
Определения
PushService.php:12
Bitrix\Im\V2\Message\Send\Push\PrivatePushService
Определения
PrivatePushService.php:8
Bitrix\Im\V2\Message\Send\Push\PrivatePushService\getBasePullMessage
getBasePullMessage()
Определения
PrivatePushService.php:43
Bitrix\Im\V2\Message\Send\Push\PrivatePushService\getPullMessages
getPullMessages(array $counters)
Определения
PrivatePushService.php:25
Bitrix\Im\V2\Message\Send\Push\PrivatePushService\getPullMessage
getPullMessage(array $basePullMessage, int $userId, int $opponentId, array $counters)
Определения
PrivatePushService.php:53
Bitrix\Im\V2\Message\Send\Push\PrivatePushService\sendPush
sendPush(array $counters=[])
Определения
PrivatePushService.php:9
Bitrix\Pull\Event\add
static add($recipient, array $parameters, $channelType=\CPullChannel::TYPE_PRIVATE)
Определения
event.php:22
array
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
Определения
file_new.php:804
$counters
$counters
Определения
options.php:100
bitrix
modules
im
lib
V2
Message
Send
Push
PrivatePushService.php
Создано системой
1.14.0