|
@@ -416,19 +416,22 @@ class CustomerService extends Service
|
|
|
* @return array
|
|
|
*/
|
|
|
public function customerList($data,$user){
|
|
|
- $model = Customer::where('del_time',0)
|
|
|
+ $model = new Customer(['userData' => $user]);
|
|
|
+ $model = $model->where('del_time',0)
|
|
|
->select('title','id','model_type','customer_intention','customer_from','customer_type','car_type','consulting_product','intention_product','progress_stage','address1','address2','crt_id','crt_time','mark','importance','company','company_short_name','depart_id','state_type','customer_state','customer_grade','pond_state')
|
|
|
->orderby('id', 'desc');
|
|
|
|
|
|
//getALL传入后无视设置范围
|
|
|
if(empty($data['getAll']) && $user['id'] != Employee::SPECIAL_ADMIN) {
|
|
|
+ // 销售人员/负责人 3协同人 可以看见
|
|
|
$user_id = $user['id'];
|
|
|
$customer_id = CustomerInfo::where('del_time',0)
|
|
|
->where(function ($query) use($user_id) {
|
|
|
$query->where('employee_id',$user_id);
|
|
|
})->select('customer_id')->get()
|
|
|
->toArray();
|
|
|
- $model->whereIn('id',array_unique(array_column($customer_id,'customer_id')));
|
|
|
+ $emp_id = array_unique(array_column($customer_id,'customer_id'));
|
|
|
+ $model->WhereIn('id', $emp_id);
|
|
|
}
|
|
|
if(! empty($data['title'])) $model->where('title', 'LIKE', '%'.$data['title'].'%');
|
|
|
if(! empty($data['time_type'])) {
|
|
@@ -489,7 +492,7 @@ class CustomerService extends Service
|
|
|
}
|
|
|
if($bool) return [false,'客户名称不能重复'];
|
|
|
|
|
|
- return [true, $data];
|
|
|
+ return [true, ''];
|
|
|
}
|
|
|
|
|
|
/**
|