From 53adf43e91ebaba9997c752acc3ad8bb54e40d1c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=A0=E8=90=8C?= <494089941@qq.com> Date: Thu, 30 Mar 2023 10:45:53 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E6=89=8B=E5=8A=A8=E6=94=BE=E5=85=A5?= =?UTF-8?q?=E5=85=AC=E6=B5=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- application/crm/controller/Customer.php | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/application/crm/controller/Customer.php b/application/crm/controller/Customer.php index b913b08..5fbdd66 100644 --- a/application/crm/controller/Customer.php +++ b/application/crm/controller/Customer.php @@ -423,20 +423,22 @@ class Customer extends ApiCommon # 消息数据 $message = []; + # 获取公海规则数据 + $customerPoolData = db('crm_customer_pool')->where('pool_id=' . $poolId)->column(['customer_type']); + $customerTypeArray = explode(',', $customerPoolData[0]); + # 获取客户数据 $customerData = []; - $customerList = db('crm_customer')->field(['customer_id', 'owner_user_id', 'name', 'crm_lthugd'])->whereIn('customer_id', $customerIds)->select(); - foreach ($customerList as $key => $value) { - $customerData[$value['customer_id']] = $value; - } + $customerList = db('crm_customer')->field(['customer_id', 'owner_user_id', 'name', 'crm_roziuw'])->whereIn('customer_id', $customerIds)->select(); - # 获取公海规则数据 - $customerPoolData = db('crm_customer_pool')->field(['customer_type'])->where('pool_id=' . $poolId)->find(); - # 判断客户类型是否符合公海池客户类型 - if (!in_array($customerData['crm_lthugd'], $customerPoolData)) { - $message[] = '客户类型与公海池类型不匹配!'; - return resultArray(['error' => $message]); + foreach ($customerList as $key => $value) { + # 判断客户类型是否符合公海池客户类型 + if (!in_array($value['crm_roziuw'], $customerTypeArray)) { + $message[] = '客户类型与公海池类型不匹配!'; + return resultArray(['error' => $message]); + } + $customerData[$value['customer_id']] = $value; } @@ -1195,7 +1197,7 @@ class Customer extends ApiCommon */ public function Type() { - $data = db('admin_field')->where(['types' => 'crm_customer', 'field' => 'crm_lthugd'])->value('options'); + $data = db('admin_field')->where(['types' => 'crm_customer', 'field' => 'crm_roziuw'])->value('options'); $data = explode(',', $data); -- 2.36.3 From cdbc6abd870ec20fedc9c9b890747ab9a81d79e6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=A0=E8=90=8C?= <494089941@qq.com> Date: Thu, 30 Mar 2023 10:47:25 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E5=AD=97=E6=AE=B5=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- application/crm/controller/Customer.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/application/crm/controller/Customer.php b/application/crm/controller/Customer.php index 5fbdd66..2f32cdc 100644 --- a/application/crm/controller/Customer.php +++ b/application/crm/controller/Customer.php @@ -429,12 +429,12 @@ class Customer extends ApiCommon # 获取客户数据 $customerData = []; - $customerList = db('crm_customer')->field(['customer_id', 'owner_user_id', 'name', 'crm_roziuw'])->whereIn('customer_id', $customerIds)->select(); + $customerList = db('crm_customer')->field(['customer_id', 'owner_user_id', 'name', 'crm_lthugd'])->whereIn('customer_id', $customerIds)->select(); foreach ($customerList as $key => $value) { # 判断客户类型是否符合公海池客户类型 - if (!in_array($value['crm_roziuw'], $customerTypeArray)) { + if (!in_array($value['crm_lthugd'], $customerTypeArray)) { $message[] = '客户类型与公海池类型不匹配!'; return resultArray(['error' => $message]); } @@ -1197,7 +1197,7 @@ class Customer extends ApiCommon */ public function Type() { - $data = db('admin_field')->where(['types' => 'crm_customer', 'field' => 'crm_roziuw'])->value('options'); + $data = db('admin_field')->where(['types' => 'crm_customer', 'field' => 'crm_lthugd'])->value('options'); $data = explode(',', $data); -- 2.36.3