From c1b5569213b76ca52430bfb515dc335bed8c59d4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9C=E7=94=A8lww?= <“529520975@qq.com> Date: Wed, 20 Nov 2019 11:40:47 +0800 Subject: [PATCH] =?UTF-8?q?=E6=89=8B=E6=9C=BA=E5=AE=98=E7=BD=91-=E6=89=8B?= =?UTF-8?q?=E6=9C=BA=E6=B3=A8=E5=86=8C=E4=B8=8E=E8=B4=A6=E5=8F=B7=E6=B3=A8?= =?UTF-8?q?=E5=86=8C=E4=BF=AE=E6=94=B9=EF=BC=8C=E6=98=B5=E7=A7=B0=E8=87=AA?= =?UTF-8?q?=E5=8A=A8=E7=94=9F=E6=88=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controller/UserController.class.php | 37 +++++++++++++++---- Application/Mobile/View/User/login.html | 2 +- Application/Mobile/View/User/register.html | 14 ++++++- Application/Mobile/View/User/step1.html | 8 ++-- 4 files changed, 48 insertions(+), 13 deletions(-) diff --git a/Application/Mobile/Controller/UserController.class.php b/Application/Mobile/Controller/UserController.class.php index 090bb01d3..5de27038d 100644 --- a/Application/Mobile/Controller/UserController.class.php +++ b/Application/Mobile/Controller/UserController.class.php @@ -307,13 +307,35 @@ class UserController extends BaseController */ public function register() { - $safeinfo = session('safeinfo'); - if ($safeinfo['status'] == 1) { +// $safeinfo = session('safeinfo'); +// if ($safeinfo['status'] == 1) { if (IS_POST) { + $post = I('post.'); + $account = $post['phone']; + $password = $post['password']; + $sex = isset($post['sex']) ? $post['sex'] : 0; + if (empty($account)) { + echo json_encode(array('status' => 0, 'msg' => '请输入手机号')); + exit; + } + if (empty($password)) { + echo json_encode(array('status' => 0, 'msg' => '请输入密码')); + exit; + } + + $promoteId = I('post.promote_id'); + $promoteId = intval($promoteId); + if ($promoteId > 0) { + $gameId = intval(I('post.game_id')); + $safeinfo = array('nickname' => $account, 'password' => $password, 'sex' => $sex, 'status' => 1, 'promote_id' => $promoteId, 'game_id' => $gameId); + } else { + $safeinfo = array('nickname' => $account, 'password' => $password, 'sex' => $sex, 'status' => 1); + } + $phone = $post['phone']; $safecode = $post['code']; - $nickname = $safeinfo['nickname']; + $nickname = 'U_' . substr($safeinfo['nickname'],-4); $password = $safeinfo['password']; $sex = $safeinfo['sex']; @@ -423,9 +445,9 @@ class UserController extends BaseController $this->assign('url', $url); $this->display(); } - } else { - $this->redirect(U('step')); - } +// } else { +// $this->redirect(U('step')); +// } } /** @@ -438,7 +460,8 @@ class UserController extends BaseController if (IS_POST) { $post = I('post.'); $account = $post['account']; - $nickname = $post['nickname']; +// $nickname = $post['nickname']; + $nickname = 'U_' . substr($account,-4);; $password = $post['password']; $sex = $post['sex']; diff --git a/Application/Mobile/View/User/login.html b/Application/Mobile/View/User/login.html index f1b1f3097..d25a26c11 100644 --- a/Application/Mobile/View/User/login.html +++ b/Application/Mobile/View/User/login.html @@ -31,7 +31,7 @@
还没有账号? 账号注册 | 手机注册
-
还没有账号? 账号注册 | 手机注册
+
还没有账号? 账号注册 | 手机注册
diff --git a/Application/Mobile/View/User/register.html b/Application/Mobile/View/User/register.html index 867e8030c..87ca0f859 100644 --- a/Application/Mobile/View/User/register.html +++ b/Application/Mobile/View/User/register.html @@ -28,11 +28,16 @@
手机注册
+
+
+ + +
获取验证码
@@ -85,12 +90,19 @@ $('.submit').click(function(event) { var mobile = $.trim($('#mobile').val()); var code = $.trim($('#code').val()); + var password = $.trim($('#password').val()); + var promoteId = parseInt("{:I('get.pid')}") ? parseInt("{:I('get.pid')}") : 0; + var gameId = parseInt("{:I('get.gid')}") ? parseInt("{:I('get.gid')}") : 0; + if(password.length == 0){ + pmsg.msg('密码不能为空');event.preventDefault(); + return false; + } if (mobile) { if (code) { $.ajax({ type:'POST', url:'{:U("register")}', - data:{'phone':mobile,'code':code}, + data:{'phone':mobile,'code':code,'password':password,'promote_id':promoteId,'game_id':gameId}, dataType:"Json", success:function(data){ if(data.status == 1){ diff --git a/Application/Mobile/View/User/step1.html b/Application/Mobile/View/User/step1.html index 26ce78ec0..f91b94139 100644 --- a/Application/Mobile/View/User/step1.html +++ b/Application/Mobile/View/User/step1.html @@ -28,10 +28,10 @@
-
+