Bitrix-D7 23.9
 
Загрузка...
Поиск...
Не найдено
pushsender.php
1<?php
2
4
8
10{
11 public const COMMAND_USER = 'user_counter';
12
21 public function sendUserCounters(array $userIds, array $countersData = []): void
22 {
23 if (
25 || !Loader::includeModule('pull')
26 )
27 {
28 return;
29 }
30
31 foreach ($userIds as $userId)
32 {
33 $pushData = $countersData;
34 $pushData['userId'] = $userId;
35
36 $this->createPush([$userId], self::COMMAND_USER, $pushData);
37 }
38 }
39
45 public function createPush(array $userIds, string $command, array $params): void
46 {
47 if (!ModuleManager::isModuleInstalled('pull') || !Loader::includeModule('pull'))
48 {
49 return;
50 }
51
52 PushService::addEvent($userIds, [
53 'module_id' => PushService::MODULE_NAME,
54 'command' => $command,
55 'params' => $params
56 ]);
57 }
58}
static isModuleInstalled($moduleName)
sendUserCounters(array $userIds, array $countersData=[])
createPush(array $userIds, string $command, array $params)