|
@@ -377,7 +377,7 @@ class CustomerService extends Service
|
|
$address = $tmp;
|
|
$address = $tmp;
|
|
}
|
|
}
|
|
$customer['address'] = $address;
|
|
$customer['address'] = $address;
|
|
- $customer['customer_contact'] = $customer['employee_one'] = $customer['employee_two'] = $customer['employee_three'] = $customer['img'] = $customer['file'] = $customer['employee'] = $customer['depart'] = [];
|
|
|
|
|
|
+ $customer['customer_contact'] = $customer['employee_one'] = $customer['employee_two'] = $customer['employee_three'] = $customer['img'] = $customer['file'] = $customer['employee'] = $customer['depart'] = $customer['old_employee_one'] = [];
|
|
$array = [
|
|
$array = [
|
|
$customer['customer_intention'],
|
|
$customer['customer_intention'],
|
|
$customer['customer_from'],
|
|
$customer['customer_from'],
|
|
@@ -481,6 +481,12 @@ class CustomerService extends Service
|
|
'name' => $emp_map[$value['data_id']] ?? '',
|
|
'name' => $emp_map[$value['data_id']] ?? '',
|
|
];
|
|
];
|
|
$customer['employee'][] = $tmp;
|
|
$customer['employee'][] = $tmp;
|
|
|
|
+ }elseif ($value['type'] == CustomerInfo::type_nine){
|
|
|
|
+ $tmp = [
|
|
|
|
+ 'id' => $value['data_id'],
|
|
|
|
+ 'name' => $emp_map[$value['data_id']] ?? '',
|
|
|
|
+ ];
|
|
|
|
+ $customer['old_employee_one'][] = $tmp;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
$customer['crt_name'] = $emp_map[$customer['crt_id']] ?? '';
|
|
$customer['crt_name'] = $emp_map[$customer['crt_id']] ?? '';
|
|
@@ -642,11 +648,21 @@ class CustomerService extends Service
|
|
DB::beginTransaction();
|
|
DB::beginTransaction();
|
|
$time = time();
|
|
$time = time();
|
|
|
|
|
|
- //销售/负责/协同人清空
|
|
|
|
- CustomerInfo::where('del_time',0)
|
|
|
|
|
|
+ $insert = [];
|
|
|
|
+
|
|
|
|
+ //负责人获取 改为前负责人
|
|
|
|
+ $man = CustomerInfo::where('del_time',0)
|
|
->where('customer_id',$data['customer_id'])
|
|
->where('customer_id',$data['customer_id'])
|
|
- ->whereIn('type', CustomerInfo::$man2)
|
|
|
|
- ->update(['del_time' => $time]);
|
|
|
|
|
|
+ ->where('type', CustomerInfo::type_two)
|
|
|
|
+ ->get()->toArray();
|
|
|
|
+ foreach ($man as $value){
|
|
|
|
+ $insert[] = [
|
|
|
|
+ 'customer_id' => $data['customer_id'],
|
|
|
|
+ 'data_id' => $value['data_id'],
|
|
|
|
+ 'type' => CustomerInfo::type_nine,
|
|
|
|
+ 'crt_time' => $time
|
|
|
|
+ ];
|
|
|
|
+ }
|
|
//增加自己为负责人
|
|
//增加自己为负责人
|
|
$insert[] = [
|
|
$insert[] = [
|
|
'customer_id' => $data['customer_id'],
|
|
'customer_id' => $data['customer_id'],
|
|
@@ -654,7 +670,17 @@ class CustomerService extends Service
|
|
'type' => CustomerInfo::type_two,
|
|
'type' => CustomerInfo::type_two,
|
|
'crt_time' => $time
|
|
'crt_time' => $time
|
|
];
|
|
];
|
|
|
|
+
|
|
|
|
+ //人员清空
|
|
|
|
+ CustomerInfo::where('del_time',0)
|
|
|
|
+ ->where('customer_id',$data['customer_id'])
|
|
|
|
+ ->whereIn('type', CustomerInfo::$man2)
|
|
|
|
+ ->update(['del_time' => $time]);
|
|
|
|
+
|
|
|
|
+ //写入最新人员
|
|
CustomerInfo::insert($insert);
|
|
CustomerInfo::insert($insert);
|
|
|
|
+
|
|
|
|
+ //更新公海池状态
|
|
Customer::where('id',$data['customer_id'])->update([
|
|
Customer::where('id',$data['customer_id'])->update([
|
|
'pond_state' => 0
|
|
'pond_state' => 0
|
|
]);
|
|
]);
|