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/wbs24.ozonapinew/lib/Products/Cache/ |
Upload File : |
<?php namespace Wbs24\Ozonapinew\Products\Cache; use Wbs24\Ozonapinew\{ Db, Interfaces }; /** * Класс, записывает в таблицу полученные данные из класса */ class Stack { const ALLOWED_PRODUCTS_TABLE = 'wbs24_ozonapinew_allowed_products'; public function __construct($objects = []) { $this->Db = $objects['Db'] ?? new Db(); } public function setProduct($param) { $setInfo = []; $setInfo['account_index'] = $param['accountIndex']; $setInfo['product_id'] = $param['productId']; $setInfo['parent_product_id'] = $param['parentProductId'] ?? ''; $setInfo['offer_id'] = $param['offerId']; $setInfo['iblock_id'] = $param['iblockId']; $setInfo['parent_iblock_id'] = $param['parentIblockId'] ?? ''; $setInfo['type'] = $param['type']; $setInfo['entity_type'] = $param['entityType']; $setInfo['package_ratio'] = $param['packageRatioValue']; $this->Db->set(self::ALLOWED_PRODUCTS_TABLE, $setInfo); } public function getParentProducts($param) { $accountIndex = $param['accountIndex']; $parentIblockId = $param['parentIblockId']; $entityType = $param['entityType']; return $this->Db->get(self::ALLOWED_PRODUCTS_TABLE, [ 'account_index' => $accountIndex, 'iblock_id' => $parentIblockId, 'type' => 3, 'entity_type' => $entityType, ]); } public function searchProduct($param) { $response = $this->Db->get(self::ALLOWED_PRODUCTS_TABLE, [ 'account_index' => $param['accountIndex'], 'iblock_id' => $param['iblockId'], 'offer_id' => $param['offerId'], 'entity_type' => $param['entityType'], ]); $productInfo = $response[0]; return $productInfo ?: []; } public function getAllIblocks($param) { $iblockIds = []; $iblocks = $this->Db->getUniqueColumnValue( self::ALLOWED_PRODUCTS_TABLE, 'iblock_id', [ 'account_index' => $param['accountIndex'], 'entity_type' => $param['entityType'], ] ); foreach ($iblocks as $iblock) { $iblockIds[] = $iblock['iblock_id']; } return $iblockIds; } public function clearProducts($accountIndex, $entityType) { $this->Db->clear(self::ALLOWED_PRODUCTS_TABLE, [ 'account_index' => $accountIndex, 'entity_type' => $entityType, ]); } }