diff --git a/Application/Mobile/Controller/SsgController.class.php b/Application/Mobile/Controller/SsgController.class.php index 4a6b80277..e3edb213c 100644 --- a/Application/Mobile/Controller/SsgController.class.php +++ b/Application/Mobile/Controller/SsgController.class.php @@ -134,16 +134,90 @@ class SsgController extends BaseController { //注册 public function phoneRegister() - { - //获取手机号 - + { + //添加用户 + C(api('Config/lists')); + + $user = $_POST; + $promoteId =( $user['promote_id'] ? $user['promote_id'] : 0); + #判断数据是否为空 + if (empty($user)) { + $this -> set_message(1001, "fail", "注册数据不能为空"); + } + #验证短信验证码 + $this -> sms_verify($user['account'], $user['code']); + + $res = $this -> doRegister($user['account'],$user['password'],$user['account'],$promoteId,4,2); + if(empty($res)){ + $this -> set_message(1017, "fail", "添加失败"); + } + //添加自动登录 + $_SESSION['user_id'] = $res; + $this -> set_message(1, "success", "添加成功"); + } + //普通注册 + public function userRegister() + { + $account = I("account"); + $password = I("password"); + $promoteId = I("promote_id", 0); + $res = $this -> doRegister($account,$password,'',$promoteId,4,1); + if(empty($res)){ + $this -> set_message(1017, "fail", "添加失败"); + } + //添加自动登录 + $_SESSION['user_id'] = $res; + $this -> set_message(1, "success", "添加成功"); # code... } + //消息返回 + public function set_message($status=0,$return_code="fail",$return_msg="操作失败"){ + $msg = array( + "status" => $status, + "return_code" => $return_code, + "return_msg" => $return_msg + ); + $this->ajaxReturn($msg,'JSON'); + exit(); + } //真正注册代码 - public function doRegister() + public function doRegister($account,$password,$phone,$promote_id,$register_way,$register_type) { + //验证账号 + $is_user_info = M('user', 'tab_') -> where(['account' => $account]) -> find(); + if (!empty($is_user_info)) { + $this -> set_message(1017, "fail", "用户名已存在"); + } + //2.验证其他平台是否存在账号 + $domain = C('UC_OTHER_WEB_URL'); + if (!empty($domain)) { + $url = "http://{$domain}/Api/user/checkUserName?account={$account}"; + $check_res = json_decode(file_get_contents($url), true); + if ($check_res['status'] == 0) { + $this -> set_message(1017, "fail", "用户名已存在"); + } + } + $data = array( + 'account' => $account, + 'password' => think_ucenter_md5($password, UC_AUTH_KEY), + 'phone' => $phone, + 'head_img' =>'', + 'promote_id' => $promote_id, + 'promote_account' =>get_promote_account($promote_id), + 'register_way' => $register_way, + 'register_type' => $register_type, + 'register_ip' => get_client_ip(), + 'parent_id'=>get_fu_id($promote_id), + 'parent_name'=>get_parent_name($promote_id), + 'register_time'=>time(), + 'check_time' => time(), + + ); + /* 添加用户 */ + $res = M('user', 'tab_') ->add($data); + return $res; # code... } @@ -262,4 +336,28 @@ class SsgController extends BaseController { $res = array("day" => $days, "hour" => $hours, "min" => $mins, "sec" => $secs); return $res; } + public function sms_verify($phone="" ,$code="",$type=2){ + + $result = R('Common/Sms/verify_sms_code',array($phone,$code,false)); + + if($result['code']==200) { + if($type==1){ + $this->set_message(200,"success","正确"); + }else{ + return true; + } + } else { + switch ($result['code']) { + case 1021:{ + $this->set_message(1010,"fail","验证码已失效,请重新获取"); + };break; + case 1022:{ + $this->set_message(1022,"fail","验证码不正确,请重新输入"); + };break; + default: + $this->set_message($result['code'],"fail",$result['msg']); + } + } + + } } diff --git a/Application/Mobile/View/Ssg/login.html b/Application/Mobile/View/Ssg/login.html index 2beedf15d..3682ab3d5 100644 --- a/Application/Mobile/View/Ssg/login.html +++ b/Application/Mobile/View/Ssg/login.html @@ -145,19 +145,19 @@
- +
- +
获取验证码
-
@@ -187,20 +187,20 @@
- +
- +
- +
-
立即注册
@@ -306,6 +306,45 @@ }) //倒计时 var codeflag = true; + //手机注册按钮 + $("#phonereg").on("click",function(){ + var phone = $('#phoneval').val(); + var phonepassword = $('#phonepassword').val(); + var phonecode = $('#phonecode').val(); + var promoteId = $("#promote_id").val(); + if(!checkPhone(phone)){ + return false; + } + if(phonepassword.length < 6 || phonepassword.length > 15){ + alert('密码长度6-15个字符'); + return false; + } + if(phonecode == ''){ + alert('请输入验证码'); + return false; + } + $.ajax({ + type: 'POST', + url: 'mobile.php?s=/Ssg/phoneRegister.html', + dataType: 'JSON', + data:{ + account:phone, + password:phonepassword, + code:phonecode, + promote_id:promoteId + }, + success: function (result) { + console.log(result) + if (result.return_code == 'fail') { + alert(result.return_msg); + } else { + //成功 + alert("注册并登陆成功"); + window.location.href = "mobile.php?s=/Ssg/index.html" + } + } + }) + }) //获取手机验证码 $("#getPhoneCode").on("click",function(){ //获取手机 @@ -345,6 +384,46 @@ } setTimeout('countDown()',1000); } + //普通注册 + $("#userreg").on("click",function(){ + var account = $('#regaccount').val(); + var regpassword = $('#regpassword').val(); + var regpassword2 = $("#regpassword2").val(); + var promoteId = $("#promote_id").val(); + if(account.length < 6 || account.length > 12){ + alert('账号必须是6-12位字母数字组合'); + return false; + } + if(regpassword.length < 6 || regpassword.length > 15){ + alert('密码长度6-15个字符'); + return false; + } + if(regpassword != regpassword2){ + alert('两次密码不一样'); + return false; + } + $.ajax({ + type: 'POST', + url: 'mobile.php?s=/Ssg/userRegister.html', + dataType: 'JSON', + data:{ + account:account, + password:regpassword, + promote_id:promoteId + }, + success: function (result) { + console.log(result) + if (result.return_code == 'fail') { + alert(result.return_msg); + } else { + //成功 + alert("注册并登陆成功"); + window.location.href = "mobile.php?s=/Ssg/index.html" + } + } + }) + + }) //验证手机 function checkPhone(phone){ if(!(/^1[3456789]\d{9}$/.test(phone))){ diff --git a/Application/Sdk/View/default/Ipa365/pay.html b/Application/Sdk/View/default/Ipa365/pay.html index 2b67afc8b..bfc909cd4 100644 --- a/Application/Sdk/View/default/Ipa365/pay.html +++ b/Application/Sdk/View/default/Ipa365/pay.html @@ -73,8 +73,23 @@ body{
+ +
+
+ +
+ 请确认微信支付是否已完成 +
+ + 已完成支付 + + + 支付遇到问题,重新支付 + +
+
-