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/rospirotorg.ru/bitrix/modules/wbs24.ozonapinew/lib/ |
Upload File : |
<?php namespace Wbs24\Ozonapinew; class DeliveryServices { protected $Db; protected $accountIndex; public function __construct($accountIndex = 1, $objects = []) { $this->Db = $objects['Db'] ?? new Db(); $this->accountIndex = $accountIndex; } public function updateList($deliveryServicesList) { foreach ($deliveryServicesList as $key => $delivery) { $data = [ 'delivery_id' => $delivery['id'], 'name' => $delivery['name'], 'account_index' => $this->accountIndex, ]; $this->Db->set('wbs24_ozonapinew_delivery_services', $data); } } public function getList() { $deliveryServicesList = $this->Db->get('wbs24_ozonapinew_delivery_services', [ 'account_index' => $this->accountIndex, ]); $charset = 'windows-1251'; if (LANG_CHARSET == $charset && !empty($deliveryServicesList)) { $deliveryServicesList = $this->changeCharset($deliveryServicesList, $charset); } return $deliveryServicesList; } protected function changeCharset($deliveryServicesList, $charset) { foreach ($deliveryServicesList as $key => $delivery) { $delivery['name'] = iconv('UTF-8', $charset, $delivery['name']); $deliveryServicesList[$key] = $delivery; } return $deliveryServicesList; } }