This commit is contained in:
paoloar77
2024-06-19 17:57:01 +02:00
parent cfedb20cf5
commit d7ae2aa8cc

View File

@@ -47,10 +47,12 @@ class ProductUpdateGm extends Command
*/
public function handle()
{
try {
set_time_limit(0);
ini_set("memory_limit", "512M");
$settingora = Setting::where('key', 'update_products')->first();
$productLogger = new ProductLogger($settingora->value);
echo "SettingOra: " . $settingora;
$fromtime = str_replace('-', '', $settingora->value);
$articles = Article::join(DB::raw('(SELECT IdArticolo, MAX(DataOra) AS data FROM T_WEB_Articoli GROUP BY IdArticolo) b'), function ($join) {
@@ -83,12 +85,21 @@ class ProductUpdateGm extends Command
->orderBy('Titolo')
->get();
$productLogger = new ProductLogger($settingora->value);
foreach ($articles as $article) {
setProductFromGM($article, true, $productLogger);
}
$productLogger->setLogandSendEmail();
} catch (\Exception $e) {
echo $e->getMessage();
if ($productLogger) {
$productLogger->addLog('Error', $e->getMessage());
$productLogger->setLogandSendEmail();
}
}
}
}