diff --git a/Application/Home/Controller/HomeController.class.php b/Application/Home/Controller/HomeController.class.php index 1274ac153..39af05220 100644 --- a/Application/Home/Controller/HomeController.class.php +++ b/Application/Home/Controller/HomeController.class.php @@ -142,12 +142,18 @@ class HomeController extends Controller { $gameId = I('get.gid'); $promoteId = I('get.pid'); + $status = I('get.status'); if (empty($gameId) || empty($promoteId)) { $this->error('链接丢失'); } - $downLink = get_apply_dow_url($gameId, $promoteId); + if ($status == 1) { + $downLink = 'itms-services://?action=download-manifest&url=' . 'https://' . C('APPLY_DOWN_DOMAIN') . M('Apply', 'tab_')->where(array('promote_id'=>$promoteId,'game_id'=>$gameId))->getField('original_url'); + } else { + $downLink = get_apply_dow_url($gameId, $promoteId); + } + $this->assign('downLink', $downLink); $this->display(); } diff --git a/Application/Home/View/default/Home/iosDown.html b/Application/Home/View/default/Home/iosDown.html index 251cccd29..f236be142 100644 --- a/Application/Home/View/default/Home/iosDown.html +++ b/Application/Home/View/default/Home/iosDown.html @@ -120,6 +120,8 @@ setTimeout(function () { var url = "{$downLink}"; + console.log(url); + return false; window.location.href = url; }, 500); } diff --git a/Application/Home/View/default/Home/promitionofregestion.html b/Application/Home/View/default/Home/promitionofregestion.html index 45b587a42..f1eafe35d 100644 --- a/Application/Home/View/default/Home/promitionofregestion.html +++ b/Application/Home/View/default/Home/promitionofregestion.html @@ -64,6 +64,66 @@ margin-top: 21px; width: 100%; } + + .register-box-max { + width: 80%; + height: 40%; + top: 30%; + left: 10%; + position: fixed; + z-index: 10; + background-color: #fff; + border-radius: 10px; + } + + .register-bg { + width: 100%; + height: inherit; + position: fixed; + background-color: #0a0a0a; + opacity: 0.5; + } + + .register-title-box { + padding: 10px 10px; + margin-top: 10px; + text-align: center; + font-size: 1.2rem; + } + + .register-title-box span { + font-weight: 600; + } + + .register-input-box { + text-align: center; + font-size: 1rem; + } + + .register-input-box input { + width: calc(80% - 5px); + height: 2rem; + padding-left: 5px; + margin-top: 10px; + margin-bottom: 10px; + border: 1px solid #6f6f6f; + border-radius: 3px; + } + + .register-btn-box { + margin-top: 40px; + text-align: center; + } + + .register-btn-box button { + width: 80%; + height: 2.5rem; + border: 0; + border-radius: 5px; + background-color: #1993ff; + color: #fff; + font-size: 1.1rem; + } @@ -73,6 +133,20 @@ + + + + + + + + + + + + + +
-
@@ -136,6 +209,17 @@ } } else { if (is_ios()) { + if (!Boolean(navigator.userAgent.match(/OS [1][3]_[1][_\d]* like Mac OS X/i)) && !parseInt("{:I('get.status')}")) { + if (!parseInt("{:I('get.status')}")) { + layer.confirm('请先到官网注册',{title:''} , function () { + location.href = "/mobile.php?s=/User/login/pid/" + "{:I('get.pid')}" + "/gid/" + "{:I('get.gid')}" + ".html"; + }); + return false; + } else { + location.href = "{:U('iosDown',array('gid'=>$gameId,'pid'=>I('get.pid'),'status'=>1))}"; + } + } + location.href = "{:U('iosDown',array('gid'=>$gameId,'pid'=>I('get.pid')))}"; } else { var downLink = $(this).attr('down-link'); diff --git a/Application/Mobile/Controller/UserController.class.php b/Application/Mobile/Controller/UserController.class.php index 7d0bf98d4..95c4fe063 100644 --- a/Application/Mobile/Controller/UserController.class.php +++ b/Application/Mobile/Controller/UserController.class.php @@ -32,7 +32,6 @@ class UserController extends BaseController { /*是否开启Ucenter*/ if( C('UC_OPEN')==1 ){ - $username = $account; //Ucenter登录 @@ -142,13 +141,57 @@ class UserController extends BaseController { } } - $res = $this->suser->login($account,$password);file_put_contents(dirname(__FILE__) . '/login_res_text.txt',json_encode([$res])); if($res > 0) { - $data=array( - 'status' => 1, - 'msg' => '登录成功', - ); + $promoteId = I('post.promote_id'); + $promoteId = intval($promoteId); + + if ($promoteId > 0) { + $wherePromote['id'] = $promoteId; + $promoteData = M('Promote','tab_')->field('id,account')->where($wherePromote)->find(); + + if (!empty($promoteData)) { + $whereUser['account'] = $account; + $whereUser['_logic'] = 'or'; + $whereUser['mobile_phone'] = $account; + $userData = M('User', 'tab_')->where($whereUser)->find(); + + if (!empty($userData)) { + if (empty($userData['promote_id'])) { + $saveData['promote_id'] = $promoteId; + $saveData['promote_account'] = $promoteData['account']; + + $saveRes = M('User', 'tab_')->where(array('id'=>$userData['id']))->save($saveData); + if ($saveRes) { + $data = array( + 'status' => 2, + 'msg' => '登录成功!绑定成功', + ); + } else { + $data = array( + 'status' => 0, + 'msg' => '登录成功!绑定失败', + ); + } + } + } else { + $data = array( + 'status' => 0, + 'msg' => '登录成功!绑定失败', + ); + } + } else { + $data = array( + 'status' => 0, + 'msg' => '登录成功!绑定失败', + ); + } + } else { + $data=array( + 'status' => 1, + 'msg' => '登录成功', + ); + } } else { switch($res) { case -1000: $error = '账号不存在'; break; @@ -190,9 +233,18 @@ class UserController extends BaseController { if (empty($password)) { echo json_encode(array('status'=>0,'msg'=>'请输入密码'));exit; } - $safeinfo = array('nickname' => $account, 'password' => $password, 'sex' => $sex ,'status' => 1); + + $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); + } session('safeinfo',$safeinfo); $url = U('register'); + echo json_encode(array('status'=>1,'msg'=>$url)); } else{ $this->display(); @@ -275,11 +327,19 @@ class UserController extends BaseController { $pid = $this->suser->register($phone,$password,$phone,$register_way,$register_type,'','',$sex,$nickname,$head_img); } if($pid > 0){ - $data = array( - 'status' => 1, - 'msg' => '注册成功', - 'url' => U('Index/index'), - ); + if (empty($safeinfo['promote_id'])) { + $data = array( + 'status' => 1, + 'msg' => '注册成功', + 'url' => U('Index/index'), + ); + } else { + $data = array( + 'status' => 1, + 'msg' => '注册成功', + 'url' => U('User/login', array('pid' => $safeinfo['promote_id'], 'gid' => $safeinfo['game_id'])), + ); + } session('safeinfo',null); } else{ $data = array( @@ -369,14 +429,28 @@ class UserController extends BaseController { if($is_setting){ echo json_encode(array('status'=>0,'msg'=>'账号已存在'));exit; } + $pid = $this->suser->register($account,$password,'',$register_way,$register_type,'','',$sex,$nickname,$head_img); if($pid > 0){ - $data = array( - 'status' => 1, - 'msg' => '注册成功', - 'url' => U('Index/index'), - ); + $promoteId = I('post.promote_id'); + $promoteId = intval($promoteId); + + if ($promoteId > 0) { + $gameId = intval(I('post.game_id')); + + $data = array( + 'status' => 1, + 'msg' => '注册成功', + 'url' => U('User/login', array('pid' => $promoteId, 'gid' => $gameId)), + ); + } else { + $data = array( + 'status' => 1, + 'msg' => '注册成功', + 'url' => U('Index/index'), + ); + } } else{ $data = array( 'status' => $pid, diff --git a/Application/Mobile/View/User/login.html b/Application/Mobile/View/User/login.html index 08cca3751..3acb4d0fd 100644 --- a/Application/Mobile/View/User/login.html +++ b/Application/Mobile/View/User/login.html @@ -68,7 +68,13 @@
@@ -149,15 +155,17 @@ $('.submit').click(function(event) { var mobile = $.trim($('#mobile').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 (mobile) { if (password) { $.ajax({ type:'POST', url:'{:U("login")}', - data:{'phone':mobile,'password':password}, + data:{'phone':mobile,'password':password,'promote_id':promoteId,'game_id':gameId}, dataType:"Json", success:function(data){ - if(data.status == 1){ + if(data.status == 1 || data.status == 2){ var username = lwx.getItem('username'); if(username) { @@ -172,14 +180,19 @@ lwx.setItem('username',mobile); pmsg.msg(data.msg); - var url = $.trim($('#login_form').attr('data-url')); - setTimeout(function(){ - if (url) { - window.location.href = url; - } else { - window.location.href = "{:U('index')}"; - } - },1500); + var url = $.trim($('#login_form').attr('data-url')); + + setTimeout(function(){ + if (data.status == 2) { + window.location.href = 'http://' + "{:C('APPLY_DOWN_DOMAIN')}" + "/index.php?s=/Home/Home/promitionofregestion/gid/" + gameId + "/pid/" + promoteId + "/status/" + "1" + ".html"; + } else { + if (url) { + window.location.href = url; + } else { + window.location.href = "{:U('index')}"; + } + } + },1500); }else{ pmsg.msg(data.msg); return false; diff --git a/Application/Mobile/View/User/step.html b/Application/Mobile/View/User/step.html index 1addf10ca..f2e61b252 100644 --- a/Application/Mobile/View/User/step.html +++ b/Application/Mobile/View/User/step.html @@ -84,6 +84,8 @@ var mobile = $.trim($('#nickname').val()); var code = $.trim($('#password').val()); var sex = $.trim($('input[name=sex]:checked').val()); + var promoteId = parseInt("{:I('get.pid')}") ? parseInt("{:I('get.pid')}") : 0; + var gameId = parseInt("{:I('get.gid')}") ? parseInt("{:I('get.gid')}") : 0; if(mobile.length == 0 ){ pmsg.msg('昵称不能为空');event.preventDefault(); return false; @@ -105,7 +107,7 @@ $.ajax({ type:'POST', url:'{:U("User/step")}', - data:{'nickname':mobile,'password':code,'sex':sex}, + data:{'nickname':mobile,'password':code,'sex':sex,'promote_id':promoteId,'game_id':gameId}, dataType:"Json", success:function(data){ console.log(data); diff --git a/Application/Mobile/View/User/step1.html b/Application/Mobile/View/User/step1.html index e178a6505..e55f6e88d 100644 --- a/Application/Mobile/View/User/step1.html +++ b/Application/Mobile/View/User/step1.html @@ -90,6 +90,9 @@ var nickname = $.trim($('#nickname').val()) var password = $.trim($('#password').val()); var sex = $.trim($('input[name=sex]:checked').val()); + var promoteId = parseInt("{:I('get.pid')}") ? parseInt("{:I('get.pid')}") : 0; + var gameId = parseInt("{:I('get.gid')}") ? parseInt("{:I('get.gid')}") : 0; + if(account.length == 0 ){ pmsg.msg('账号不能为空');event.preventDefault(); return false; @@ -119,7 +122,7 @@ $.ajax({ type:'POST', url:'{:U("User/step1")}', - data:{'account':account,'nickname':nickname,'password':password,'sex':sex}, + data:{'account':account,'nickname':nickname,'password':password,'sex':sex,'promote_id':promoteId,'game_id':gameId}, dataType:"Json", success:function(data){ pmsg.msg(data.msg);