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/sale/lib/exchange/integration/ |
Upload File : |
<?php namespace Bitrix\Sale\Exchange\Integration; use Bitrix\Sale\Exchange\Integration\Entity\B24IntegrationRelationTable; use Bitrix\Sale\Exchange\Integration\Entity\B24integrationTokenTable; class Token { static public function getToken(array $fields, $guid = null) { if($guid) { $fields["guid"] = $guid; } return static::createToken($fields); } static private function createToken(array $fields) { $token = null; if (isset($fields["guid"])) { $token = Entity\B24integrationTokenTable::getList(["select" => ["*"], "filter" => ["=GUID" => $fields["guid"]]])->fetchObject(); } $token = $token ?: new Entity\Token(); $result = $token->update($fields); return $result->isSuccess() ? $token : null; } /** * @param $guid * @internal */ static public function getExistsByGuid($guid) { $token = Entity\B24integrationTokenTable::getList(["select" => ["*"], "filter" => ["=GUID" => $guid]])->fetchObject(); return ($token); } static public function delete($guid) { $row = B24integrationTokenTable::getRow(["filter" => ["=GUID" => $guid]]); $primary = $row ? $row['ID']:0; if($primary>0) { B24integrationTokenTable::delete($primary); } } }