edit-api-post_cus2
This commit is contained in:
@@ -244,9 +244,18 @@ class Customers extends Wxapp
|
||||
if (!$city_id || !$county_id) {
|
||||
throw new Exception('请选择城市与行政区', API_CODE_FAIL);
|
||||
}
|
||||
$is_exit = $this->customers_model->get(['biz_id' => $this->biz_id, 'mobile' => $mobile],'id');
|
||||
$is_exit = $this->customers_model->get(['biz_id' => $this->biz_id, 'mobile' => $mobile],'id,sales_id');
|
||||
if ($is_exit) {
|
||||
return ['code'=>API_CODE_FAIL,'msg'=>'客户已存在','data'=>['id'=>$is_exit['id']]];
|
||||
if($is_exit['sales_id']!=$this->session['uid']){
|
||||
$user = $this->app_user_model->get(['id' => $is_exit['sales_id']],'uname');
|
||||
$msg = "该客户归属于{$user['uname']}";
|
||||
$owner = 0;
|
||||
}else{
|
||||
$msg = '客户已存在';
|
||||
$owner = 1;
|
||||
}
|
||||
|
||||
return ['code'=>API_CODE_FAIL,'msg'=>$msg,'data'=>['id'=>$is_exit['id'],'owner'=>$owner]];
|
||||
}
|
||||
$biz_row = $this->biz_model->get(['id' => $this->biz_id]);
|
||||
$this->load->library('receiver/customers_entity');
|
||||
|
||||
Reference in New Issue
Block a user