作者 anyv
1 个管道 的构建 通过 耗费 0 秒

注册

... ... @@ -48,6 +48,23 @@ class IndexController extends WeChatBaseController
}
//会员添加
public function madd(){
$data['name'] = input('post.name');
$data['phone'] = input('post.phone');
$data['birthday'] = input('post.birthday');
$data['weixin'] = input('post.weixin');
$data['uid'] = cmf_get_current_user_id();
$data = Db::name('members_user') -> insert($data);
if($data){
return true;
}else{
return false;
}
}
}
... ...
... ... @@ -55,19 +55,7 @@
</div>
</div>
<script src="__TMPL__/public/assets/js/jquery.js"></script>
<script>
//注册添加
function zhuce(){
name = $("input[name='name']").val();
phone = $("input[name='phone']").val();
birthday = $("#demo2").val();
weixin = $("input[name='weixin']").val();
console.log(weixin);
}
</script>
<script>
var res = /^1[34578]\d{9}$/;
$('.reg').click(function () {
... ... @@ -82,7 +70,19 @@
}else if(!res.test($('#phone1').val())){
alert("请输入正确的电话格式")
}else{
alert('注册成功')
name = $("input[name='name']").val();
phone = $("input[name='phone']").val();
birthday = $("#demo2").val();
weixin = $("input[name='weixin']").val();
$.post("{:url('Index/madd')}", {name:name,phone:phone,birthday:birthday,weixin:weixin}, function(data) {
if(data){
alert('注册成功');
}else{
alert('注册失败');
}
});
}
});
... ...