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',