From a28d2a06d4254af19cea7867b468f1e8ba01ef28 Mon Sep 17 00:00:00 2001 From: fomichev Date: Thu, 26 Dec 2024 10:18:13 +0300 Subject: [PATCH] =?utf8?q?=D0=A3=D0=B4=D0=B0=D0=BB=D0=B5=D0=BD=D0=B8=D0=B5?= =?utf8?q?=20=D1=81=D1=83=D1=89=D0=B5=D1=81=D1=82=D0=B2=D1=83=D1=8E=D1=89?= =?utf8?q?=D0=B8=D1=85=20=D0=B7=D0=B0=D0=BF=D0=B8=D1=81=D0=B5=D0=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- erp24/commands/CronController.php | 8 ++++---- erp24/records/Users.php | 5 +++++ 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/erp24/commands/CronController.php b/erp24/commands/CronController.php index 20831862..cd174d5f 100644 --- a/erp24/commands/CronController.php +++ b/erp24/commands/CronController.php @@ -265,7 +265,7 @@ class CronController extends Controller $dateToProcess = date('Y-m-d', strtotime("-$i days", strtotime($currentDate))); $startDate = date('Y-m-d', strtotime("+$step2 days", strtotime($dateToProcess))); - if ( + /* if ( SentKogort::find() ->where(['kogort_date' => $startDate, 'kogort_number' => SentKogort::KOGORT_NUMBERS['whatsapp']]) ->exists() @@ -275,7 +275,7 @@ class CronController extends Controller BaseConsole::FG_YELLOW ); continue; - } + }*/ $kogortPhones = Users::formKogortByDateAndType($startDate, 'whatsapp'); @@ -316,7 +316,7 @@ class CronController extends Controller $dateToProcess = date('Y-m-d', strtotime("-$i days", strtotime($currentDate))); $startDate = date('Y-m-d', strtotime("+$step3 days", strtotime($dateToProcess))); - if ( + /*if ( SentKogort::find() ->where(['kogort_date' => $startDate, 'kogort_number' => SentKogort::KOGORT_NUMBERS['call']]) ->exists() @@ -326,7 +326,7 @@ class CronController extends Controller BaseConsole::FG_YELLOW ); continue; - } + }*/ $kogortPhones = Users::formKogortByDateAndType($startDate, 'call'); diff --git a/erp24/records/Users.php b/erp24/records/Users.php index 9f9860c1..b0096fb1 100755 --- a/erp24/records/Users.php +++ b/erp24/records/Users.php @@ -571,6 +571,11 @@ class Users extends \yii\db\ActiveRecord ->where(['kogort_date' => $startDate, 'kogort_number' => $kogort_number]) ->column(); + if ($kogortPhones) { + SentKogort::deleteAll(['kogort_date' => $startDate, 'kogort_number' => $kogort_number]); + $kogortPhones =[]; + } + foreach ($phones as $phone) { if ($phone && !in_array($phone, $kogortPhones)) { $sentKogort = new SentKogort(); -- 2.39.5