Linux unitednationsplay.com 3.10.0-1160.45.1.el7.x86_64 #1 SMP Wed Oct 13 17:20:51 UTC 2021 x86_64
nginx/1.20.1
Server IP : 188.130.139.92 & Your IP : 3.144.237.87
Domains :
Cant Read [ /etc/named.conf ]
User : web
Terminal
Auto Root
Create File
Create Folder
Localroot Suggester
Backdoor Destroyer
Readme
/
home /
www /
2 /
Console /
Commands /
Delete
Unzip
Name
Size
Permission
Date
Action
AddNew.php
17.39
KB
-rw-r--r--
2021-03-26 07:26
CommonSchedule.php
6.27
KB
-rw-r--r--
2021-03-26 07:26
DoImport.php
3.18
KB
-rw-r--r--
2021-03-26 07:26
Inspire.php
602
B
-rw-r--r--
2021-03-26 07:26
QuantityUpdate.php
3.28
KB
-rw-r--r--
2021-03-26 07:26
Save
Rename
<?php namespace App\Console\Commands; use Illuminate\Console\Command; use Illuminate\Mail\Message; use Illuminate\Support\Facades\Redirect; use Illuminate\Http\Request; use App\Models\apiREST; use App\Models\Metas; use App\Models\Sites; use App\Models\Prices; use App\Models\Parse; use App\Models\Goods; use App\Http\Controllers\Admin\Workout; use Session; use DB; class AddNew extends Command { /** * The name and signature of the console command. * * @var string */ protected $signature = 'nimda:addnew'; /** * The console command description. * * @var string */ protected $description = 'Кнопка обновить'; /** * Create a new command instance. * * @return void */ public function __construct() { parent::__construct(); } /** * Execute the console command. * * @return mixed */ public function handle() { $workout = new Workout(); $fp = fopen('/home/bitrix/www/nimda/public/log.txt', 'a'); fwrite($fp, date("d.m.Y H:i:s").": show begins\r\n"); fclose($fp); $workout->clearTables(); $sites = DB::table('sites')->where('active',1)->orderBy('id', 'asc')->get(); foreach ($sites as $site) { if ($site->autodealer==1) { if ($site->id==6) { try { $firebird = DB::connection('firebird_north'); } catch (\PDOException $e) { $firebird_gone = 1; } } else { try { $firebird = DB::connection('firebird_south'); } catch (\PDOException $e) { $firebird_gone = 1; } } if (!isset($firebird_gone)) { $arPRODUCER = $arGOODS_IN = $arGOODS_OUT = array(); $arRes = $firebird->select("SELECT * FROM PRODUCER "); foreach ($arRes as $res) { $arPRODUCER[$res->PRODUCER_ID] = $res; } $arResSouth = $firebird->select("SELECT * FROM ATTRIBUTE_DESCRIPTION "); foreach ($arResSouth as $val) { if ($val->FIELD_CAPTION == "UPLOAD_to_NIMDA" ) $firebird_upload = "FIELD_".$val->ATTRIBUTE_DESCRIPTION_ID; } $arResSouth = $firebird->select("SELECT * FROM SHOP_NOMENCLATURE_ATTRIBUTE "); foreach ($arResSouth as $val) { $arResSouthAttributes[$val->DIRECTORY_REGISTRY_ID] = $val->{$firebird_upload}; } $arRes = $firebird->select("SELECT SHOP_NOMENCLATURE_ID, DIRECTORY_REGISTRY_ID, SHOP_NOMENCLATURE_TREE_ID, SHORTNAME, FULLNAME, CODE, NUMBER_MANUFACTURE, NUMBER_ORIGINAL, PRODUCER_ID, DEFAULT_COST FROM SHOP_NOMENCLATURE "); foreach ($arRes as $res) { $do_upload = 1; if ($arResSouthAttributes[$res->DIRECTORY_REGISTRY_ID]!=1) $do_upload = ''; if ($do_upload) { $brand_id = ''; if (isset($res->PRODUCER_ID)) { if (isset($arPRODUCER[$res->PRODUCER_ID])) { $brands = DB::table('brands')->where('name', iconv("cp1251", "utf-8", $arPRODUCER[$res->PRODUCER_ID]->NAME))->orderBy('id', 'asc')->get(); if (count($brands) == 0) { $brand_id = DB::table('brands')->insertGetId(['active' => 1, 'name' => iconv("cp1251", "utf-8", $arPRODUCER[$res->PRODUCER_ID]->NAME), 'created_at' => date('Y-m-d H:i:s'), 'updated_at' => date('Y-m-d H:i:s')]); } else { $brand_id = $brands[0]->id; } } } /* $QUANTITY = 0; $arQuant = $firebird->select(" EXECUTE PROCEDURE GET_SHOP_NOMENCLATURE_REST '" . $res->SHOP_NOMENCLATURE_ID . "' "); if (!empty($arQuant)) { $QUANTITY = $arQuant[0]->GOODS_COUNT_ACCESSIBLE; } */ $ARTIKUL = ''; if ($res->NUMBER_MANUFACTURE) $ARTIKUL = iconv("cp1251", "utf-8", $res->NUMBER_MANUFACTURE); $NAME = ''; if ($res->FULLNAME) $NAME = iconv("cp1251", "utf-8", $res->FULLNAME); $CODE = ''; if ($res->CODE) $CODE = iconv("cp1251", "utf-8", $res->CODE); $do = ''; $goods = DB::table('goods')->where('artikul', $ARTIKUL)->where('brand_id', $brand_id)->where('site_id', $site->id)->orderBy('id', 'asc')->get(); $goods_artikul = DB::table('artikuls')->where('artikul', $ARTIKUL)->where('sites_id', $site->id)->orderBy('id', 'asc')->get(); //if (count($goods) == 0) $do = 1; //if (count($goods_artikul) == 0) $do = 1; else $do = ''; //if (count($goods) == 0 AND count($goods_artikul) == 0) $do = 1; /*AND (!isset($brand_id) OR !isset($ARTIKUL))*/ if (!empty($goods[0]) AND !empty($goods_artikul[0])) $do = ''; else $do = 1; if ($do) { //if (count($goods) == 0) { $auto_mark = ''; $auto_model = ''; $TITLE = ''; $DESCRIPTION = ''; $KEYWORDS = ''; $PRICE_1 = ''; if ($res->DEFAULT_COST) $PRICE_1 = iconv("cp1251", "utf-8", $res->DEFAULT_COST); $CURRENCY_1 = 'RUB'; $PRICE_2 = ''; $CURRENCY_2 = ''; $PRICE_3 = ''; $CURRENCY_3 = ''; $WEIGHT = ''; $WIDTH = ''; $LENGTH = ''; $HEIGHT = ''; $PREVIEW_TEXT = ''; $PIC = ''; $id = DB::table('goods')->insertGetId( ['name' => $NAME, 'unique_id' => '', 'artikul' => '', 'site_id'=>$site->id, 'brand_id' => $brand_id, 'auto_mark' => $auto_mark, 'auto_model' => $auto_model, 'orig_id'=>$res->SHOP_NOMENCLATURE_ID, 'active' => 1, 'created_at' => date('Y-m-d H:i:s'), 'updated_at' => date('Y-m-d H:i:s')] ); if ($id) { DB::table('prices')->insert( ['sites_id' => $site->id, 'goods_id' => $id, 'price' => $PRICE_1, 'price_currency' => $CURRENCY_1, 'discount' => $PRICE_2, 'discount_currency' => $CURRENCY_2, 'install' => $PRICE_3, 'install_currency' => $CURRENCY_3, 'quantity' => $QUANTITY, 'weight' => $WEIGHT, 'width' => $WIDTH, 'length' => $LENGTH, 'height' => $HEIGHT, 'created_at' => date('Y-m-d H:i:s'), 'updated_at' => date('Y-m-d H:i:s')] ); DB::table('artikuls')->insert( ['sites_id' => $site->id, 'goods_id' => $id, 'artikul' => $ARTIKUL, 'name'=>$NAME, 'active'=>'', 'created_at' => date('Y-m-d H:i:s'), 'updated_at' => date('Y-m-d H:i:s')] ); //$this->setuniqueitem($id); } } } } } //91005 } else { if ($site->id == 3) $JSON = file_get_contents('http://' . $site->address . '/rest/getList.php'); else $JSON = file_get_contents('https://' . $site->address . '/rest/getList.php'); $arResult = json_decode($JSON); if (!empty($arResult)) { foreach ($arResult as $item) { $brand_id_true = ''; if (isset($item->brand_id)) { $brands = DB::table('brands')->where('name', $item->brand_id)->where('active', 1)->orderBy('id', 'asc')->get(); if (!empty($brands[0])) $brand_id_true = $brands[0]->id; } $goods = DB::table('goods')->where('artikul', $item->ARTIKUL)->where('brand_id', $brand_id_true)->where('site_id', $site->id)->orderBy('id', 'asc')->get(); $goods_artikul = DB::table('artikuls')->where('artikul', $item->ARTIKUL)->where('sites_id', $site->id)->orderBy('id', 'asc')->get(); //->where('approve', '!=', 1) $do = ''; $found_brand = ''; $do_artikul = ''; /* echo "<br>".$item->ARTIKUL." mm ".$item->brand_id." cc ".$site->id; if (!empty($goods[0])) echo "<br>goods ".$goods[0]->id." f ".$goods[0]->name." p ".$goods[0]->artikul." oo ".$goods[0]->brand_id." ll "; if (!empty($goods_artikul[0])) echo "<br>artikuls ".$goods_artikul[0]->artikul." sss ".$goods_artikul[0]->sites_id; */ if (!empty($goods[0]) AND !empty($goods_artikul[0])) $do = ''; else $do = 1; /* if (count($goods_artikul)>0) $do_artikul = 1; if (count($goods) == 0) $do = 1; if (!empty($goods) AND count($goods)>0) { if ($goods[0]->approve!=1) $do = 1; else $found_brand = 1; } if ($do_artikul AND $found_brand) $do = ''; */ if ($do) { $ARTIKUL = ''; if (isset($item->ARTIKUL)) $ARTIKUL = $item->ARTIKUL; $NAME = ''; if (isset($item->NAME)) $NAME = $item->NAME; $ACTIVE = ''; if (isset($item->ACTIVE)) $ACTIVE = $item->ACTIVE; $CODE = ''; if (isset($item->CODE)) $CODE = $item->CODE; $brand_id = ''; if (isset($item->brand_id)) $brand_id = $item->brand_id; $auto_mark = ''; if (isset($item->auto_mark)) $auto_mark = $item->auto_mark; $auto_model = ''; if (isset($item->auto_model)) $auto_model = $item->auto_model; $TITLE = ''; if (isset($item->TITLE)) $TITLE = $item->TITLE; $DESCRIPTION = ''; if (isset($item->DESCRIPTION)) $DESCRIPTION = $item->DESCRIPTION; $KEYWORDS = ''; if (isset($item->KEYWORDS)) $KEYWORDS = $item->KEYWORDS; $PRICE_1 = ''; if (isset($item->PRICE_1)) $PRICE_1 = $item->PRICE_1; $CURRENCY_1 = ''; if (isset($item->CURRENCY_1)) $CURRENCY_1 = $item->CURRENCY_1; $PRICE_2 = ''; if (isset($item->PRICE_2)) $PRICE_2 = $item->PRICE_2; $CURRENCY_2 = ''; if (isset($item->CURRENCY_2)) $CURRENCY_2 = $item->CURRENCY_2; $PRICE_3 = ''; if (isset($item->PRICE_3)) $PRICE_3 = $item->PRICE_3; $CURRENCY_3 = ''; if (isset($item->CURRENCY_3)) $CURRENCY_3 = $item->CURRENCY_3; $QUANTITY = ''; if (isset($item->QUANTITY)) $QUANTITY = $item->QUANTITY; $WEIGHT = ''; if (isset($item->WEIGHT)) $WEIGHT = $item->WEIGHT; $WIDTH = ''; if (isset($item->WIDTH)) $WIDTH = $item->WIDTH; $LENGTH = ''; if (isset($item->LENGTH)) $LENGTH = $item->LENGTH; $HEIGHT = ''; if (isset($item->HEIGHT)) $HEIGHT = $item->HEIGHT; $PREVIEW_TEXT = ''; if (isset($item->PREVIEW_TEXT)) $PREVIEW_TEXT = $item->PREVIEW_TEXT; $PIC = ''; if (isset($item->PIC)) $PIC = $item->PIC; $orig_id = ''; if (isset($item->ID)) $orig_id = $item->ID; $brand_id = ''; if (isset($item->brand_id)) { $brands = DB::table('brands')->where('name', $item->brand_id)->orderBy('id', 'asc')->get(); if (count($brands) == 0) { $brand_id = DB::table('brands')->insertGetId(['active' => 1, 'name' => $item->brand_id, 'created_at' => date('Y-m-d H:i:s'), 'updated_at' => date('Y-m-d H:i:s')]); } else { $brand_id = $brands[0]->id; } } $id = DB::table('goods')->insertGetId( ['name' => $NAME, 'unique_id' => '', 'artikul' => '', 'brand_id' => $brand_id, 'auto_mark' => $auto_mark, 'auto_model' => $auto_model, 'orig_id'=>$orig_id, 'site_id'=>$site->id, 'active' => 1, 'created_at' => date('Y-m-d H:i:s'), 'updated_at' => date('Y-m-d H:i:s')] ); if ($id) { DB::table('metas')->insert( ['sites_id' => $site->id, 'goods_id' => $id, 'title' => $TITLE, 'description' => $DESCRIPTION, 'keywords' => $KEYWORDS, 'created_at' => date('Y-m-d H:i:s'), 'updated_at' => date('Y-m-d H:i:s')] ); DB::table('prices')->insert( ['sites_id' => $site->id, 'goods_id' => $id, 'price' => $PRICE_1, 'price_currency' => $CURRENCY_1, 'discount' => $PRICE_2, 'discount_currency' => $CURRENCY_2, 'install' => $PRICE_3, 'install_currency' => $CURRENCY_3, 'quantity' => $QUANTITY, 'weight' => $WEIGHT, 'width' => $WIDTH, 'length' => $LENGTH, 'height' => $HEIGHT, 'created_at' => date('Y-m-d H:i:s'), 'updated_at' => date('Y-m-d H:i:s')] ); DB::table('texts')->insert( ['sites_id' => $site->id, 'goods_id' => $id, 'preview' => $PREVIEW_TEXT, 'photo' => $PIC, 'created_at' => date('Y-m-d H:i:s'), 'updated_at' => date('Y-m-d H:i:s')] ); DB::table('artikuls')->insert( ['sites_id' => $site->id, 'goods_id' => $id, 'artikul' => $ARTIKUL, 'name' => $NAME, 'active' => $ACTIVE, 'created_at' => date('Y-m-d H:i:s'), 'updated_at' => date('Y-m-d H:i:s')] ); //$this->setuniqueitem($id); } } } } } } $fp = fopen('/home/bitrix/www/nimda/public/log.txt', 'a'); fwrite($fp, date("d.m.Y H:i:s").": finished writing data to tables, ready to workout routines\r\n"); fclose($fp); $workout->douniq(); $fp = fopen('/home/bitrix/www/nimda/public/log.txt', 'a'); fwrite($fp, date("d.m.Y H:i:s").": uniqalization routine finished\r\n"); fclose($fp); $workout->fillartikul(); $fp = fopen('/home/bitrix/www/nimda/public/log.txt', 'a'); fwrite($fp, date("d.m.Y H:i:s").": writing artikuls to goods routine finished\r\n"); fclose($fp); $workout->setuniqueall(); //$this->douniqnoprice(); $fp = fopen('/home/bitrix/www/nimda/public/log.txt', 'a'); fwrite($fp, date("d.m.Y H:i:s").": writing unique ids routine finished\r\n"); fclose($fp); // $workout->clearartikuls(); $fp = fopen('/home/bitrix/www/nimda/public/log.txt', 'a'); fwrite($fp, date("d.m.Y H:i:s").": show is over\r\n"); fclose($fp); DB::table('settings')->where('key','goods_update')->update(['value'=>date("d.m.Y H:i:s")]); } }