|
@@ -97,7 +97,13 @@ class Login extends Controller
|
|
|
return json_encode(['status'=>'fail','code'=>'1004','msg'=>'用户名'.$param['userName'].'或者密码错误','info'=>$info['login_failure']]);
|
|
|
}
|
|
|
|
|
|
+ $check = '';
|
|
|
+
|
|
|
if($info['is_send_message'] == "1") {
|
|
|
+ $check = $this->check_phone($info['phone']);
|
|
|
+ if(!$check){
|
|
|
+ return json_encode(['status'=>'fail','code'=>'0912','msg'=>'手机号为空或手机号格式错误']);
|
|
|
+ }
|
|
|
$phone = $info['phone'];
|
|
|
$code = rand('1000','9999');
|
|
|
$handle_id = $phone.rand('10000000','99999999');
|
|
@@ -126,12 +132,31 @@ class Login extends Controller
|
|
|
log::record(Cache::get($sessionid));
|
|
|
log::record('----登录信息----');
|
|
|
unset($info['password']);
|
|
|
- return json_encode(['status'=>'ok','code'=>'0000','info'=>$info,'sessionid'=>$sessionid]);
|
|
|
+ $info['phone'] = $check;
|
|
|
+ return json_encode(['status'=>'ok','code'=>'0000','info'=>$info,'sessionid'=>$sessionid,'phone'=>$check]);
|
|
|
|
|
|
}catch(\Exception $e){
|
|
|
return json_encode(['status'=>'fail','code'=>'2000','msg'=>$e->getMessage()]);
|
|
|
}
|
|
|
}
|
|
|
+ //手机号检验
|
|
|
+ public function check_phone($mobile)
|
|
|
+ {
|
|
|
+ if(empty($mobile)){
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ if(strlen($mobile) != 11){
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ $preg = preg_match('/^1[34578]\d{9}$/', $mobile);
|
|
|
+ if(!$preg){
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ $start = substr($preg,0,3);
|
|
|
+ $end = substr($preg,6,4);
|
|
|
+ $phone = $start.'****'.$end;
|
|
|
+ return $phone;
|
|
|
+ }
|
|
|
|
|
|
//再次发送短信
|
|
|
public function send_message_again()
|