From 8e003c7be45a21935adcab85354105fe51bd30d3 Mon Sep 17 00:00:00 2001 From: liutong <836164388@qq.com> Date: Wed, 11 Jun 2025 18:07:16 +0800 Subject: [PATCH] =?UTF-8?q?fix(api):=20=E4=BF=AE=E5=A4=8D=E5=AE=A2?= =?UTF-8?q?=E6=88=B7=E8=B5=84=E6=BA=90=E6=89=8B=E6=9C=BA=E5=8F=B7=E9=87=8D?= =?UTF-8?q?=E5=A4=8D=E6=B7=BB=E5=8A=A0=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 在添加客户资源前增加手机号存在性检查- 通过修改 CustomerResourcesService 类实现手机号查询功能 --- .../app/api/controller/apiController/CustomerResources.php | 6 ++++++ .../app/service/api/apiService/CustomerResourcesService.php | 3 +++ 2 files changed, 9 insertions(+) diff --git a/niucloud/app/api/controller/apiController/CustomerResources.php b/niucloud/app/api/controller/apiController/CustomerResources.php index 3112f01c..7f7072fe 100644 --- a/niucloud/app/api/controller/apiController/CustomerResources.php +++ b/niucloud/app/api/controller/apiController/CustomerResources.php @@ -99,6 +99,12 @@ class CustomerResources extends BaseApiService } } + //验证手机号是否存在 + $info = (new CustomerResourcesService())->getInfo(['phone_number'=>$customer_resources_data['phone_number']]); + if(!empty($info['data']['id'])){ + return fail("手机号已存在"); + } + $res = (new CustomerResourcesService())->addData($customer_resources_data,$six_speed_data); if(!$res['code']){ diff --git a/niucloud/app/service/api/apiService/CustomerResourcesService.php b/niucloud/app/service/api/apiService/CustomerResourcesService.php index 8b0ab131..838d087b 100644 --- a/niucloud/app/service/api/apiService/CustomerResourcesService.php +++ b/niucloud/app/service/api/apiService/CustomerResourcesService.php @@ -47,6 +47,9 @@ class CustomerResourcesService extends BaseApiService if(!empty($where['member_id'])){ $model = $model->where('member_id', $where['member_id']); } + if(!empty($where['phone_number'])){ + $model = $model->where('phone_number', $where['phone_number']); + } $data = $model->field($field) ->with([ 'memberHasOne',