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; use Bitrix\Main\SystemException; // в данный момент не используется class OrdersStatuses { use Exception; // trait protected $numberOfDaysToProcessOrders; public function __construct() { try { $numberOfArguments = func_num_args(); ($numberOfArguments > 0) ? $objects = func_get_arg(0) : $objects = []; $this->main = $objects['Main'] ?? new Main(); $this->moduleId = $this->main->getModuleId(); $this->wrappers = new Wrappers($objects); $this->numberOfDaysToProcessOrders = $this->wrappers->Option->get($this->moduleId, 'numberOfDaysToProcessOrders'); } catch (SystemException $exception) { $this->exceptionHandler($exception); } } public function addStatusesTime($statusesInfo) { $db = new Db(); $data = []; $data['order_id'] = trim($statusesInfo['order_id']); $data['time'] = trim($statusesInfo['time']); $db->set('wbs24_ozonapinew_statuses_time_stack', $data); } public function getStatusTime($orderId) { $db = new Db(); $statusesStack = $db->get('wbs24_ozonapinew_statuses_time_stack', ['order_id' => $orderId]); return $statusesStack[0]['time']; } public function cleanStatusesTable($orderIds) { $db = new Db(); foreach ($orderIds as $orderId) { $statusesStack = $db->get('wbs24_ozonapinew_statuses_time_stack', ['order_id' => $orderId]); $statusCreationDate = date("Y-m-d", strtotime(substr($statusesStack[0]['time'], 0, 10).' +'. $this->numberOfDaysToProcessOrders .' days')); $now = time(); if ($now > strtotime($statusCreationDate)) { $db->clear('wbs24_ozonapinew_statuses_time_stack', $where = ['order_id' => $orderId]); } } } }