From cf7c6ccf46af369c5329c41d5aa0ab5ff4881f86 Mon Sep 17 00:00:00 2001 From: fomichev Date: Mon, 16 Dec 2024 15:33:29 +0300 Subject: [PATCH] =?utf8?q?=D0=A4=D0=B8=D0=BB=D1=8C=D1=82=D1=80=20=D0=B4?= =?utf8?q?=D0=BB=D1=8F=20=D0=B7=D0=B2=D0=BE=D0=BD=D0=BA=D0=BE=D0=B2=20?= =?utf8?q?=D0=BF=D0=BE=20=D0=BF=D0=BE=D0=BA=D1=83=D0=BF=D0=BA=D0=B5=20?= =?utf8?q?=D0=B7=D0=B0=202=20=D0=B4=D0=BD=D1=8F=20=D0=B4=D0=BE=20=D0=B4?= =?utf8?q?=D0=B0=D1=82=D1=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- erp24/records/Users.php | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/erp24/records/Users.php b/erp24/records/Users.php index ecac5348..4aaf17fd 100755 --- a/erp24/records/Users.php +++ b/erp24/records/Users.php @@ -323,6 +323,15 @@ class Users extends \yii\db\ActiveRecord if ($type === 'whatsapp') { $query->andWhere(['telegram_is_subscribed' => 0]); + } elseif ($type === 'call') { + $excludeSalesPhone = Sales::find() + ->where(['>=', 'date', date('Y-m-d', strtotime("$startDate -7 days"))]) + ->andWhere(['<=', 'date', date('Y-m-d', strtotime("$startDate -2 days"))]) + ->distinct('phone') + ->select('phone') + ->column(); + + $query->andWhere(['not in', 'phone', $excludeSalesPhone]); } $users = $query->all(); -- 2.39.5