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/cvetdv.ru/bitrix/modules/catalog/lib/controller/ |
Upload File : |
<?php namespace Bitrix\Catalog\Controller; use Bitrix\Main\Error; use Bitrix\Main\Loader; use Bitrix\Main\Localization\Loc; use Bitrix\Pull\Event; use Bitrix\Catalog\Access\AccessController; use Bitrix\Catalog\Access\ActionDictionary; final class BarcodeScanner extends \Bitrix\Main\Engine\Controller { /** * @param string $id * @return array|null */ public function sendMobilePushAction(string $id): ?array { if (!Loader::includeModule('catalog') || !AccessController::getCurrent()->check(ActionDictionary::ACTION_CATALOG_READ)) { $this->addError(new Error(Loc::getMessage('BARCODE_SCANNER_ACCESS_DENIED'))); return null; } if (!Loader::includeModule('pull')) { $this->addError(new Error(Loc::getMessage('BARCODE_SCANNER_PULL_MODULE_REQUIRED'))); return null; } /** * System push waking app when it is not in active state */ (new \CPushManager())->sendMessage([ [ 'USER_ID' => $this->getCurrentUser()->getId(), 'APP_ID' => 'Bitrix24', 'EXPIRY' => 0, 'PARAMS'=> [ 'TYPE' => 'CATALOG_BARCODE_SCANNER', 'ID'=> $id, ], 'ADVANCED_PARAMS' => [ 'senderName' => Loc::getMessage('BARCODE_SCANNER_PUSH_TITLE'), 'senderMessage' => Loc::getMessage('BARCODE_SCANNER_PUSH_TEXT') ] ] ]); /** * Local push for app in active state */ Event::add( $this->getCurrentUser()->getId(), [ 'module_id' => 'catalog', 'command' => 'OpenBarcodeScanner', 'params' => [ 'id' => $id, ] ] ); return []; } }