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/yandex.market/lib/trading/facade/ |
Upload File : |
<?php namespace Yandex\Market\Trading\Facade; use Yandex\Market; use Bitrix\Main; class AnonymousUser { public static function getUsedIds() { $cache = Main\Application::getInstance()->getManagedCache(); $cacheTtl = 86400; $cacheTable = Market\Trading\Setup\Table::getTableName(); $cacheId = $cacheTable . ':anonymous_user_used'; if ($cache->read($cacheTtl, $cacheId, $cacheTable)) { $result = $cache->get($cacheId); } else { $result = static::fetchUsedIds(); $cache->set($cacheId, $result); } return $result; } protected static function fetchUsedIds() { $result = []; $collection = Market\Trading\Setup\Collection::loadByFilter([ 'filter' => [ '=ACTIVE' => Market\Trading\Setup\Table::BOOLEAN_Y ], ]); /** @var Market\Trading\Setup\Model $setup */ foreach ($collection as $setup) { $serviceCode = $setup->getServiceCode(); $siteId = $setup->getSiteId(); $user = $setup->getEnvironment()->getUserRegistry()->getAnonymousUser($serviceCode, $siteId); if ($user->isInstalled()) { $result[] = $user->getId(); } } return array_unique($result); } }