]> gitweb.erp-flowers.ru Git - erp24_rep/yii-erp24/.git/commitdiff
Добавление статуса покупки
authorfomichev <vladimir.fomichev@erp-flowers.ru>
Fri, 10 Jan 2025 07:12:38 +0000 (10:12 +0300)
committerfomichev <vladimir.fomichev@erp-flowers.ru>
Fri, 10 Jan 2025 07:12:38 +0000 (10:12 +0300)
erp24/records/Users.php

index c68c1ae93a9c804f35e1a5db8e9857612286f497..936c2ea66647b76fc0c09caa47aeb530276413d2 100755 (executable)
@@ -4,6 +4,7 @@ namespace yii_app\records;
 
 use Yii;
 use yii\base\StaticInstanceInterface;
+use yii\helpers\BaseConsole;
 
 /**
  * This is the model class for table "users".
@@ -529,6 +530,17 @@ class Users extends \yii\db\ActiveRecord
             ->select('phone')
             ->column();
 
+        if (!empty($excludeSalesPhone)) {
+            $updatedCount = SentKogort::updateAll(
+                ['purchase' => 1], // Устанавливаем покупка
+                [
+                    'target_date' => $targetDate,
+                    'kogort_number' => SentKogort::KOGORT_NUMBERS['target'],
+                    'phone' => $excludeSalesPhone,
+                ]
+            );
+        }
+
         $whatsappPhones = array_diff(array_diff($targetPhones, $excludeRegistered), $excludeSalesPhone);
         $secondTarget = array_diff($excludeRegistered, $excludeSalesPhone);
 
@@ -554,6 +566,16 @@ class Users extends \yii\db\ActiveRecord
             ->select('phone')
             ->column();
 
+        if (!empty($excludeSalesPhone)) {
+            $updatedCount = SentKogort::updateAll(
+                ['purchase' => 1], // Устанавливаем покупка
+                [
+                    'target_date' => $targetDate,
+                    'kogort_number' => SentKogort::KOGORT_NUMBERS['target'],
+                    'phone' => $excludeSalesPhone,
+                ]
+            );
+        }
 
         return array_diff($whatsappPhones, $excludeSalesPhone);
     }