From d8a78489f23831239a464d8a7b83f75910991f28 Mon Sep 17 00:00:00 2001 From: lccsw <805383944@qq.com> Date: Tue, 22 Nov 2022 17:46:17 +0800 Subject: [PATCH] edit-api-post_cus2 --- api/controllers/wxapp/licheb/Customers.php | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/api/controllers/wxapp/licheb/Customers.php b/api/controllers/wxapp/licheb/Customers.php index eff0555a..0abaa2dc 100644 --- a/api/controllers/wxapp/licheb/Customers.php +++ b/api/controllers/wxapp/licheb/Customers.php @@ -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');