From 1c6297f5a81a846e4d8ed333b0f403a805b07e0a Mon Sep 17 00:00:00 2001 From: chenxiaojun <956334972@qq.com> Date: Tue, 1 Oct 2019 02:36:08 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E8=90=BD=E5=9C=B0=E9=A1=B5=E6=9B=B4?= =?UTF-8?q?=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Home/Controller/HomeController.class.php | 8 +- .../Home/View/default/Home/iosDown.html | 2 + .../default/Home/promitionofregestion.html | 86 +++++++++++++- .../Controller/UserController.class.php | 108 +++++++++++++++--- Application/Mobile/View/User/login.html | 33 ++++-- Application/Mobile/View/User/step.html | 4 +- Application/Mobile/View/User/step1.html | 5 +- 7 files changed, 215 insertions(+), 31 deletions(-) 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); From bfb7ce27f42d3556a7e6bb7548a237cf501e8b49 Mon Sep 17 00:00:00 2001 From: ELF <360197197@qq.com> Date: Tue, 1 Oct 2019 02:51:20 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controller/PlistController.class.php | 33 +++++++++++++++++++ Application/Admin/Event/SourceEvent.class.php | 3 ++ Data/update.sql | 3 +- 3 files changed, 38 insertions(+), 1 deletion(-) diff --git a/Application/Admin/Controller/PlistController.class.php b/Application/Admin/Controller/PlistController.class.php index 6b8e0e8d2..ed5f94f07 100644 --- a/Application/Admin/Controller/PlistController.class.php +++ b/Application/Admin/Controller/PlistController.class.php @@ -54,6 +54,39 @@ class PlistController extends ThinkController { } + public function create_org_plist($game_id=0,$promote_id=0,$marking="",$url=""){ + $xml = new \DOMDocument(); + $xml->load('./Uploads/Plist/testdemo.Plist'); + $online = $xml->getElementsByTagName('dict');//查找节点 + $asd=$online->item(1)->getElementsByTagName('string');//第二个节点下所有string + foreach ($asd as $key=>$value) { + switch ($value->textContent) { + case 'ipa_url': + if(preg_match("/Uploads/", $url)){ + $value->nodeValue="https://".$_SERVER['HTTP_HOST'].ltrim($url,".");//"https://iosdemo.vlcms.com/app/MCHSecretary.ipa";//替换xml对应的值 + }else{ + $value->nodeValue=$url; + } + break; + case 'icon': + $value->nodeValue="https://".$_SERVER["HTTP_HOST"].get_cover(get_game_icon_id($game_id),'path');; + break; + case 'com.dell': + $value->nodeValue=$marking; + break; + case '1.0.0': + $value->nodeValue=game_version($game_id); + break; + case 'mchdemo': + $value->nodeValue=get_ios_game_name($game_id); + break; + + } + $xml->save("./Uploads/OrgSourcePlist/$game_id.Plist"); + } + return "./Uploads/OrgSourcePlist/$game_id.Plist"; + } + //生成App plist文件 public function create_plist_app($version="",$app_id=0,$marking="",$url="", $promote_id=0){ diff --git a/Application/Admin/Event/SourceEvent.class.php b/Application/Admin/Event/SourceEvent.class.php index 17f1a5115..1af21ac3f 100644 --- a/Application/Admin/Event/SourceEvent.class.php +++ b/Application/Admin/Event/SourceEvent.class.php @@ -41,6 +41,7 @@ class SourceEvent extends Controller $data['remark'] = json_encode(explode('@@@', $remark)); if ($data['file_type'] == 2) { $data['plist_url'] = "./Uploads/SourcePlist/" . $data['game_id'] . ".Plist"; + $data['org_plist_url'] = "./Uploads/OrgSourcePlist/" . $data['game_id'] . ".Plist"; $plist -> create_plist($data['game_id'], 0, $data['bao_name'], $data['file_url']); } $res = $model -> add($data); @@ -100,6 +101,7 @@ class SourceEvent extends Controller } if ($data['file_type'] == 2) { $data['plist_url'] = "./Uploads/SourcePlist/" . $data['game_id'] . ".Plist"; + $data['org_plist_url'] = "./Uploads/OrgSourcePlist/" . $data['game_id'] . ".Plist"; $plist -> create_plist($data['game_id'], 0, $data['bao_name'], $data['file_url']); } $data['source_version'] = $game_source['source_version'] + 1; @@ -265,6 +267,7 @@ class SourceEvent extends Controller if ($file_type == 2) { $data['plist_url'] = "./Uploads/SourcePlist/" . $data['game_id'] . ".Plist"; $plist -> create_plist($game_id, 0, $baoName, $to); + $plist -> create_org_plist($game_id, 0, $baoName, $originalUrl); } } diff --git a/Data/update.sql b/Data/update.sql index a4d87ab43..3c812eda2 100644 --- a/Data/update.sql +++ b/Data/update.sql @@ -60,4 +60,5 @@ INSERT INTO `tab_promote_quick_menu` VALUES ('16', '1', '10', '1569719877'); INSERT INTO `tab_promote_quick_menu` VALUES ('18', '1', '1', '1569720739'); -- 2019-10-01 -alter table tab_game_source add column `original_url` varchar(255) NOT NULL default '' COMMENT '原包路径'; \ No newline at end of file +alter table tab_game_source add column `original_url` varchar(255) NOT NULL default '' COMMENT '原包路径'; +alter table tab_game_source add column `org_plist_url` varchar(255) NOT NULL default '' COMMENT '原包Plist路径'; \ No newline at end of file