From fa8a48ffb7a0ac0cdbbd8c204b5bf5d5a54cafe8 Mon Sep 17 00:00:00 2001 From: marina Date: Fri, 7 Mar 2025 15:53:04 +0300 Subject: [PATCH] =?utf8?q?ERP-355=20=D0=90=D0=B2=D1=82=D0=BE=D0=BC=D0=B0?= =?utf8?q?=D1=82=D0=B8=D0=B7=D0=B0=D1=86=D0=B8=D1=8F=20=D0=B7=D0=B2=D0=BE?= =?utf8?q?=D0=BD=D0=BA=D0=BE=D0=B2=20=D1=80=D0=BE=D0=B1=D0=BE=D1=82=D0=BE?= =?utf8?q?=D0=BC=20=D0=B8=D0=B7=20=D0=BA=D0=BE=D0=B3=D0=BE=D1=80=D1=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- erp24/commands/CronController.php | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/erp24/commands/CronController.php b/erp24/commands/CronController.php index 7aa06428..54369858 100644 --- a/erp24/commands/CronController.php +++ b/erp24/commands/CronController.php @@ -824,11 +824,17 @@ class CronController extends Controller 'payments' => [ ], ]); - if ($response['status'] == LPTrackerApi::SUCCESS_STATUS) { - SentKogort::updateAll(['status' => SentKogort::SUCCESS_UPLOAD_TO_LPTRACKER_STATUS], ['id' => $number->id]); - } else { - SentKogort::updateAll(['status' => SentKogort::ERROR_UPLOAD_TO_LPTRACKER_STATUS], ['id' => $number->id]); - throw new \Exception("ОШИБКА С LPTRACKER\n" . implode('. ', array_map(fn($error) => $error['message'], $response['errors']))); + + $status = $response['status'] == LPTrackerApi::SUCCESS_STATUS + ? SentKogort::SUCCESS_UPLOAD_TO_LPTRACKER_STATUS + : SentKogort::ERROR_UPLOAD_TO_LPTRACKER_STATUS; + + SentKogort::updateAll(['status' => $status], ['id' => $number->id]); + + if ($status === SentKogort::ERROR_UPLOAD_TO_LPTRACKER_STATUS) { + throw new \Exception( + "ОШИБКА С LPTRACKER\n" . implode('. ', array_column($response['errors'], 'message')) + ); } } } catch (\Exception $exception) { -- 2.39.5