...
|
...
|
@@ -56,16 +56,20 @@ class SmsController extends HomeBaseController |
|
|
$mobile = request()->param('mobile');
|
|
|
$code = request()->param('code');
|
|
|
$data = Db::name('zj_code')->field('mobile,code,expire_time')->where(['mobile' => $mobile])->find();
|
|
|
if (time() > $data['expire_time']) {
|
|
|
$this->success('验证码已过期,请重新发送', '', false);
|
|
|
} else {
|
|
|
if ($code == $data['code'] && $code != null && $data['code'] != null && $mobile == $data['mobile']) {
|
|
|
Db::name('zj_code')->where(['mobile' => $mobile])->update(['code' => '']);
|
|
|
Db::name('user')->update(['id' => session('user.id'), 'mobile' => $mobile]);
|
|
|
$this->success('绑定成功', url(''), true);
|
|
|
if(!empty($data)) {
|
|
|
if (time() > $data['expire_time']) {
|
|
|
$this->success('验证码已过期,请重新发送', '', false);
|
|
|
} else {
|
|
|
$this->success('验证码有误', '', false);
|
|
|
if ($code == $data['code'] && $code != null && $data['code'] != null && $mobile == $data['mobile']) {
|
|
|
Db::name('zj_code')->where(['mobile' => $mobile])->update(['code' => '']);
|
|
|
Db::name('user')->update(['id' => session('user.id'), 'mobile' => $mobile]);
|
|
|
$this->success('绑定成功', url(''), true);
|
|
|
} else {
|
|
|
$this->success('验证码有误', '', false);
|
|
|
}
|
|
|
}
|
|
|
}else {
|
|
|
$this->success('验证码有误', '', false);
|
|
|
}
|
|
|
}
|
|
|
|
...
|
...
|
|