diff --git a/Application/Home/Controller/IndexController.class.php b/Application/Home/Controller/IndexController.class.php index c64cf4998..a6a629b73 100644 --- a/Application/Home/Controller/IndexController.class.php +++ b/Application/Home/Controller/IndexController.class.php @@ -334,8 +334,18 @@ class IndexController extends HomeController /** * 发动手机验证码 */ - public function telsafecode($phone = '', $delay = 10, $flag = true) + public function telsafecode($phone = '', $exceptExists=1, $delay = 10, $flag = true) { + $exists = M('promote', 'tab_')->where(['login_phone'=>$phone])->find(); + if (!$exceptExists) { + if ($exists) { + return $this->ajaxReturn(['status'=>0,'msg'=>'手机号已被绑定']); + } + } else { + if (!$exists) { + return $this->ajaxReturn(['status'=>0,'msg'=>'手机号未被绑定']); + } + } $taskClient = new TaskClient(); $result = $taskClient->sendSmsCode($phone, get_client_ip()); $data = []; diff --git a/Application/Home/Controller/SafeController.class.php b/Application/Home/Controller/SafeController.class.php index 868bb8a83..b1afa7f1b 100644 --- a/Application/Home/Controller/SafeController.class.php +++ b/Application/Home/Controller/SafeController.class.php @@ -586,8 +586,20 @@ class SafeController extends BaseController{ /** * 发动手机验证码 */ - public function telsafecode($phone = '', $delay = 10, $flag = true) + public function telsafecode($phone = '', $exceptExists=1, $delay = 10, $flag = true) { + $exists = M('promote', 'tab_')->where(['login_phone'=>$phone])->find(); + if (!$exceptExists) { + if ($exists) { + return $this->ajaxReturn(['status'=>0,'msg'=>'手机号已被绑定']); + } + } else { + echo 222; + if (!$exists) { + return $this->ajaxReturn(['status'=>0,'msg'=>'手机号未被绑定']); + } + } + $taskClient = new TaskClient(); $result = $taskClient->sendSmsCode($phone, get_client_ip()); $data = []; diff --git a/Application/Home/View/default/Safe/bindTel.html b/Application/Home/View/default/Safe/bindTel.html index 2e4cc855e..9cbd59e2c 100644 --- a/Application/Home/View/default/Safe/bindTel.html +++ b/Application/Home/View/default/Safe/bindTel.html @@ -231,7 +231,7 @@ $.ajax({ type:'post', dataType:'json', - data:'phone='+phone, + data:{'phone':phone, 'exceptExists':0}, url:'{:U("telsafecode")}', success:function(data) { if (data.status ==1) {