diff --git a/Application/Home/Common/function.php b/Application/Home/Common/function.php index ff022de84..3285e0afb 100644 --- a/Application/Home/Common/function.php +++ b/Application/Home/Common/function.php @@ -220,6 +220,7 @@ function get_apply_dow_url($game_id = 0, $promote_id = 0) $model = M('Apply', 'tab_'); $map['game_id'] = $game_id; $map['promote_id'] = $promote_id; + $map['offline_status'] = 0; $data = $model->where($map)->find(); if (empty($data['dow_url'])) { $game_address = M('game', 'tab_')->where('id=' . $game_id)->find(); @@ -812,7 +813,7 @@ function hasPromotePermission($parentId, $promoteId) function isParentPromote($parentId, $promoteId) { - $promoteParentId = D('Promote')->where('id', $promoteId)->getField('parent_id'); + $promoteParentId = D('Promote')->where(array('id' => $promoteId))->getField('parent_id'); if ($promoteParentId == $parentId) { return true; @@ -893,8 +894,8 @@ function getAllPromoteIdsByType($promoteIds, $level = 3, $nowLevel = 1) return ''; } -//获取所有子渠道列表 $promoteId-渠道ID $promoteType-1:本账号 2:组长 3:推广员 -function getAllChildPromoteList() +//获取所有子渠道列表 $type 1-返回数组 2-返回id数组 3-返回id字符串 +function getAllChildPromoteList($type = 1) { $childPromoteData = array(); $childPromoteIds = getAllChildPromoteIds((string)PID); @@ -902,7 +903,17 @@ function getAllChildPromoteList() if (!empty($childPromoteIds)) { $map['id'] = ['in', $childPromoteIds]; - $childPromoteData = D('Promote')->where($map)->field('id,account,nickname')->select(); + switch ($type) { + case 1: + $childPromoteData = D('Promote')->where($map)->field('id,account,nickname')->select(); + break; + case 2: + $childPromoteData = D('Promote')->where($map)->getField('id'); + break; + case 3: + $childPromoteData = $childPromoteIds; + break; + } } return $childPromoteData; @@ -980,7 +991,7 @@ function addedAboutDoubleSdk($promoteId, $gameId) $map['tab_game.relation_game_id'] = $gameData['relation_game_id']; if ($promoteData['parent_id'] == 0) { $count = M('Game', 'tab_') - ->join('tab_apply on tab_game.id = tab_apply.game_id and tab_apply.promote_id = ' . $promoteId) + ->join('tab_apply on tab_game.id = tab_apply.game_id and tab_apply.offline_status = 0 and tab_apply.promote_id = ' . $promoteId) ->where($map) ->count(); @@ -988,8 +999,8 @@ function addedAboutDoubleSdk($promoteId, $gameId) } else { $applyData = M('Game', 'tab_') ->field('tab_game.id,ta_2.id as apply_id') - ->join('tab_apply as ta_1 on tab_game.id = ta_1.game_id and ta_1.promote_id = ' . $promoteData['parent_id']) - ->join('left join tab_apply as ta_2 on tab_game.id = ta_2.game_id and ta_2.promote_id = ' . $promoteId) + ->join('tab_apply as ta_1 on tab_game.id = ta_1.game_id and ta_1.offline_status = 0 and ta_1.promote_id = ' . $promoteData['parent_id']) + ->join('left join tab_apply as ta_2 on tab_game.id = ta_2.game_id and ta_2.offline_status = 0 and ta_2.promote_id = ' . $promoteId) ->where($map) ->select(); diff --git a/Application/Home/Controller/ApplyController.class.php b/Application/Home/Controller/ApplyController.class.php index a17e4e2fd..7edce614e 100644 --- a/Application/Home/Controller/ApplyController.class.php +++ b/Application/Home/Controller/ApplyController.class.php @@ -57,10 +57,10 @@ class ApplyController extends BaseController $parentPromoteId = getParentPromoteId($promoteId);//上级渠道ID $thisParentPromoteId = getParentPromoteId(PID);//本账号上级渠道ID - $addPermission = 1;//是否有添加游戏权限 - if ($thisParentPromoteId == 0 && $promoteRole == 3) { - $addPermission = 0; - } +// $addPermission = 1;//是否有添加游戏权限 +// if ($thisParentPromoteId == 0 && $promoteRole == 3) { +// $addPermission = 0; +// } $map['tab_game.online_status'] = 1;//开发者游戏上线状态 $map['tab_game.down_port'] = 1;//游戏端口 第三方接口不能申请 @@ -131,14 +131,14 @@ class ApplyController extends BaseController $map['_complex'] = $where; } - $join = 'inner join tab_apply on tab_game.id = tab_apply.game_id ';//查询上级游戏 + $join = 'inner join tab_apply on tab_game.id = tab_apply.game_id and tab_apply.offline_status = 0';//查询上级游戏 } $data = M('Game', 'tab_') ->field('tab_game.id,tab_game.icon,tab_game.game_name,tab_game.features,tab_game.sdk_version,tab_game.game_size,tab_game.game_type_name,tab_game.relation_game_name,ta_1.id as apply_id_1,ta_2.id as apply_id_2') ->join($join) - ->join('left join tab_apply as ta_1 on tab_game.id = ta_1.game_id and ta_1.promote_id = ' . $promoteId)//查询是否拥有该游戏 - ->join('left join tab_apply as ta_2 on tab_game.relation_game_id = ta_2.game_id and tab_game.id != tab_game.relation_game_id and ta_2.promote_id = ' . $promoteId)//查询是否拥有关联游戏 + ->join('left join tab_apply as ta_1 on tab_game.id = ta_1.game_id and ta_1.offline_status = 0 and ta_1.promote_id = ' . $promoteId)//查询是否拥有该游戏 + ->join('left join tab_apply as ta_2 on tab_game.relation_game_id = ta_2.game_id and ta_2.offline_status = 0 and tab_game.id != tab_game.relation_game_id and ta_2.promote_id = ' . $promoteId)//查询是否拥有关联游戏 ->join('left join tab_game_source on tab_game.id = tab_game_source.game_id')//查询游戏版本 ->where($map) ->group($group) @@ -146,6 +146,9 @@ class ApplyController extends BaseController ->page($page, $row) ->select(); +// var_dump($data); +// die; + /* 查询记录总数 */ $count = M("Game", "tab_") ->field('tab_game.id') @@ -175,7 +178,7 @@ class ApplyController extends BaseController $this->assign('promoteRole', $promoteRole); $this->assign('pID', PID); $this->assign('promoteData', getAllPromoteListByType($promoteRole)); - $this->assign('addPermission', $addPermission); +// $this->assign('addPermission', $addPermission); $this->assign('type', $type); $this->meta_title = "申请游戏"; @@ -479,19 +482,17 @@ class ApplyController extends BaseController } $applyMap['promote_id'] = $promoteId; + $applyMap['offline_status'] = 0; $gameIds = M('Apply', 'tab_')->where($applyMap)->getField('game_id', true); $gameIds = implode(',', $gameIds); - if (!empty($gameIds)) { + if (empty($gameIds)) { + $map['_string'] = '1 = 2'; + } else { $map['tab_game.id'] = ['in', $gameIds]; } $map['tab_apply.promote_id'] = $promoteId; -// if ($type < 0) { -// unset($map['status']); -// } else { -// $map['status'] = $type; -// } if ($_REQUEST['game_id'] != null) { $relationGameName = M('Game', 'tab_')->where(array('id' => $_REQUEST['game_id']))->getField('relation_game_name'); @@ -887,7 +888,7 @@ class ApplyController extends BaseController $gameRelationName = M('game', 'tab_')->where(array('id' => $_POST['game_id']))->getField('relation_game_name'); $gameData = M('game', 'tab_') ->field('tab_game.*') - ->join('tab_apply on tab_game.id = tab_apply.game_id and tab_apply.promote_id = ' . $promoteData['parent_id']) + ->join('tab_apply on tab_game.id = tab_apply.game_id and tab_apply.offline_status = 0 and tab_apply.promote_id = ' . $promoteData['parent_id']) ->where(array('tab_game.relation_game_name' => $gameRelationName)) ->select(); } else { @@ -900,7 +901,7 @@ class ApplyController extends BaseController if ($promoteData['parent_id'] > 0) { $gameData = M('game', 'tab_') ->field('tab_game.*') - ->join('tab_apply on tab_game.id = tab_apply.game_id and tab_apply.promote_id = ' . $promoteData['parent_id']) + ->join('tab_apply on tab_game.id = tab_apply.game_id and tab_apply.offline_status = 0 and tab_apply.promote_id = ' . $promoteData['parent_id']) ->where($gameMap)->select(); } else { $gameData = M('game', 'tab_')->where($gameMap)->select(); @@ -912,11 +913,15 @@ class ApplyController extends BaseController } foreach ($gameData as $list) { - if (C('LAUNCH_SWITCH') == 0) { - $map['promote_id'] = $promoteId; - $map['game_id'] = $list['id']; - $result = M('apply', 'tab_')->where($map)->getField('id'); - if ($result) { + $updateStatus = 0; + + $map['promote_id'] = $promoteId; + $map['game_id'] = $list['id']; + $result = M('apply', 'tab_')->field('id,offline_status')->where($map)->find(); + if (!empty($result)) { + if ($result['offline_status'] == 1) { + $updateStatus = 1; + } else { if ($_POST['sdk_type'] > 0) { continue; } else { @@ -924,22 +929,30 @@ class ApplyController extends BaseController } } } + + $model = new ApplyModel(); //D('Apply'); $ratio = $list['ratio']; $money = $list['money']; - $sdk_version = $list['sdk_version']; - $model = new ApplyModel(); //D('Apply'); - $data['game_id'] = $list['id']; - $data['game_name'] = get_game_name($list['id']); - $data['promote_id'] = $promoteId; - $data['promote_account'] = $promoteData['account']; - $data['apply_time'] = NOW_TIME; - $data['status'] = C('SET_AUTO_PACK'); - $data['sdk_version'] = $sdk_version; $data['ratio'] = $ratio; $data['money'] = $money; - $res = $model->add($data); + $data['promote_account'] = $promoteData['account']; + $data['apply_time'] = NOW_TIME; + $data['offline_status'] = 0; - if ($res) { + if ($updateStatus == 0) { + $sdk_version = $list['sdk_version']; + $data['sdk_version'] = $sdk_version; + $data['game_id'] = $list['id']; + $data['game_name'] = get_game_name($list['id']); + $data['promote_id'] = $promoteId; + $data['status'] = C('SET_AUTO_PACK'); + + $res = $model->add($data); + } else { + $res = $model->where('id = ' . $result['id'])->save($data); + } + + if (($updateStatus == 0 && $res) || ($updateStatus == 1 && $res !== false)) { $thsiAppltId = M('Apply', 'tab_')->where(array('game_id' => $list['id'], 'promote_id' => $promoteId))->getField('id'); $gameSource = M('Game_source', 'tab_')->field('id,source_version')->where(['game_id' => $list['id']])->find(); if (file_exists(get_game_source_file_url($list['id'])) || null == $gameSource) { diff --git a/Application/Home/Controller/HomeController.class.php b/Application/Home/Controller/HomeController.class.php index 8e291b6f2..8e4344851 100644 --- a/Application/Home/Controller/HomeController.class.php +++ b/Application/Home/Controller/HomeController.class.php @@ -96,10 +96,17 @@ class HomeController extends Controller public function promitionofregestion() { - $RelationGameId = M('Game', 'tab_')->where(array('id' => $_GET['gid']))->getField('relation_game_id'); + $gameData = M('Game', 'tab_') + ->field('relation_game_id,sdk_version') + ->where(array('id' => $_GET['gid'])) + ->find(); + + $RelationGameId = $gameData['relation_game_id']; + $gameSdkType = $gameData['sdk_version']; + $map['tab_game.relation_game_id'] = $RelationGameId; $map['ta.promote_id'] = $_GET['pid']; - $data = M('game', 'tab_')->field('tab_game.id,tab_game.sdk_version,tab_game.icon,tab_game.screenshot,tab_game.relation_game_id,tab_game.relation_game_name,ta.enable_status,tab_game.dow_status,tab_game.features,tab_game.flooring_page_imgs')->where($map)->join('tab_apply ta ON ta.game_id = tab_game.id and ta.promote_id=' . $_GET['pid'])->select(); + $data = M('game', 'tab_')->field('tab_game.id,tab_game.sdk_version,tab_game.icon,tab_game.screenshot,tab_game.relation_game_id,tab_game.relation_game_name,ta.enable_status,tab_game.dow_status,tab_game.features,tab_game.flooring_page_imgs')->where($map)->join('tab_apply ta ON ta.game_id = tab_game.id and ta.offline_status = 0 and ta.promote_id=' . $_GET['pid'])->select(); foreach ($data as $key => $value) { if (!empty($value['flooring_page_imgs'])) { @@ -108,6 +115,7 @@ class HomeController extends Controller } $this->assign('data', $data); + $this->assign('gameSdkType', $gameSdkType); $this->display(); } diff --git a/Application/Home/View/default/Apply/index.html b/Application/Home/View/default/Apply/index.html index ce9a1d5e7..b97fa4100 100644 --- a/Application/Home/View/default/Apply/index.html +++ b/Application/Home/View/default/Apply/index.html @@ -268,17 +268,13 @@ 已添加 - - 添加 - + 添加 已添加 - - 添加 - + 添加 diff --git a/Application/Home/View/default/Home/promitionofregestion.html b/Application/Home/View/default/Home/promitionofregestion.html index c178e5a90..390050e72 100644 --- a/Application/Home/View/default/Home/promitionofregestion.html +++ b/Application/Home/View/default/Home/promitionofregestion.html @@ -230,24 +230,18 @@ }); } }); + $(".and_down").click(function () { - if (is_weixin() || is_ios()) { - layer.msg('请使用安卓浏览器下载', { - - time: 2000 //2秒关闭(如果不配置,默认是3秒) - }); - return false; - } + layer.msg('请使用安卓浏览器下载', { + + time: 2000 //2秒关闭(如果不配置,默认是3秒) + }); }); - $(".iso_down").click(function () { - if (is_weixin() || !is_ios()) { - layer.msg('请使用苹果浏览器下载', { - - time: 2000 //2秒关闭(如果不配置,默认是3秒) - }); - return false; - } - + $(".ios_down").click(function () { + layer.msg('请使用苹果浏览器下载', { + + time: 2000 //2秒关闭(如果不配置,默认是3秒) + }); }); function is_weixin() { @@ -279,6 +273,22 @@ } } + function isMobile() { + var userAgentInfo = navigator.userAgent; + + var mobileAgents = [ "Android", "iPhone", "SymbianOS", "Windows Phone", "iPad","iPod"]; + + var mobile_flag = false; + + //根据userAgent判断是否是手机 + for (var v = 0; v < mobileAgents.length; v++) { + if (userAgentInfo.indexOf(mobileAgents[v]) > 0) { + mobile_flag = true; + break; + } + } + } + function getVs() { var isIos = is_ios(); var index = 3; @@ -296,6 +306,16 @@ index = 2; + } else { + if (!isMobile()) { + + $('.js_b').addClass('and_down'); + $('.js_b').removeClass('js_b'); + + $('.js_b').addClass('ios_down'); + $('.js_b').removeClass('js_b'); + + } } }