cqp 6 ay önce
ebeveyn
işleme
9372777758

+ 10 - 10
app/Console/Commands/CustomerFromThreePlatForm.php

@@ -154,16 +154,16 @@ class CustomerFromThreePlatForm extends Command
         }
 
         // 第二步:数据库中已存在的联系方式
-        $contact = CustomerInfo::from('customer_info as a')
-            ->join('customer as b', 'b.id', 'a.customer_id')
-            ->where('a.del_time', 0)
-            ->where('b.del_time', 0)
-            ->where('b.top_depart_id', 2)
-            ->whereIn('a.contact_info', $search)
-            ->pluck('a.contact_info')
-            ->toArray();
-
-        $contact = array_flip($contact); // 方便 in_array 变成 isset 检查
+//        $contact = CustomerInfo::from('customer_info as a')
+//            ->join('customer as b', 'b.id', 'a.customer_id')
+//            ->where('a.del_time', 0)
+//            ->where('b.del_time', 0)
+//            ->where('b.top_depart_id', 2)
+//            ->whereIn('a.contact_info', $search)
+//            ->pluck('a.contact_info')
+//            ->toArray();
+//
+//        $contact = array_flip($contact); // 方便 in_array 变成 isset 检查
 
         // 第三步:逐条判断
         foreach ($data as $value) {

+ 29 - 29
app/Service/CustomerService.php

@@ -1021,20 +1021,20 @@ class CustomerService extends Service
 //                ->where('title',$data['title'])
 ////                ->where('model_type',$data['model_type'])
 //                ->exists();
-            if(! empty($data['customer_contact'])) {
-                $search = [];
-                foreach ($data['customer_contact'] as $value){
-                    $search[] = $value['info'];
-                }
-                $boolean = CustomerInfo::from('customer_info as a')
-                    ->join('customer as b','b.id','a.customer_id')
-                    ->where('a.del_time',0)
-                    ->where('b.del_time',0)
-                    ->where('b.top_depart_id',$data['top_depart_id'])
-                    ->whereIn('a.contact_info', $search)
-                    ->exists();
-                if($boolean) return [false,'客户联系内容已存在'];
-            }
+//            if(! empty($data['customer_contact'])) {
+//                $search = [];
+//                foreach ($data['customer_contact'] as $value){
+//                    $search[] = $value['info'];
+//                }
+//                $boolean = CustomerInfo::from('customer_info as a')
+//                    ->join('customer as b','b.id','a.customer_id')
+//                    ->where('a.del_time',0)
+//                    ->where('b.del_time',0)
+//                    ->where('b.top_depart_id',$data['top_depart_id'])
+//                    ->whereIn('a.contact_info', $search)
+//                    ->exists();
+//                if($boolean) return [false,'客户联系内容已存在'];
+//            }
         }else{
             if(empty($data['id'])) return [false,'ID不能为空'];
 //            $bool = Customer::where('del_time',0)
@@ -1044,21 +1044,21 @@ class CustomerService extends Service
 ////                ->where('model_type',$data['model_type'])
 //                ->exists();
 
-            if(! empty($data['customer_contact'])) {
-                $search = [];
-                foreach ($data['customer_contact'] as $value){
-                    $search[] = $value['info'];
-                }
-                $boolean = CustomerInfo::from('customer_info as a')
-                    ->join('customer as b','b.id','a.customer_id')
-                    ->where('b.id','<>',$data['id'])
-                    ->where('a.del_time',0)
-                    ->where('b.del_time',0)
-                    ->where('b.top_depart_id',$data['top_depart_id'])
-                    ->whereIn('a.contact_info', $search)
-                    ->exists();
-                if($boolean) return [false,'客户联系内容已存在'];
-            }
+//            if(! empty($data['customer_contact'])) {
+//                $search = [];
+//                foreach ($data['customer_contact'] as $value){
+//                    $search[] = $value['info'];
+//                }
+//                $boolean = CustomerInfo::from('customer_info as a')
+//                    ->join('customer as b','b.id','a.customer_id')
+//                    ->where('b.id','<>',$data['id'])
+//                    ->where('a.del_time',0)
+//                    ->where('b.del_time',0)
+//                    ->where('b.top_depart_id',$data['top_depart_id'])
+//                    ->whereIn('a.contact_info', $search)
+//                    ->exists();
+//                if($boolean) return [false,'客户联系内容已存在'];
+//            }
         }
 //        if($bool) return [false,'客户名称不能重复'];