Server IP : 80.87.202.40 / Your IP : 216.73.216.169 Web Server : Apache System : Linux rospirotorg.ru 5.14.0-539.el9.x86_64 #1 SMP PREEMPT_DYNAMIC Thu Dec 5 22:26:13 UTC 2024 x86_64 User : bitrix ( 600) PHP Version : 8.2.27 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /home/bitrix/ext_www/ilovecveti.ru/bitrix/modules/bizproc/lib/integration/push/ |
Upload File : |
<?php namespace Bitrix\Bizproc\Integration\Push; abstract class BasePush { public const EVENT_ADDED = 'ADDED'; public const EVENT_UPDATED = 'UPDATED'; public const EVENT_DELETED = 'DELETED'; abstract protected static function getCommand(): string; public static function subscribeUser(int $userId): void { (new PushWorker())->subscribe($userId, static::getCommand()); } public static function pushAdded(mixed $itemId, ...$userIds): void { static::pushLastEvent(static::EVENT_ADDED, $itemId, $userIds); } public static function pushUpdated(mixed $itemId, ...$userIds): void { static::pushLastEvent(static::EVENT_UPDATED, $itemId, $userIds); } public static function pushDeleted(mixed $itemId, ...$userIds): void { static::pushLastEvent(static::EVENT_DELETED, $itemId, $userIds); } public static function pushLastEvent(string $eventName, mixed $itemId, array $userIds): void { $userIds = array_unique(\CBPHelper::flatten($userIds)); if (empty($userIds)) { return; } $command = static::getCommand(); $push = new PushWorker(); $push->sendLast( "{$command}-{$itemId}-{$eventName}", $command, [ 'eventName' => $eventName, 'items' => [ [ 'id' => $itemId, ], ], ], $userIds, ); } }