cqp hai 6 meses
pai
achega
ace5a88c7c
Modificáronse 1 ficheiros con 15 adicións e 2 borrados
  1. 15 2
      app/Service/CustomerService.php

+ 15 - 2
app/Service/CustomerService.php

@@ -767,6 +767,13 @@ class CustomerService extends Service
             $model->where('fp_time','>=',$return[0]);
             $model->where('fp_time','<=',$return[1]);
         }
+        if(! empty($data['smart_search'])){
+            $customer_id = $this->contactSearch($data['smart_search']);
+            $progress_stage_id = (new RangeService())->customerBasicTypeSearch($data['smart_search'],[5]);
+            $model->where('title', 'LIKE', '%'.$data['smart_search'].'%')
+                ->orWhereIn('id', $customer_id)
+                ->orWhereIn('progress_stage', $progress_stage_id);
+        }
         if(! empty($data['belong_top_depart_title'])){
             list($id) = $this->searchCustomerDepart($data['belong_top_depart_title']);
             $model->whereIn('id', $id);
@@ -1064,12 +1071,18 @@ class CustomerService extends Service
         $basic_maps = BasicType::whereIn('id',array_unique(array_filter(array_column($customer_info,'contact_type'))))->pluck('title','id')->toArray();
         foreach ($customer_info as $value){
             if($value['type'] == CustomerInfo::type_one){
+                if(! $value['contact_info']) continue;
                 $value['contact_type_title'] = $basic_maps[$value['contact_type']] ?? "";
                 $customer_info_map[$value['customer_id']][] = $value;
+//                if(! isset($customer_info_map2[$value['customer_id']])){
+//                    $customer_info_map2[$value['customer_id']] = $value['contact_type_title'] . ": " . $value['contact_info'];
+//                }else{
+//                    $customer_info_map2[$value['customer_id']] .= ',' . $value['contact_type_title'] . ": " . $value['contact_info'];
+//                }
                 if(! isset($customer_info_map2[$value['customer_id']])){
-                    $customer_info_map2[$value['customer_id']] = $value['contact_type_title'] . ": " . $value['contact_info'];
+                    $customer_info_map2[$value['customer_id']] = $value['contact_info'];
                 }else{
-                    $customer_info_map2[$value['customer_id']] .= ',' . $value['contact_type_title'] . ": " . $value['contact_info'];
+                    $customer_info_map2[$value['customer_id']] .= '|' . $value['contact_info'];
                 }
             }elseif($value['type'] == CustomerInfo::type_two){
                 $tmp = $emp_map[$value['data_id']] ?? "";