aggiornamento log
This commit is contained in:
@@ -51,7 +51,7 @@ class ProductUpdateGm extends Command
|
||||
set_time_limit(0);
|
||||
ini_set("memory_limit", "512M");
|
||||
$settingora = Setting::where('key', 'update_products')->first();
|
||||
$productLogger = new ProductLogger($settingora);
|
||||
$productLogger = new ProductLogger($settingora, 'updateproducts');
|
||||
echo "SettingOra: " . $settingora;
|
||||
$fromtime = str_replace('-', '', $settingora->value);
|
||||
|
||||
@@ -90,7 +90,7 @@ class ProductUpdateGm extends Command
|
||||
setProductFromGM($article, true, $productLogger);
|
||||
}
|
||||
|
||||
$productLogger->setLogandSendEmail();
|
||||
$productLogger->setLogandSendEmail('Aggiornamento Prodotti');
|
||||
|
||||
echo "************** Finito **************";
|
||||
|
||||
@@ -99,7 +99,7 @@ class ProductUpdateGm extends Command
|
||||
|
||||
if ($productLogger) {
|
||||
$productLogger->addLog('Error', $e->getMessage());
|
||||
$productLogger->setLogandSendEmail();
|
||||
$productLogger->setLogandSendEmail('Aggiornamento Prodotti');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -8,6 +8,7 @@ use Illuminate\Console\Command;
|
||||
use App\Setting;
|
||||
use App\Article;
|
||||
use App\Mylog;
|
||||
use App\Services\ProductLogger;
|
||||
use App\Stock;
|
||||
use Codexshaper\WooCommerce\Models\Product as ModelsProduct;
|
||||
use Codexshaper\WooCommerce\Facades\Variation;
|
||||
@@ -59,10 +60,11 @@ class TestPao extends Command
|
||||
$aggiornato = false;
|
||||
set_time_limit(0);
|
||||
ini_set("memory_limit", "512M");
|
||||
$settingora = Setting::where('key', 'update_products_qta')->first();
|
||||
$settingora = Setting::where('key', 'testpao')->first();
|
||||
$productLogger = new ProductLogger($settingora, 'testpao');
|
||||
$fromtime = str_replace('-', '', $settingora->value);
|
||||
|
||||
$log .= "Articoli: \n";
|
||||
$productLogger->addLog('info', "Articoli: \n");
|
||||
|
||||
echo "\nArticoli: \n";
|
||||
|
||||
@@ -94,7 +96,7 @@ class TestPao extends Command
|
||||
if ($articles) {
|
||||
// log the count of the articles
|
||||
echo "Num Articoli: " . $articles->count();
|
||||
$log .= "Quanti Articoli: " . $articles->count();
|
||||
$productLogger->addLog('info', "Quanti Articoli: " . $articles->count());
|
||||
|
||||
|
||||
$ind = 0;
|
||||
@@ -116,7 +118,7 @@ class TestPao extends Command
|
||||
$strarticolo = json_encode($article, JSON_PRETTY_PRINT);
|
||||
if ($strarticolo !== false) {
|
||||
echo $strarticolo;
|
||||
$log .= $strarticolo;
|
||||
$productLogger->addLog('info', $strarticolo);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -220,7 +222,7 @@ class TestPao extends Command
|
||||
} catch (\Exception $e) {
|
||||
echo "Error: " . $e->getMessage();
|
||||
|
||||
$log .= $e->getMessage();
|
||||
$productLogger->addLog('info', $e->getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -230,12 +232,12 @@ class TestPao extends Command
|
||||
|
||||
$lastrecordStock = Stock::latest('DataOra')->take(1)->get();
|
||||
|
||||
$log .= '\n';
|
||||
$productLogger->addLog('info', '\n');
|
||||
|
||||
foreach ($lastrecordStock as $stock) {
|
||||
$log .= "Codice: " . $stock->Codice;
|
||||
$log .= " QtaDisp: " . $stock->QtaDisponibile;
|
||||
$log .= " DataOra: " . $stock->DataOra;
|
||||
$productLogger->addLog('info', "Codice: " . $stock->Codice);
|
||||
$productLogger->addLog('info', " QtaDisp: " . $stock->QtaDisponibile);
|
||||
$productLogger->addLog('info', " DataOra: " . $stock->DataOra);
|
||||
|
||||
// Get the productsku record by $stock->Codice
|
||||
$productsku = Product::where('sku', $stock->Codice)->first();
|
||||
@@ -244,10 +246,10 @@ class TestPao extends Command
|
||||
// log the productsku record
|
||||
$productskustr = json_encode($productsku, JSON_PRETTY_PRINT);
|
||||
echo $productskustr;
|
||||
$log .= "\n" . $productskustr;
|
||||
$productLogger->addLog('info', "\n" . $productskustr);
|
||||
}
|
||||
|
||||
$log .= "\n";
|
||||
$productLogger->addLog('info', "\n");
|
||||
}
|
||||
|
||||
echo "************** FINE *********** ";
|
||||
@@ -255,11 +257,11 @@ class TestPao extends Command
|
||||
// Select all the fields of the Stock table
|
||||
|
||||
} catch (\Exception $e) {
|
||||
$log .= $e->getMessage();
|
||||
$productLogger->addLog('info', $e->getMessage());
|
||||
echo "Error: " . $e->getMessage();
|
||||
}
|
||||
|
||||
Log::channel('testpao')->notice($log);
|
||||
$productLogger->setLogandSendEmail('Test Paolo');
|
||||
|
||||
if (true) {
|
||||
// Send the email
|
||||
|
||||
Reference in New Issue
Block a user