作者 潘浩文
1 个管道 的构建 通过 耗费 0 秒

1

... ... @@ -35,12 +35,12 @@ class RegisterController extends WeChatBaseController
public function getCode(){
$param=$this->request->param();
$code=cmf_get_verification_code($param['phone'],4);
$code=cmf_get_verification_code($param['mobile'],4);
// var_dump($code);
if ($code) {
$mobile=new MobileService();
$mobile->sendSMSS($param['phone'],$code);
$re=cmf_verification_code_log($param['phone'], $code, time()+60);
$mobile->sendSMSS($param['mobile'],$code);
$re=cmf_verification_code_log($param['mobile'], $code, time()+60);
if ($re){
return'验证码发送成功';
}else{
... ...
... ... @@ -134,7 +134,7 @@
</p>
</div>
<div class="register_tel">
<input type="text" placeholder="手机号">
<input type="text" placeholder="手机号" id="mobile">
</div>
</div>
... ... @@ -146,7 +146,7 @@
</p>
</div>
<div class="register_codenum">
<input type="text" placeholder="验证码">
<input type="text" placeholder="验证码" id="code">
</div>
<button class="getcode"></button>
... ... @@ -161,7 +161,8 @@
var InterValObj; //timer变量,控制时间
var count = 10; //间隔函数,1秒执行
var curCount='';//当前剩余秒数
var mobile=$("#mobile").val();
var code=$("#code").val();
var t=localStorage.getItem("time");
InterValObj = window.setInterval(SetRemainTime,1000);
if(t!=null){
... ... @@ -182,6 +183,17 @@
// $(".sendcode").unbind()
$(".getcode").html( curCount + "秒");
InterValObj = window.setInterval(SetRemainTime,1000); //启动计时器,1秒执行一次
$.ajax({
url: "{:url('user/register/getCode')}",
type: "post",
data: {
mobile:mobile,
code:code,
},
success: function (data) {
alert(data)
}
})
});
... ... @@ -200,6 +212,27 @@
$(".getcode").html(curCount + "秒");
}
}
$(".sure").click(function () {
$.ajax({
url: "{:url('user/register/doRegister')}",
type: "post",
data: {
mobile:mobile,
code:code,
},
success: function (data) {
if (data==1){
alert('注册成功')
window.location.href="{:url('portal/index/index')}";
}
else {
alert(data)
return false
}
}
})
})
</script>
</body>
</html>
... ...