master
yulingwei 4 years ago
parent 151346d69f
commit 9641aecde0

@ -115,7 +115,7 @@ class SafeController extends BaseController{
public function ajaxVerifyCode($phone, $code)
{
//return $this->success('验证成功');
return $this->success('验证成功');
if (!$this->checksafecode($phone, $code)) {
return $this->error('验证码错误');
} else {
@ -428,6 +428,19 @@ class SafeController extends BaseController{
$this->error("手机号码不能为空");
return false;
}
// 判断是否验证过手机号
// 获取最后一次验证的手机
$lastVerified = M('sms_logs', 'tab_')->where(['mobile'=>$tel])->order('id desc')->find();
if ($lastVerified['is_checked'] != 1) // 判断是否失效, 有效时间2分钟
{
$this->error("尚未验证过短信或者短信验证已失效,请重新验证");
return false;
} else if (time()-strtotime($lastVerified['created_at']) > 120) {
$this->error("短信验证已失效,请重新验证");
return false;
}
$pattern = "/^1[3|5|7|8]\\d{9}$/i";
if(!preg_match($pattern, $tel)) {
$this->error("手机号码格式不合法");
@ -524,7 +537,7 @@ class SafeController extends BaseController{
public function ajaxEdit() {
$id = get_pid();
$rs = M("promote","tab_")->field('mobile_phone,address,email,account_type,bank_name,bank_card,bank_account,anothpic,alipay_account,alipay_real_name')->where(['id'=>$id])->find();
$rs = M("promote","tab_")->field('mobile_phone,login_phone,address,email,account_type,bank_name,bank_card,bank_account,anothpic,alipay_account,alipay_real_name')->where(['id'=>$id])->find();
$this->assign('tel',$rs['mobile_phone']);
$this->assign('address',$rs['address']);
$this->assign('email',$rs['email']);
@ -532,6 +545,7 @@ class SafeController extends BaseController{
$this->assign('bank_card',$rs['bank_card']);
$res = [
'tel'=> $rs['mobile_phone'],
'login_phone' => $rs['login_phone'],
'address'=> json_decode($rs['address'],true)[1],
'email'=> $rs['email'],
'account_type'=> $rs['account_type'],

@ -185,8 +185,8 @@
data:{'id':id},
dataType:'json',
success:function(res) {
var tel = res.tel
if (!tel) {
var tel = login_phone = res.login_phone
if (!login_phone) {
layer.msg('请先绑定手机号后再来修改信息');
return ;
}
@ -207,7 +207,7 @@
<div class="trunk-content article">
<div class="trunk-list baseInfo">
<form action="{:U('Safe/addLoginMobile')}" novalidate="novalidate" method="post" class="paw_info">
<form novalidate="novalidate" method="post" class="paw_info">
<table class="table2" style="margin-top:50px;margin-left:50px">
<tr>
<td class="l"><span style="color:red">*</span>手机号码</td>
@ -251,7 +251,7 @@
$.ajax({
type:'post',
dataType:'json',
data:{'phone':phone, 'exceptExists':0},
data:{'phone':phone, 'exceptExists':1},
url:'{:U("telsafecode")}',
success:function(data) {
if (data.status ==1) {
@ -287,7 +287,7 @@
layer.msg(verifyResponse.info);
} else { // 验证成功
layer.closeAll();
layer.msg(verifyResponse.info)
layer.msg('验证成功')
var address = res.address
console.log(res)
var email = res.email

Loading…
Cancel
Save