diff --git a/Application/Admin/Controller/GameController.class.php b/Application/Admin/Controller/GameController.class.php index cf7174101..b45cdcb4e 100644 --- a/Application/Admin/Controller/GameController.class.php +++ b/Application/Admin/Controller/GameController.class.php @@ -180,6 +180,14 @@ class GameController extends ThinkController } else { $_POST['display_site'] = ''; } + + $content = $_POST['content']; + if(!empty($content)) { + $_POST['detail_content'] = $content; + } else { + $_POST['detail_content'] = ''; + } + $pinyin = new \Think\Pinyin(); $num = mb_strlen($_POST['game_name'], 'UTF8'); @@ -288,9 +296,10 @@ class GameController extends ThinkController } else { $_POST['display_site'] = ''; } - + $content = $_POST['content']; $game = D(self::model_name);//M('$this->$model_name','tab_'); $_POST['discount'] == '' ? $_POST['discount'] = 10 : $_POST['discount']; + $_POST['detail_content'] = $content; $res = $game->update(); $id = $res["id"]; $sibling = D("Game")->find($id); diff --git a/Application/Admin/Controller/PromoteController.class.php b/Application/Admin/Controller/PromoteController.class.php index b614a3a2d..c16003a1b 100644 --- a/Application/Admin/Controller/PromoteController.class.php +++ b/Application/Admin/Controller/PromoteController.class.php @@ -193,6 +193,7 @@ unset($_REQUEST['parent_id']); empty(I('post.password')) ? : $data['password'] =I('post.password'); empty(I('post.second_pwd')) ? : $data['second_pwd'] =I('post.second_pwd'); empty(I('post.status')) ? : $data['status'] =I('post.status'); + empty(I('post.child_game_permission')) ? : $data['child_game_permission'] =I('post.child_game_permission'); empty(I('post.mark1')) ? : $data['mark1'] =I('post.mark1'); empty(I('post.mark2')) ? : $data['mark2'] = I('post.mark2'); $data['ba_id'] = I('ba_id'); diff --git a/Application/Admin/View/Game/add.html b/Application/Admin/View/Game/add.html index ddafadddd..a967b6986 100644 --- a/Application/Admin/View/Game/add.html +++ b/Application/Admin/View/Game/add.html @@ -75,6 +75,20 @@ 显示该游戏所适用的平台,一般为安卓平台和苹果平台 + + 混服设置 + + + + + + + + 开放类型 @@ -177,7 +191,19 @@ 游戏详细介绍: - + + + + + 游戏资料中心: + + + + + {:hook('adminArticleEdit', array('name'=>'content','value'=>$field['value']))} + + @@ -1074,7 +1100,7 @@ uploaderImg.on( 'fileQueued', function( file ) { var html = ''; html += '
'; - html += ''; + html += ''; html += '

' + file.name + '

'; html += '

等待上传...

'; html += '
'; @@ -1129,13 +1155,6 @@ return false; }); - if(!response.chunk){ - var url = response.path + "/" +response.name; -// $("#file_name").val(response.name); - $("#file_url").val(url); -// $("#file_size").val(response.size); - } - //alert($("#file_name").val()+";"+$("#file_url").val()+";"+$("#file_size").val()) }); uploaderImg.on('uploadError', function(file) { diff --git a/Application/Admin/View/Game/edit.html b/Application/Admin/View/Game/edit.html index b11b63848..b97ee5d7e 100644 --- a/Application/Admin/View/Game/edit.html +++ b/Application/Admin/View/Game/edit.html @@ -74,6 +74,21 @@ 显示该游戏所适用的平台,一般为安卓平台和苹果平台 + + 混服设置 + + + + + + + 开放类型 @@ -187,6 +202,14 @@ + + + 游戏资料中心: + + + {:hook('adminArticleEdit', array('name'=>'content','value'=>$field['value']))} + + 游戏ICON @@ -1145,7 +1168,7 @@ imgListData.push(); html += '
'; - html += '" style="width: 100px;height: 100px;">'; + html += '" style="width: 100px;height: 100px;cursor: move;">'; html += '

'; html += '删除'; html += '

'; @@ -1163,6 +1186,7 @@ $.each(imgListData,function(index, item) { if (thisId == item) { imgListData.splice(index,1); + return false; } }); @@ -1176,7 +1200,7 @@ uploaderImg.on( 'fileQueued', function( file ) { var html = ''; html += '
'; - html += ''; + html += ''; html += '

' + file.name + '

'; html += '

等待上传...

'; html += '
'; @@ -1225,6 +1249,7 @@ $.each(imgListData,function(index, item) { if (response.id == item) { imgListData.splice(index,1); + return false; } }); setFlooringPageImgsVal(); @@ -1232,13 +1257,6 @@ return false; }); - if(!response.chunk){ - var url = response.path + "/" +response.name; -// $("#file_name").val(response.name); - $("#file_url").val(url); -// $("#file_size").val(response.size); - } - //alert($("#file_name").val()+";"+$("#file_url").val()+";"+$("#file_size").val()) }); uploaderImg.on('uploadError', function(file) { diff --git a/Application/Admin/View/Promote/edit.html b/Application/Admin/View/Promote/edit.html index a6383bec5..1cafd2b15 100644 --- a/Application/Admin/View/Promote/edit.html +++ b/Application/Admin/View/Promote/edit.html @@ -66,6 +66,21 @@ + + + 下级游戏展示: + + + + + + + + 真实姓名: diff --git a/Application/Base/Service/ApplyService.class.php b/Application/Base/Service/ApplyService.class.php index ee93ce635..9d9577554 100644 --- a/Application/Base/Service/ApplyService.class.php +++ b/Application/Base/Service/ApplyService.class.php @@ -17,6 +17,9 @@ class ApplyService { $ids = [$promoteId]; $list = M('promote', 'tab_')->field('id')->where('parent_id=' . $promoteId . ' or grand_id=' . $promoteId)->select(); $ids = array_merge($ids, array_column($list, 'id')); - M('apply', 'tab_')->where(['game_id' => $gameId, 'promote_id' => ['in', $ids]])->delete(); + + $save['offline_status'] = 1; + + M('apply', 'tab_')->where(['game_id' => $gameId, 'promote_id' => ['in', $ids]])->save($save); } } \ No newline at end of file diff --git a/Application/Home/Common/function.php b/Application/Home/Common/function.php index 11fb95b30..1bf7886f3 100644 --- a/Application/Home/Common/function.php +++ b/Application/Home/Common/function.php @@ -965,6 +965,14 @@ function getParentPromoteId($promoteId) return D('Promote')->where($map)->getField('parent_id'); } +//获会长渠道ID +function getGrandPromoteId($promoteId) +{ + $map['id'] = $promoteId; + + return D('Promote')->where($map)->getField('grand_id'); +} + function getGamePermission($gameId) { $gameData = M('Game', 'tab_') @@ -1170,4 +1178,10 @@ function promoteCan($promoteId, \Closure $callback) { $level = get_promote_level(session('promote_auth.pid')); return $callback($level); +} + +//获取下级游戏添加权限 +function getChildGameAddPermission($promoteId) +{ + return D('Promote')->where(array('id' => $promoteId))->getField('child_game_permission'); } \ No newline at end of file diff --git a/Application/Home/Controller/ApplyController.class.php b/Application/Home/Controller/ApplyController.class.php index 156950d71..af71bff50 100644 --- a/Application/Home/Controller/ApplyController.class.php +++ b/Application/Home/Controller/ApplyController.class.php @@ -49,22 +49,31 @@ class ApplyController extends BaseController $this->display($model['tem_list']); } + public function gameSpecialList() + { + $this->index(1); + } + + public function gameList() + { + $this->index(2); + } + //首页 $type-查询的游戏平台类型 0-全部 10-安卓+ios 2-ios 1-安卓 - public function index($p = 0, $type = 0) + public function index($serverType = 1) { $promoteId = empty(I('promote_id')) ? PID : I('promote_id');//搜索的渠道ID $promoteRole = empty(I('promote_role')) ? 1 : I('promote_role');//渠道角色 $parentPromoteId = getParentPromoteId($promoteId);//上级渠道ID + $grandPromoteId = getGrandPromoteId($promoteId); + $grandPromoteId = empty($grandPromoteId) ? $parentPromoteId : $grandPromoteId;//本账号会长渠道ID + $childGameAddPermission = getChildGameAddPermission($grandPromoteId);//游戏添加权限 $thisParentPromoteId = getParentPromoteId(PID);//本账号上级渠道ID -// $addPermission = 1;//是否有添加游戏权限 -// if ($thisParentPromoteId == 0 && $promoteRole == 3) { -// $addPermission = 0; -// } - $map['tab_game.online_status'] = 1;//开发者游戏上线状态 $map['tab_game.down_port'] = 1;//游戏端口 第三方接口不能申请 $map['tab_game.game_status'] = 1;//游戏状态 + $map['tab_game.server_type'] = $serverType;//专服游戏 if (!empty(I('game_id'))) { $thisRelationGameName = M('Game', 'tab_')->where(array('id' => I('game_id')))->getField('relation_game_name'); @@ -72,6 +81,7 @@ class ApplyController extends BaseController $map['tab_game.relation_game_name'] = ['like', $thisRelationGameName]; } + $type = I('get.type', 0); $group = ''; switch ($type) { case 1: @@ -91,7 +101,7 @@ class ApplyController extends BaseController case 10: $group = 'tab_game.relation_game_id'; - if ($parentPromoteId > 0) { + if ($parentPromoteId > 0 && $childGameAddPermission == 0) { $gameRelationGameIdList = M('Game', 'tab_')->group('relation_game_id')->having('count(id) = 2')->getField('relation_game_id', true); if (count($gameRelationGameIdList) > 0) { $gameRelationGameIdList = implode(',', $gameRelationGameIdList); @@ -114,7 +124,7 @@ class ApplyController extends BaseController break; } - $page = intval($p); + $page = intval(I('get.p', 0)); $page = $page ? $page : 1; //默认显示第一页数据 if (isset($_REQUEST['row'])) { @@ -124,14 +134,14 @@ class ApplyController extends BaseController } $join = ''; - if ($parentPromoteId > 0) { - $map['tab_apply.promote_id'] = PID; + if ($parentPromoteId > 0 && $childGameAddPermission == 0) { + $map['tab_apply.promote_id'] = $grandPromoteId; if (!empty($where)) { $map['_logic'] = 'and'; $map['_complex'] = $where; } - $join = 'inner join tab_apply on tab_game.id = tab_apply.game_id and tab_apply.offline_status = 0';//查询上级游戏 + $join = 'tab_apply on tab_game.id = tab_apply.game_id and tab_apply.offline_status = 0';//查询上级游戏 } $data = M('Game', 'tab_') @@ -143,6 +153,7 @@ class ApplyController extends BaseController ->where($map) ->group($group) ->order('tab_game.sort desc,tab_game.id desc') +// ->fetchSql(true) ->page($page, $row) ->select(); @@ -178,8 +189,107 @@ class ApplyController extends BaseController $this->assign('promoteRole', $promoteRole); $this->assign('pID', PID); $this->assign('promoteData', getAllPromoteListByType($promoteRole)); -// $this->assign('addPermission', $addPermission); $this->assign('type', $type); + $this->assign('myGame', ($serverType == 1) ? 'specialMyGameList' : 'myGameList'); + $this->assign('game', ($serverType == 1) ? 'gameSpecialList' : 'gameList'); + $this->assign('position', ($serverType == 1) ? '专服管理' : '混服管理'); + $this->meta_title = "申请游戏"; + $this->display('index'); + } + + //查看游戏资料专区 + public function feature($p = 0, $type = 0) + { + $promoteId = empty(I('promote_id')) ? PID : I('promote_id');//搜索的渠道ID + $promoteRole = empty(I('promote_role')) ? 1 : I('promote_role');//渠道角色 + //$parentPromoteId = getParentPromoteId($promoteId);//上级渠道ID + $thisParentPromoteId = getParentPromoteId(PID);//本账号上级渠道ID + +// $addPermission = 1;//是否有添加游戏权限 +// if ($thisParentPromoteId == 0 && $promoteRole == 3) { +// $addPermission = 0; +// } + + $map['tab_game.online_status'] = 1;//开发者游戏上线状态 + $map['tab_game.down_port'] = 1;//游戏端口 第三方接口不能申请 + $map['tab_game.game_status'] = 1;//游戏状态 + $map['tab_game.developers'] = 0; //平台游戏(官网游戏,非开发者游戏) + + $applyPromote = M('apply','tab_')->field('game_id')->where(['promote_id' => $promoteId])->select(); + $noDeveloperGameArr = array(); + + foreach ($applyPromote as $key => $value) { + $applyPromoteGameId = $value['game_id']; + $gameInfo = M('Game','tab_') + ->field('id,icon,game_name,features,sdk_version,game_size,game_type_name,relation_game_name,developers') + ->where(['id' => $applyPromoteGameId])->select(); + if($gameInfo[0]['developers'] > 0){ + unset($gameInfo[0]['developers']); + $noDeveloperGameArr[] = $gameInfo[0]['id'] ; //非开发者游戏 + } + } + + + $page = intval($p); + $page = $page ? $page : 1; //默认显示第一页数据 + + if (isset($_REQUEST['row'])) { + $row = $_REQUEST['row']; + } else { + $row = 10; + } + $map['_logic'] = 'and'; + if (!empty(I('game_id'))) { + $thisRelationGameName = M('Game', 'tab_')->where(array('id' => I('game_id')))->getField('relation_game_name'); + + $map['tab_game.relation_game_name'] = ['like', $thisRelationGameName]; + $where['_complex'] = $map; + // $where['tab_game.id'] = ['in',$noDeveloperGameArr]; + // $where['_logic']='or'; + }else { + $where['_complex'] = $map; + $where['tab_game.id'] = ['in',$noDeveloperGameArr]; + $where['_logic']='or'; + } + + $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') + ->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)//查询是否拥有该游戏 + ->where($where) + ->order('tab_game.developers desc,tab_game.sort desc,tab_game.id desc') + ->page($page, $row) + ->select(); + //$AllData = array_merge($noDeveloperGameArr,$data); + + /* 查询记录总数 */ + $count = M("Game", "tab_") + ->field('tab_game.id') + ->where($map) + ->select(); + $count = count($count); + + //分页 + $parameter['p'] = I('get.p', 1); + $parameter['row'] = I('get.row'); + $parameter['type'] = $type; + $parameter['promote_role'] = $promoteRole; + empty(I('promote_id')) || $parameter['promote_id'] = I('promote_id'); + + $page = set_pagination($count, $row, $parameter); + if ($page) { + $this->assign('_page', $page); + } + + $this->assign('list_data', $data); + $this->assign("count", $count); + $this->assign("promoteId", $promoteId); + // $this->assign('parentPromoteId', $parentPromoteId); + $this->assign('thisParentPromoteId', $thisParentPromoteId); + // $this->assign('promoteRole', $promoteRole); + $this->assign('pID', PID); + //$this->assign('promoteData', getAllPromoteListByType($promoteRole)); +// $this->assign('addPermission', $addPermission); + // $this->assign('type', $type); $this->meta_title = "申请游戏"; @@ -471,8 +581,17 @@ class ApplyController extends BaseController } + public function specialMyGameList() + { + $this->my_game(1); + } + + public function myGameList() + { + $this->my_game(2); + } - public function my_game($type = -1, $p = 0) + public function my_game($serverType = 1) { //渠道可申请游戏 if (empty($_REQUEST['promote_id'])) { @@ -493,6 +612,10 @@ class ApplyController extends BaseController } $map['tab_apply.promote_id'] = $promoteId; + $map['tab_game.online_status'] = 1;//开发者游戏上线状态 + $map['tab_game.down_port'] = 1;//游戏端口 第三方接口不能申请 + $map['tab_game.game_status'] = 1;//游戏状态 + $map['tab_game.server_type'] = $serverType;//游戏服务器类型 if ($_REQUEST['game_id'] != null) { $relationGameName = M('Game', 'tab_')->where(array('id' => $_REQUEST['game_id']))->getField('relation_game_name'); @@ -508,7 +631,7 @@ class ApplyController extends BaseController // $map['tab_apply.status'] = 1; // $map['tab_game.game_status'] = 1;//游戏状态 // empty(I('sdk_version')) || $map['tab_game.sdk_version'] = I('sdk_version'); - $page = intval($p); + $page = intval(I('get.p', 0)); $page = $page ? $page : 1; //默认显示第一页数据 if (isset($_REQUEST['row'])) { @@ -561,7 +684,6 @@ class ApplyController extends BaseController $this->assign("url", $url); $this->assign("count", $count); $this->assign("row", $row); - $this->assign('model', $model); $this->assign('promoteId', $promoteId); $this->assign('thisParentPromoteId', getParentPromoteId(PID)); $this->assign('parentPromoteId', getParentPromoteId($promoteId)); @@ -569,8 +691,12 @@ class ApplyController extends BaseController $this->assign('promoteRole', $promoteRole); $this->assign('promoteData', getAllPromoteListByType($promoteRole)); $this->assign('list_data', $data); + $this->assign('serverType', $serverType); + $this->assign('myGame', ($serverType == 1) ? 'specialMyGameList' : 'myGameList'); + $this->assign('game', ($serverType == 1) ? 'gameSpecialList' : 'gameList'); + $this->assign('position', ($serverType == 1) ? '专服管理' : '混服管理'); $this->meta_title = "我的游戏"; - $this->display(); + $this->display('my_game'); } @@ -883,13 +1009,16 @@ class ApplyController extends BaseController } $promoteData = D('Promote')->where(array('id' => $promoteId))->find(); + $grandPromoteId = getGrandPromoteId($promoteId); + $grandPromoteId = empty($grandPromoteId) ? $promoteData['parent_id'] : $grandPromoteId;//本账号会长渠道ID + $childGameAddPermission = getChildGameAddPermission($grandPromoteId);//游戏添加权限 if ($_POST['sdk_type'] > 0) { - if ($promoteData['parent_id'] > 0) { + if ($promoteData['parent_id'] > 0 && $childGameAddPermission == 0) { $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.offline_status = 0 and tab_apply.promote_id = ' . PID) + ->join('tab_apply on tab_game.id = tab_apply.game_id and tab_apply.offline_status = 0 and tab_apply.promote_id = ' . $grandPromoteId) ->where(array('tab_game.relation_game_name' => $gameRelationName)) ->select(); } else { @@ -899,10 +1028,10 @@ class ApplyController extends BaseController ->select(); } } else { - if ($promoteData['parent_id'] > 0) { + if ($promoteData['parent_id'] > 0 && $childGameAddPermission == 0) { $gameData = M('game', 'tab_') ->field('tab_game.*') - ->join('tab_apply on tab_game.id = tab_apply.game_id and tab_apply.offline_status = 0 and tab_apply.promote_id = ' . PID) + ->join('tab_apply on tab_game.id = tab_apply.game_id and tab_apply.offline_status = 0 and tab_apply.promote_id = ' . $grandPromoteId) ->where($gameMap)->select(); } else { $gameData = M('game', 'tab_')->where($gameMap)->select(); @@ -956,12 +1085,12 @@ class ApplyController extends BaseController 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) { - M('apply', 'tab_')->where(['id' => $thsiAppltId])->setField(['enable_status' => 2, 'pack_url' => '', 'plist_url' => '']); - M('apply_launch', 'tab_')->where(['apply_id' => $thsiAppltId])->setField('launch_packge', 0); - } else { + if (!file_exists(get_game_source_file_url($list['id'])) || null == $gameSource) { M('apply', 'tab_')->where(['id' => $thsiAppltId])->setField('enable_status', -1); M('apply_launch', 'tab_')->where(['apply_id' => $thsiAppltId])->setField('launch_packge', -1); + } else { + M('apply', 'tab_')->where(['id' => $thsiAppltId])->setField(['enable_status' => 2, 'pack_url' => '', 'plist_url' => '']); + M('apply_launch', 'tab_')->where(['apply_id' => $thsiAppltId])->setField('launch_packge', 0); } } else { $this->ajaxReturn(array("status" => 0, "msg" => "申请失败", 'ret' => $res)); @@ -1571,4 +1700,25 @@ class ApplyController extends BaseController $this->ajaxReturn(['status' => 1, 'data' => $enableStatus]); } + + public function backDetailData() { //返回详情数据 + $result = ['code' => 10001,'msg' => "该游戏信息不存在,请确认!",'error' => 1,'info' => '']; + $id = $_POST['id']; + if(empty($id)) { + $this->ajaxReturn($result); + } + $gameInfo = M('Game','tab_')->where(['id' => $id])->getField('detail_content'); + if(!$gameInfo) { + $this->ajaxReturn($result); + }else { + $result['code'] = 10000; + $result['msg'] = "获取信息成功"; + $result['error'] = -1; + $result['info'] = $gameInfo; + $this->ajaxReturn($result); + + } + + + } } diff --git a/Application/Home/Controller/GameDivideController.class.php b/Application/Home/Controller/GameDivideController.class.php new file mode 100644 index 000000000..6db691700 --- /dev/null +++ b/Application/Home/Controller/GameDivideController.class.php @@ -0,0 +1,105 @@ + 0) { + $this->error('权限异常'); + } + + $securityCode = empty(session('game_divide_second_pwd')) ? '' : session('game_divide_second_pwd');//安全密码 + $model = new PromoteApi(); + $res = $model->verify_er_User(PID, $securityCode);//验证安全密码 + if ($res) { + $map['tab_game.online_status'] = 1;//开发者游戏上线状态 + $map['tab_game.down_port'] = 1;//游戏端口 第三方接口不能申请 + $map['tab_game.game_status'] = 1;//游戏状态 + empty(I('relation_game_id')) || $map['relation_game_id'] = I('relation_game_id'); + empty(I('sdk_version')) || $map['sdk_version'] = I('sdk_version'); + empty(I('server_type')) || $map['server_type'] = I('server_type'); + + $minRatio = floatval(I('min_ratio', 0)); + $maxRatio = floatval(I('max_ratio', 0)); + if (!empty($minRatio) && empty($maxRatio)) { + $map['ratio'] = ['egt', $minRatio]; + } elseif (empty($minRatio) && !empty($maxRatio)) { + $map['ratio'] = ['elt', $maxRatio]; + } elseif (!empty($minRatio) && !empty($maxRatio)) { + $map['ratio'] = ['between', [$minRatio, $maxRatio]]; + } + + $page = intval(I('get.p', 0)); + $page = $page ? $page : 1; //默认显示第一页数据 + + if (isset($_REQUEST['row'])) { + $row = $_REQUEST['row']; + } else { + $row = 10; + } + + $data = M('Game', 'tab_') + ->field('id,icon,game_name,game_type_name,sdk_version,server_type,discount,ratio') + ->where($map) + ->order('sort desc') + ->page($page, $row) + ->select(); + $count = M('Game', 'tab_') + ->where($map) + ->count(); + + //分页 + $parameter['p'] = I('get.p', 1); + $parameter['row'] = I('get.row'); + empty(I('relation_game_id')) || $parameter['relation_game_id'] = I('relation_game_id'); + empty(I('sdk_version')) || $parameter['sdk_version'] = I('sdk_version'); + empty(I('server_type')) || $parameter['server_type'] = I('server_type'); + empty($minRatio) || $parameter['min_ratio'] = $minRatio; + empty($maxRatio) || $parameter['max_ratio'] = $maxRatio; + + $page = set_pagination($count, $row, $parameter); + if ($page) { + $this->assign('_page', $page); + } + + $this->assign('dataList', $data); + $this->assign('count', $count); + $this->assign('serverType', I('server_type', 0)); + } + + $this->meta_title = "分成比例"; + $this->display(); + } + + //验证安全密码 + public function verifyPassword() + { + $password = I('post.password'); + $model = new PromoteApi(); + $res = $model->verify_er_User(PID, $password); + + if ($res) { + session('game_divide_second_pwd', $password); + + $data['status'] = 1; + $data['msg'] = '验证成功'; + } else { + $data['status'] = 0; + $data['msg'] = '安全密码不正确'; + } + + $this->ajaxReturn($data); + } +} \ No newline at end of file diff --git a/Application/Home/Controller/PromoteCoinController.class.php b/Application/Home/Controller/PromoteCoinController.class.php index 247e98e21..5a0fedb93 100644 --- a/Application/Home/Controller/PromoteCoinController.class.php +++ b/Application/Home/Controller/PromoteCoinController.class.php @@ -90,6 +90,7 @@ class PromoteCoinController extends BaseController $this->assign('data', $data); $this->assign('count', $count); + $this->meta_title = '我的平台币'; $this->display(); } @@ -198,6 +199,7 @@ class PromoteCoinController extends BaseController $this->assign('count', $count); $this->assign('gameId', I('get.game_id')); $this->assign('setDate', date("Y-m-d")); + $this->meta_title = '交易明细'; $this->display(); } @@ -258,6 +260,7 @@ class PromoteCoinController extends BaseController } $this->assign('data', $data); + $this->meta_title = '查看明细'; $this->display(); } diff --git a/Application/Home/Controller/PromoteController.class.php b/Application/Home/Controller/PromoteController.class.php index 95934e419..86764e041 100644 --- a/Application/Home/Controller/PromoteController.class.php +++ b/Application/Home/Controller/PromoteController.class.php @@ -33,7 +33,7 @@ use Base\Service\ApplyService; class PromoteController extends BaseController { //系统首页 - public function index($p=1) + public function index($p = 1) { $this->meta_title = "首页"; $this->display('prepare'); @@ -45,24 +45,24 @@ class PromoteController extends BaseController $this->redirect("Home/Index/index"); } - $quick_menu_list = M("quick_menu qmn","tab_") - ->join("tab_promote_quick_menu as pqmn on qmn.id=pqmn.quick_menu_id and promote_id=".get_pid()) + $quick_menu_list = M("quick_menu qmn", "tab_") + ->join("tab_promote_quick_menu as pqmn on qmn.id=pqmn.quick_menu_id and promote_id=" . get_pid()) ->field("qmn.*") ->where("qmn.status=0") ->order("create_time desc") ->limit("0,10") ->select(); - $game_list = M("game","tab_")->field("id,game_name")->order("id desc")->select(); - $gg_list = M("document","sys_")->limit('0,5')->where("category_id=56 and status=1")->order("update_time desc")->select(); //游戏公告 - $zx_list = M("document","sys_")->limit('0,5')->where("category_id=51 and status=1")->order("update_time desc")->select(); //游戏咨询 + $game_list = M("game", "tab_")->field("id,game_name")->order("id desc")->select(); + $gg_list = M("document", "sys_")->limit('0,5')->where("category_id=56 and status=1")->order("update_time desc")->select(); //游戏公告 + $zx_list = M("document", "sys_")->limit('0,5')->where("category_id=51 and status=1")->order("update_time desc")->select(); //游戏咨询 $xx_list = null; $today_start = mktime(0, 0, 0, date('m'), date('d'), date('Y')); $today_end = mktime(0, 0, 0, date('m'), date('d') + 1, date('Y')) - 1; - $today_open_server_list = M("server as sv","tab_")->where( - array("sv.start_time"=>array("BETWEEN", array($today_start, $today_end)), - "sv.show_status"=>1)) + $today_open_server_list = M("server as sv", "tab_")->where( + array("sv.start_time" => array("BETWEEN", array($today_start, $today_end)), + "sv.show_status" => 1)) ->join("left join tab_game gm on gm.id=sv.game_id") ->field('sv.*,gm.icon') ->order("sv.start_time desc") @@ -71,51 +71,51 @@ class PromoteController extends BaseController $count = M("server", "tab_") ->where( - array("start_time"=>array("BETWEEN", array($today_start, $today_end)), - "show_status"=>1)) + array("start_time" => array("BETWEEN", array($today_start, $today_end)), + "show_status" => 1)) ->count(); - $page = $this->ajax_page($count,20,'seach'); - $this->assign("_page",$page); + $page = $this->ajax_page($count, 20, 'seach'); + $this->assign("_page", $page); - $user_count = M("user","tab_")->where("promote_id=".get_pid())->count(); - $total_money = $this->pay_total(0,0); + $user_count = M("user", "tab_")->where("promote_id=" . get_pid())->count(); + $total_money = $this->pay_total(0, 0); $today_add_user_money = $this->pay_total(1); $month_add_user_money = $this->pay_total(3); $yesterday_start = mktime(0, 0, 0, date('m'), date('d') - 1, date('Y')); $yesterday_end = mktime(0, 0, 0, date('m'), date('d'), date('Y')); - $yesterday_user_regist_count = M("user","tab_")->where( - array("promote_id"=>get_pid(), - "register_time"=>array("BETWEEN", array($yesterday_start, $yesterday_end)))) + $yesterday_user_regist_count = M("user", "tab_")->where( + array("promote_id" => get_pid(), + "register_time" => array("BETWEEN", array($yesterday_start, $yesterday_end)))) ->count(); - $yesterday_total_money = $this->pay_total(5,0); - $yesterday_regist_user_count = M("user","tab_") - ->where(array("promote_id"=>get_pid(), - "register_time"=>array("BETWEEN", array($yesterday_start, $yesterday_end)))) + $yesterday_total_money = $this->pay_total(5, 0); + $yesterday_regist_user_count = M("user", "tab_") + ->where(array("promote_id" => get_pid(), + "register_time" => array("BETWEEN", array($yesterday_start, $yesterday_end)))) ->count(); - $yesterday_total_money = $this->pay_total(1,0); - $this->assign("user_count",$user_count); + $yesterday_total_money = $this->pay_total(1, 0); + $this->assign("user_count", $user_count); $this->assign("total_money", $total_money); $this->assign("today_add_user_money", $today_add_user_money); $this->assign("month_add_user_money", $month_add_user_money); - $this->assign("yesterday_user_regist_count",$yesterday_user_regist_count); - $this->assign("yesterday_total_money",$yesterday_total_money); - $this->assign("yesterday_regist_user_count",$yesterday_regist_user_count); - $this->assign("yesterday_total_money",$yesterday_total_money); + $this->assign("yesterday_user_regist_count", $yesterday_user_regist_count); + $this->assign("yesterday_total_money", $yesterday_total_money); + $this->assign("yesterday_regist_user_count", $yesterday_regist_user_count); + $this->assign("yesterday_total_money", $yesterday_total_money); $this->assign("menu_list", $quick_menu_list); $this->assign("gg_list", $gg_list); $this->assign("zx_list", $zx_list); $this->assign("xx_list", $xx_list); $this->assign("today_open_server_list", $today_open_server_list); - $this->assign("game_list",$game_list); + $this->assign("game_list", $game_list); $this->meta_title = "首页"; $this->display(); } - private function pay_total($type=0,$newadd=1) + private function pay_total($type = 0, $newadd = 1) { if ($_REQUEST['promote_id'] === null || $_REQUEST['promote_id'] === '0') { $map['parent_id'] = get_pid(); @@ -133,49 +133,56 @@ class PromoteController extends BaseController $where['spend.pay_status'] = 1; $where['spend.is_check'] = array('NEQ', 2); switch ($type) { - case 1: { // 今天 - $start = mktime(0, 0, 0, date('m'), date('d'), date('Y')); - $end = mktime(0, 0, 0, date('m'), date('d') + 1, date('Y')) - 1; - }; + case 1: + { // 今天 + $start = mktime(0, 0, 0, date('m'), date('d'), date('Y')); + $end = mktime(0, 0, 0, date('m'), date('d') + 1, date('Y')) - 1; + }; + break; + case 3: + { + // 本月 + $start = mktime(0, 0, 0, date('m'), 1, date('Y')); + $end = mktime(0, 0, 0, date('m') + 1, 1, date('Y')) - 1; + }; break; - case 3: { - // 本月 - $start = mktime(0, 0, 0, date('m'), 1, date('Y')); - $end = mktime(0, 0, 0, date('m') + 1, 1, date('Y')) - 1; - }; + case 4: + { + // 本年 + $start = mktime(0, 0, 0, 1, 1, date('Y')); + $end = mktime(0, 0, 0, 1, 1, date('Y') + 1) - 1; + }; break; - case 4: { - // 本年 - $start = mktime(0, 0, 0, 1, 1, date('Y')); - $end = mktime(0, 0, 0, 1, 1, date('Y') + 1) - 1; - }; + case 5: + { // 昨天 + $start = mktime(0, 0, 0, date('m'), date('d') - 1, date('Y')); + $end = mktime(0, 0, 0, date('m'), date('d'), date('Y')); + }; break; - case 5: { // 昨天 - $start = mktime(0, 0, 0, date('m'), date('d') - 1, date('Y')); - $end = mktime(0, 0, 0, date('m'), date('d'), date('Y')); - }; + case 6: + { + $start = mktime(0, 0, 0, date('m') - 1, 1, date('Y')); + $end = mktime(0, 0, 0, date('m'), 1, date('Y')) - 1; + }; break; - case 6:{ - $start = mktime(0,0,0,date('m')-1,1,date('Y')); - $end = mktime(0,0,0,date('m'),1,date('Y'))-1; - };break; - case 9: { // 前七天 - $start = mktime(0, 0, 0, date('m'), date('d') - 6, date('Y')); - $end = mktime(date('H'), date('m'), date('s'), date('m'), date('d'), date('Y')); - }; + case 9: + { // 前七天 + $start = mktime(0, 0, 0, date('m'), date('d') - 6, date('Y')); + $end = mktime(date('H'), date('m'), date('s'), date('m'), date('d'), date('Y')); + }; break; default: ; } if (isset($start) && isset($end)) { $where['spend.pay_time'] = array("BETWEEN", array($start, $end)); - if($newadd==1){ + if ($newadd == 1) { $where['user.register_time'] = array("BETWEEN", array($start, $end)); } } - if($newadd==1){ + if ($newadd == 1) { $total = M('spend as spend', "tab_")->field("SUM(spend.pay_amount) as amount")->join("right join tab_user user on user.id=spend.user_id")->where($where)->select(); - }else{ + } else { $total = M('spend as spend', "tab_")->field("SUM(spend.pay_amount) as amount")->where($where)->select(); } @@ -203,27 +210,28 @@ class PromoteController extends BaseController } - public function home_read_data(){ - $type = I("type","0"); + public function home_read_data() + { + $type = I("type", "0"); $game_id = I("game_id"); - $pg = I("page","0"); + $pg = I("page", "0"); $today_start = mktime(0, 0, 0, date('m'), date('d'), date('Y')); $today_end = mktime(0, 0, 0, date('m'), date('d') + 1, date('Y')) - 1; - if($game_id){ + if ($game_id) { $map['sv.game_id'] = $game_id; - $count_map['game_id']= $game_id; + $count_map['game_id'] = $game_id; } - if($type>0){ - $map['sv.start_time']=array("GT", $today_end); - $count_map['start_time']= array("GT", $today_end); - }else{ - $map['sv.start_time']=array("BETWEEN", array($today_start, $today_end)); - $count_map['start_time']= array("BETWEEN", array($today_start, $today_end)); + if ($type > 0) { + $map['sv.start_time'] = array("GT", $today_end); + $count_map['start_time'] = array("GT", $today_end); + } else { + $map['sv.start_time'] = array("BETWEEN", array($today_start, $today_end)); + $count_map['start_time'] = array("BETWEEN", array($today_start, $today_end)); } $map['sv.show_status'] = 1; $count_map['show_status'] = 1; - $open_server_list = M("server as sv","tab_")->where($map) + $open_server_list = M("server as sv", "tab_")->where($map) ->join("left join tab_game gm on gm.id=sv.game_id") ->field('sv.*,gm.icon') ->order("sv.start_time desc") @@ -234,81 +242,84 @@ class PromoteController extends BaseController ->where($count_map) ->count(); //var_dump($count); - $page = $this->ajax_page($count,20,'seach',$pg); + $page = $this->ajax_page($count, 20, 'seach', $pg); //$this->assign("_page",$page); //$count = M("server", "tab_")->where($map)->count(); - foreach ($open_server_list as $key => $server){ - $open_server_list[$key]['icon']=get_cover($server['icon'],'path'); - if($server['pay_type']==1){ - $open_server_list[$key]['pay_type']='安卓'; - }elseif ($server['pay_type']==1){ - $open_server_list[$key]['pay_type']='iOS'; - }else{ - $open_server_list[$key]['pay_type']='安卓、iOS'; + foreach ($open_server_list as $key => $server) { + $open_server_list[$key]['icon'] = get_cover($server['icon'], 'path'); + if ($server['pay_type'] == 1) { + $open_server_list[$key]['pay_type'] = '安卓'; + } elseif ($server['pay_type'] == 1) { + $open_server_list[$key]['pay_type'] = 'iOS'; + } else { + $open_server_list[$key]['pay_type'] = '安卓、iOS'; } $open_server_list[$key]['pay_type']; - $open_server_list[$key]['start_time'] = date('Y-m-s h:i',$server['start_time']); + $open_server_list[$key]['start_time'] = date('Y-m-s h:i', $server['start_time']); } //$content = $this->fetch('Promote/home_read_data'); - $this->ajaxReturn(['status'=>1,'info'=>'调用成功','data'=>$open_server_list,'_page'=>$page],"JSON"); + $this->ajaxReturn(['status' => 1, 'info' => '调用成功', 'data' => $open_server_list, '_page' => $page], "JSON"); } - public function quick_menu_list(){ - $data_list = M("quick_menu qmn","tab_") - ->join("left join tab_promote_quick_menu as pqmn on qmn.id=pqmn.quick_menu_id and promote_id=".get_pid()) + public function quick_menu_list() + { + $data_list = M("quick_menu qmn", "tab_") + ->join("left join tab_promote_quick_menu as pqmn on qmn.id=pqmn.quick_menu_id and promote_id=" . get_pid()) ->field("qmn.*,pqmn.id as exist_id") ->where("qmn.status=0") ->order("qmn.id asc") ->select(); - $this->assign("data_list",$data_list); + $this->assign("data_list", $data_list); $this->meta_title = "快捷菜单"; $this->display(); } - public function quick_menu_set(){ + public function quick_menu_set() + { $menu_id = I("menu_id"); - $info = M("promote_quick_menu ","tab_") + $info = M("promote_quick_menu ", "tab_") ->where( - array("quick_menu_id"=>$menu_id, - "promote_id"=>get_pid()) + array("quick_menu_id" => $menu_id, + "promote_id" => get_pid()) ) ->find(); - if($info){ - M("promote_quick_menu ","tab_")->where( - array("quick_menu_id"=>$menu_id, - "promote_id"=>get_pid()) + if ($info) { + M("promote_quick_menu ", "tab_")->where( + array("quick_menu_id" => $menu_id, + "promote_id" => get_pid()) )->delete(); - $this->ajaxReturn(['status'=>1,'info'=>'移除成功'],"JSON"); - }else{ - M("promote_quick_menu ","tab_")->add( - array("quick_menu_id"=>$menu_id, - "promote_id"=>get_pid(), - "create_time"=>time()) + $this->ajaxReturn(['status' => 1, 'info' => '移除成功'], "JSON"); + } else { + M("promote_quick_menu ", "tab_")->add( + array("quick_menu_id" => $menu_id, + "promote_id" => get_pid(), + "create_time" => time()) ); - $this->ajaxReturn(['status'=>1,'info'=>'添加成功'],"JSON"); + $this->ajaxReturn(['status' => 1, 'info' => '添加成功'], "JSON"); } } // 消息列表 - public function msg_list($type=56,$p=0){ + public function msg_list($type = 56, $p = 0) + { if (isset($_REQUEST['row'])) { $row = $_REQUEST['row']; } else { $row = 10; } $page = $p ? $p : 1; //默认显示第一页数据 - if($type==51){ - $data_list = M("document","sys_")->where("category_id=51 and status=1")->order("update_time desc") ->page($page, $row)->select(); //游戏咨询 - $count = M("document","sys_")->where("category_id=51 and status=1")->count(); - }elseif ($type==50){ + if ($type == 51) { + $data_list = M("document", "sys_")->where("category_id=51 and status=1")->order("update_time desc")->page($page, $row)->select(); //游戏咨询 + $count = M("document", "sys_")->where("category_id=51 and status=1")->count(); + } elseif ($type == 50) { $data_list = null; $count = 0; - }else{ - $data_list = M("document","sys_")->limit('0,50')->where("category_id=56 and status=1")->order("update_time desc")->page($page, $row)->select(); //游戏公告 - $count = M("document","sys_")->where("category_id=56 and status=1")->count(); + } else { + $data_list = M("document", "sys_")->limit('0,50')->where("category_id=56 and status=1")->order("update_time desc")->page($page, $row)->select(); //游戏公告 + $count = M("document", "sys_")->where("category_id=56 and status=1")->count(); } $parameter['p'] = I('get.p', 1); $parameter['row'] = I('get.row'); @@ -368,24 +379,25 @@ class PromoteController extends BaseController // $this->error('请输入昵称', U('Promote/base_info')); // exit(); //} - if ( empty($_REQUEST['real_name']) ) { + if (empty($_REQUEST['real_name'])) { $this->error('请输入联系人姓名', U('Promote/base_info')); exit(); } $pattern = "/^[\x{4e00}-\x{9fa5}]+$/u"; - if(!preg_match($pattern,$_REQUEST['real_name'])){ + if (!preg_match($pattern, $_REQUEST['real_name'])) { $this->error('联系人姓名错误', U('Promote/base_info')); exit(); } - if ( empty($_REQUEST['email'])) { + if (empty($_REQUEST['email'])) { $this->error('请输入电子邮箱', U('Promote/base_info')); exit(); } $pattern = "/^([0-9A-Za-z\\-_\\.]+)@([0-9a-z]+\\.[a-z]{2,3}(\\.[a-z]{2})?)$/i"; - if ( !preg_match( $pattern, $_REQUEST['email'] ) ){ - $this->error('邮箱地址错误', U('Promote/base_info'));exit; + if (!preg_match($pattern, $_REQUEST['email'])) { + $this->error('邮箱地址错误', U('Promote/base_info')); + exit; } // if (empty($_REQUEST['alipay_account']) ) { // $this->error('请输入支付宝账号', U('Promote/base_info')); @@ -399,12 +411,12 @@ class PromoteController extends BaseController break; case 1: - if(empty($_REQUEST['mobile_phone']) ){ + if (empty($_REQUEST['mobile_phone'])) { $this->error('结算手机号不能为空', U('Promote/base_info')); return false; } $pattern = "/^1[3|5|7|8]\\d{9}$/i"; - if ( !preg_match( $pattern, $_REQUEST['mobile_phone'] ) ){ + if (!preg_match($pattern, $_REQUEST['mobile_phone'])) { $this->error('您输入的手机号码格式不合法', U('Promote/base_info')); } if ($_REQUEST['s_county'] === "市、县级市") { @@ -412,47 +424,47 @@ class PromoteController extends BaseController return false; exit(); } - if(empty($_REQUEST['account_openin']) ){ + if (empty($_REQUEST['account_openin'])) { $this->error('开户网点不能为空', U('Promote/base_info')); return false; } $account_openin_pattern = "/^[\x{4e00}-\x{9fa5}]{2,}$/u"; - if(!preg_match($account_openin_pattern,$_REQUEST['account_openin'])){ + if (!preg_match($account_openin_pattern, $_REQUEST['account_openin'])) { $this->error('开户网点错误', U('Promote/base_info')); exit(); } - if(empty($_REQUEST['bank_name']) ){ + if (empty($_REQUEST['bank_name'])) { $this->error('收款银行不能为空', U('Promote/base_info')); return false; } - if(empty($_REQUEST['bank_card']) ){ + if (empty($_REQUEST['bank_card'])) { $this->error('银行卡号不能为空', U('Promote/base_info')); return false; } - if(!is_numeric($_REQUEST['bank_card'])){ + if (!is_numeric($_REQUEST['bank_card'])) { $this->error('卡号格式错误', U('Promote/base_info')); return false; } $bank_card_pattern = "/^\d{10,19}$/u"; - if(!preg_match($bank_card_pattern,$_REQUEST['bank_card'])){ + if (!preg_match($bank_card_pattern, $_REQUEST['bank_card'])) { $this->error('卡号格式错误', U('Promote/base_info')); exit(); } - if(empty($_REQUEST['bank_account']) ){ + if (empty($_REQUEST['bank_account'])) { $this->error('银行户名不能为空', U('Promote/base_info')); return false; } $bank_account_pattern = "/^[\x{4e00}-\x{9fa5}]{2,}$/u"; - if(!preg_match($bank_account_pattern,$_REQUEST['bank_account'])){ + if (!preg_match($bank_account_pattern, $_REQUEST['bank_account'])) { $this->error('银行卡开户人姓名错误', U('Promote/base_info')); exit(); } - if(empty($_REQUEST['idcard']) ){ + if (empty($_REQUEST['idcard'])) { $this->error('证件号码不能为空', U('Promote/base_info')); exit(); } - if(!is_idcard($_REQUEST['idcard'])) { + if (!is_idcard($_REQUEST['idcard'])) { $this->error('证件号码错误', U('Promote/base_info')); exit(); } @@ -467,39 +479,39 @@ class PromoteController extends BaseController $se['idcard'] = $_REQUEST['idcard']; break; case 2: - if($_REQUEST['old_password'] !="0" && empty($_REQUEST['old_password']) ){ + if ($_REQUEST['old_password'] != "0" && empty($_REQUEST['old_password'])) { $this->error('旧密码不能为空', U('Promote/base_info')); return false; } - if(strlen($_REQUEST['old_password']) <6 ){ + if (strlen($_REQUEST['old_password']) < 6) { $this->error('旧密码不正确', U('Promote/base_info')); return false; } - if($_REQUEST['password'] != "0" && empty($_REQUEST['password']) ){ + if ($_REQUEST['password'] != "0" && empty($_REQUEST['password'])) { $this->error('新密码不能为空', U('Promote/base_info')); return false; } - if(strlen($_REQUEST['password']) <6 ){ + if (strlen($_REQUEST['password']) < 6) { $this->error('新密码最短6位', U('Promote/base_info')); return false; } - if( empty($_REQUEST['confirm_password'])){ + if (empty($_REQUEST['confirm_password'])) { $this->error('确认密码不能为空', U('Promote/base_info')); return false; } - if(strlen($_REQUEST['confirm_password'])<6 ){ + if (strlen($_REQUEST['confirm_password']) < 6) { $this->error('确认密码最短6位', U('Promote/base_info')); return false; } $prp = M("promote", "tab_")->where($map)->find(); $ue = new UserApi(); - if($_REQUEST['password'] !== $_REQUEST['confirm_password']){ + if ($_REQUEST['password'] !== $_REQUEST['confirm_password']) { $this->error('新密码和确认密码不一致', U('Promote/base_info')); return false; } else { $se['password'] = $this->think_ucenter_md5($_REQUEST['confirm_password'], UC_AUTH_KEY); } - if($this->think_ucenter_md5($_REQUEST['old_password'], UC_AUTH_KEY) !== $prp['password']) { + if ($this->think_ucenter_md5($_REQUEST['old_password'], UC_AUTH_KEY) !== $prp['password']) { $this->error('请输入正确的旧密码', U('Promote/base_info')); return false; exit(); @@ -509,28 +521,28 @@ class PromoteController extends BaseController case 3: $prp = M("promote", "tab_")->where($map)->find(); $ue = new UserApi(); - if($_REQUEST['old_second_pwd'] != "0" && empty($_REQUEST['old_second_pwd']) && !empty($prp['second_pwd'])){ + if ($_REQUEST['old_second_pwd'] != "0" && empty($_REQUEST['old_second_pwd']) && !empty($prp['second_pwd'])) { $this->error('旧二级密码不能为空', U('Promote/base_info')); return false; } - if(strlen($_REQUEST['old_second_pwd']) <6 && !empty($prp['second_pwd'])){ + if (strlen($_REQUEST['old_second_pwd']) < 6 && !empty($prp['second_pwd'])) { $this->error('旧二级密码不正确', U('Promote/base_info')); return false; } - if($_REQUEST['second_pwd'] !="0" && empty($_REQUEST['second_pwd']) ){ + if ($_REQUEST['second_pwd'] != "0" && empty($_REQUEST['second_pwd'])) { $this->error('新二级密码不能为空', U('Promote/base_info')); return false; } - if(strlen($_REQUEST['second_pwd']) <6 ){ + if (strlen($_REQUEST['second_pwd']) < 6) { $this->error('新二级密码长度不能小于6', U('Promote/base_info')); return false; } - if (empty($_REQUEST['confirm_second_pwd'])){ + if (empty($_REQUEST['confirm_second_pwd'])) { $this->error('请输入确认密码', U('Promote/base_info')); return false; } - if ($_REQUEST[''] != $_REQUEST['']){ + if ($_REQUEST[''] != $_REQUEST['']) { $this->error('新耳机密码和确认密码不一致', U('Promote/base_info')); return false; } @@ -568,9 +580,9 @@ class PromoteController extends BaseController $this->wxQrcode($data); $user = D('Promote')->isLogin(); if (empty($user)) { - $this->redirect("Home/Index/index"); + $this->redirect("Home/Index/index"); } - $promoteUrl = "https://m.wmtxkj.com/mobile.php?s=Ssg/login/promote_id/".$user['pid']; + $promoteUrl = "https://m.wmtxkj.com/mobile.php?s=Ssg/login/promote_id/" . $user['pid']; $this->assign("promote_url", $promoteUrl); $this->display(); @@ -597,7 +609,7 @@ class PromoteController extends BaseController $model = new PromoteModel(); $promotes = $model->field(['id', 'account'])->where('parent_id=' . $promoteId)->select(); - $subPromotes = $model->field(['id', 'account'])->where('parent_id='. $promoteId . ' or grand_id=' . $promoteId . ' or id=' . $promoteId)->select(); + $subPromotes = $model->field(['id', 'account'])->where('parent_id=' . $promoteId . ' or grand_id=' . $promoteId . ' or id=' . $promoteId)->select(); $map = []; if ($account) { @@ -617,7 +629,7 @@ class PromoteController extends BaseController } $map['parent_id'] = session("promote_auth.pid"); - $appendCallback = function($data) { + $appendCallback = function ($data) { $promote = new PromoteModel(); $player = new UserPlayModel(); $ids = array_column($data, 'id'); @@ -635,7 +647,7 @@ class PromoteController extends BaseController $parentList = $promote->field(['id', 'account'])->where(['id' => ['in', $parentIds]])->select(); $parentPromotes = []; - foreach($parentList as $parent) { + foreach ($parentList as $parent) { $parentPromotes[$parent['id']] = $parent['account']; } @@ -671,7 +683,7 @@ class PromoteController extends BaseController $promoteId = session("promote_auth.pid"); $model = new PromoteModel(); $promotes = $model->field(['id', 'account'])->where('parent_id=' . $promoteId)->select(); - $subPromotes = $model->field(['id', 'account'])->where('parent_id='. $promoteId . ' or grand_id=' . $promoteId . ' or id=' . $promoteId)->select(); + $subPromotes = $model->field(['id', 'account'])->where('parent_id=' . $promoteId . ' or grand_id=' . $promoteId . ' or id=' . $promoteId)->select(); $map = []; if ($account) { @@ -700,7 +712,7 @@ class PromoteController extends BaseController $map['parent_id'] = session("promote_auth.pid"); } - $appendCallback = function($data) use($promote) { + $appendCallback = function ($data) use ($promote) { $promoteModel = new PromoteModel(); $player = new UserPlayModel(); $ids = array_column($data, 'id'); @@ -716,12 +728,12 @@ class PromoteController extends BaseController $parentList = $promoteModel->field(['id', 'account'])->where(['id' => ['in', $parentIds]])->select(); $parentPromotes = []; - foreach($parentList as $parent) { + foreach ($parentList as $parent) { $parentPromotes[$parent['id']] = $parent['account']; } $list = []; - foreach($data as $key => $item) { + foreach ($data as $key => $item) { if ($promote['parent_id'] > 0 && $promote['grand_id'] == 0) { $item['idcard'] = hideStar($item['idcard'], 4, 10); $item['mobile_phone'] = hideStar($item['mobile_phone'], 3, 4); @@ -753,7 +765,7 @@ class PromoteController extends BaseController $parentId = 0; if (isset($_POST['promote_type']) && $_POST['promote_type'] == 2 && isset($_POST['parent_id'])) { if ($_POST['parent_id'] == 0) { - $this->ajaxReturn(array('status'=>-1,'msg'=>'请选择上级渠道')); + $this->ajaxReturn(array('status' => -1, 'msg' => '请选择上级渠道')); } $parentId = $_POST['parent_id']; } else { @@ -763,7 +775,7 @@ class PromoteController extends BaseController $user = new PromoteApi(); $promote = D('promote')->where(['id' => $parentId])->find(); - $status = promoteCan(session('promote_auth.pid'), function($level) use ($promote) { + $status = promoteCan(session('promote_auth.pid'), function ($level) use ($promote) { if ($level == 1) { return true; } elseif ($level == 2) { @@ -773,40 +785,40 @@ class PromoteController extends BaseController } }); if (!$status) { - $this->ajaxReturn(array('status'=>-1, 'msg'=>'无权限操作')); + $this->ajaxReturn(array('status' => -1, 'msg' => '无权限操作')); } $_POST['ba_id'] = $promote['ba_id']; $_POST['parent_id'] = $parentId; $_POST['parent_account'] = $promote['account']; //三级渠道 - if($promote['parent_id']>0){ + if ($promote['parent_id'] > 0) { $_POST['grand_id'] = $promote['parent_id']; $_POST['grand_account'] = $promote['promote_account']; } if (isset($_POST['mobile_phone'])) { - if(!preg_match("/^1[3456789]{1}\d{9}$/", $_POST['mobile_phone'])){ - $this->ajaxReturn(array('status'=>-1,'msg'=>'手机号格式错误')); + if (!preg_match("/^1[3456789]{1}\d{9}$/", $_POST['mobile_phone'])) { + $this->ajaxReturn(array('status' => -1, 'msg' => '手机号格式错误')); } } if (isset($_POST['idcard'])) { - if(!$this->isIdcard($_POST['idcard'])){ - $this->ajaxReturn(array('status'=>-1,'msg'=>'身份证格式错误')); + if (!$this->isIdcard($_POST['idcard'])) { + $this->ajaxReturn(array('status' => -1, 'msg' => '身份证格式错误')); } } $res = $user->promote_add($_POST); if (is_numeric($res)) { $ba = new \Admin\Model\BusinessAffairsModel(); - $ba->add_child($_POST['ba_id'],$res); - $this->ajaxReturn(array('status'=>1,'msg'=>"添加成功")); + $ba->add_child($_POST['ba_id'], $res); + $this->ajaxReturn(array('status' => 1, 'msg' => "添加成功")); } else { - $msg = $res =="渠道账号已存在"?"子渠道账号已存在":$res; - $this->ajaxReturn(array('status'=>-1,'msg'=>$msg)); + $msg = $res == "渠道账号已存在" ? "子渠道账号已存在" : $res; + $this->ajaxReturn(array('status' => -1, 'msg' => $msg)); } } else { $type = I('type', 0); - $status = promoteCan(session('promote_auth.pid'), function($level) use ($type) { + $status = promoteCan(session('promote_auth.pid'), function ($level) use ($type) { if ($level == 1) { return true; } elseif ($level == 2) { @@ -835,14 +847,14 @@ class PromoteController extends BaseController { $promoteId = I('promote_id', 0); if ($promoteId == 0) { - $this->ajaxReturn(['status'=>0,'msg'=>"参数错误"]); + $this->ajaxReturn(['status' => 0, 'msg' => "参数错误"]); } $promoteService = new PromoteService(); if ($password = $promoteService->resetPassword($promoteId)) { - $this->ajaxReturn(['status'=>1, 'msg'=> '重置密码成功', 'data' => ['password' => $password]]); + $this->ajaxReturn(['status' => 1, 'msg' => '重置密码成功', 'data' => ['password' => $password]]); } else { - $this->ajaxReturn(['status'=>0, 'msg'=> '重置密码失败']); + $this->ajaxReturn(['status' => 0, 'msg' => '重置密码失败']); } } @@ -850,13 +862,13 @@ class PromoteController extends BaseController { $promoteId = I('promote_id', 0); if ($promoteId == 0) { - $this->ajaxReturn(['status'=>0,'msg'=>"参数错误"]); + $this->ajaxReturn(['status' => 0, 'msg' => "参数错误"]); } $promoteService = new PromoteService(); if ($promoteService->froze($promoteId)) { - $this->ajaxReturn(['status'=>1, 'msg'=> '冻结成功']); + $this->ajaxReturn(['status' => 1, 'msg' => '冻结成功']); } else { - $this->ajaxReturn(['status'=>0, 'msg'=> '冻结失败']); + $this->ajaxReturn(['status' => 0, 'msg' => '冻结失败']); } } @@ -864,13 +876,13 @@ class PromoteController extends BaseController { $promoteId = I('promote_id', 0); if ($promoteId == 0) { - $this->ajaxReturn(['status'=>0,'msg'=>"参数错误"]); + $this->ajaxReturn(['status' => 0, 'msg' => "参数错误"]); } $promoteService = new PromoteService(); if ($promoteService->unfreeze($promoteId)) { - $this->ajaxReturn(['status'=>1, 'msg'=> '解冻成功']); + $this->ajaxReturn(['status' => 1, 'msg' => '解冻成功']); } else { - $this->ajaxReturn(['status'=>0, 'msg'=> '解冻失败']); + $this->ajaxReturn(['status' => 0, 'msg' => '解冻失败']); } } @@ -885,49 +897,49 @@ class PromoteController extends BaseController } switch ($type) { case 0: - if (empty($_REQUEST['nickname']) ) { - $this->error('子账号昵称不能为空', U('Promote/edit_chlid',array('id'=>$id,'type'=>I('type',0)))); + if (empty($_REQUEST['nickname'])) { + $this->error('子账号昵称不能为空', U('Promote/edit_chlid', array('id' => $id, 'type' => I('type', 0)))); exit(); } if ($_POST['password'] != "0" && empty($_POST['password'])) { unset($_POST['password']); - }else{ - if(strlen($_REQUEST['password'])<6 ){ - $this->error('登录密码不能小于6位字符', U('Promote/edit_chlid',array('id'=>$id,'type'=>I('type',0)))); + } else { + if (strlen($_REQUEST['password']) < 6) { + $this->error('登录密码不能小于6位字符', U('Promote/edit_chlid', array('id' => $id, 'type' => I('type', 0)))); return false; } } - if ( empty($_REQUEST['real_name']) ) { - $this->error('联系人姓名不能为空', U('Promote/edit_chlid',array('id'=>$id,'type'=>I('type',0)))); + if (empty($_REQUEST['real_name'])) { + $this->error('联系人姓名不能为空', U('Promote/edit_chlid', array('id' => $id, 'type' => I('type', 0)))); exit(); } $pattern = "/^[\x{4e00}-\x{9fa5}]+$/u"; - if(!preg_match($pattern,$_REQUEST['real_name'])){ - $this->error('您输入的联系人姓名格式不正确', U('Promote/edit_chlid',array('id'=>$id,'type'=>I('type',0)))); + if (!preg_match($pattern, $_REQUEST['real_name'])) { + $this->error('您输入的联系人姓名格式不正确', U('Promote/edit_chlid', array('id' => $id, 'type' => I('type', 0)))); exit(); } - if(empty($_REQUEST['mobile_phone']) ){ - $this->error('手机号不能为空', U('Promote/edit_chlid',array('id'=>$id,'type'=>I('type',0)))); + if (empty($_REQUEST['mobile_phone'])) { + $this->error('手机号不能为空', U('Promote/edit_chlid', array('id' => $id, 'type' => I('type', 0)))); return false; } $pattern = "/^1[3|5|7|8]\\d{9}$/i"; - if ( !preg_match( $pattern, $_REQUEST['mobile_phone'] ) ){ - $this->error('您输入的手机号码格式不合法', U('Promote/edit_chlid',array('id'=>$id,'type'=>I('type',0)))); + if (!preg_match($pattern, $_REQUEST['mobile_phone'])) { + $this->error('您输入的手机号码格式不合法', U('Promote/edit_chlid', array('id' => $id, 'type' => I('type', 0)))); } - if(empty($_REQUEST['email']) ){ - $this->error('电子邮箱不能为空', U('Promote/edit_chlid',array('id'=>$id,'type'=>I('type',0)))); + if (empty($_REQUEST['email'])) { + $this->error('电子邮箱不能为空', U('Promote/edit_chlid', array('id' => $id, 'type' => I('type', 0)))); return false; } $pattern = "/^([0-9A-Za-z\\-_\\.]+)@([0-9a-z]+\\.[a-z]{2,3}(\\.[a-z]{2})?)$/i"; - if ( !preg_match( $pattern, $_REQUEST['email'] ) ){ - $this->error('您输入的电子邮箱地址不合法', U('Promote/edit_chlid',array('id'=>$id,'type'=>I('type',0)))); + if (!preg_match($pattern, $_REQUEST['email'])) { + $this->error('您输入的电子邮箱地址不合法', U('Promote/edit_chlid', array('id' => $id, 'type' => I('type', 0)))); }; $user = new PromoteApi(); @@ -941,42 +953,42 @@ class PromoteController extends BaseController break; case 1: if ($_REQUEST['s_county'] === "市、县级市") { - $this->error('开户城市填写不完整',U('Promote/edit_chlid',array('id'=>$id,'type'=>I('type',1)))); + $this->error('开户城市填写不完整', U('Promote/edit_chlid', array('id' => $id, 'type' => I('type', 1)))); return false; exit(); } - if(empty($_REQUEST['account_openin']) ){ - $this->error('开户网点不能为空', U('Promote/edit_chlid',array('id'=>$id,'type'=>I('type',1)))); + if (empty($_REQUEST['account_openin'])) { + $this->error('开户网点不能为空', U('Promote/edit_chlid', array('id' => $id, 'type' => I('type', 1)))); return false; } - if(empty($_REQUEST['bank_name']) ){ - $this->error('收款银行不能为空', U('Promote/edit_chlid',array('id'=>$id,'type'=>I('type',1)))); + if (empty($_REQUEST['bank_name'])) { + $this->error('收款银行不能为空', U('Promote/edit_chlid', array('id' => $id, 'type' => I('type', 1)))); return false; } - if(empty($_REQUEST['bank_card']) ){ - $this->error('银行卡号不能为空', U('Promote/edit_chlid',array('id'=>$id,'type'=>I('type',1)))); + if (empty($_REQUEST['bank_card'])) { + $this->error('银行卡号不能为空', U('Promote/edit_chlid', array('id' => $id, 'type' => I('type', 1)))); return false; } - if(!is_numeric($_REQUEST['bank_card']) ){ - $this->error('请输入正确的银行卡号', U('Promote/edit_chlid',array('id'=>$id,'type'=>I('type',1)))); + if (!is_numeric($_REQUEST['bank_card'])) { + $this->error('请输入正确的银行卡号', U('Promote/edit_chlid', array('id' => $id, 'type' => I('type', 1)))); return false; } - if(empty($_REQUEST['bank_account']) ){ - $this->error('银行户名不能为空', U('Promote/edit_chlid',array('id'=>$id,'type'=>I('type',1)))); + if (empty($_REQUEST['bank_account'])) { + $this->error('银行户名不能为空', U('Promote/edit_chlid', array('id' => $id, 'type' => I('type', 1)))); return false; } - $se['mobile_phone'] = $_REQUEST['mobile_phone']; - $se['bank_name'] = $_REQUEST['bank_name']; - $se['bank_card'] = $_REQUEST['bank_card']; - $se['bank_account'] = $_REQUEST['bank_account']; + $se['mobile_phone'] = $_REQUEST['mobile_phone']; + $se['bank_name'] = $_REQUEST['bank_name']; + $se['bank_card'] = $_REQUEST['bank_card']; + $se['bank_account'] = $_REQUEST['bank_account']; $se['account_openin'] = $_REQUEST['account_openin']; - $se['bank_area'] = $_REQUEST['s_province'] . ',' . $_REQUEST['s_city'] . ',' . $_REQUEST['s_county']; + $se['bank_area'] = $_REQUEST['s_province'] . ',' . $_REQUEST['s_city'] . ',' . $_REQUEST['s_county']; $res = M("promote", "tab_")->where($map)->save($se); if ($res !== false) { - $this->success("修改成功", U('Promote/edit_chlid',array('id'=>$id,'type'=>$type))); + $this->success("修改成功", U('Promote/edit_chlid', array('id' => $id, 'type' => $type))); } else { - $this->error('修改失败', U('Promote/edit_chlid',array('id'=>$id,'type'=>$type))); + $this->error('修改失败', U('Promote/edit_chlid', array('id' => $id, 'type' => $type))); } break; } @@ -993,9 +1005,10 @@ class PromoteController extends BaseController * @param int $level * @param int $size */ - public function qrcode($level=3,$size=4,$url=""){ + public function qrcode($level = 3, $size = 4, $url = "") + { Vendor('phpqrcode.phpqrcode'); - $errorCorrectionLevel =intval($level) ;//容错级别 + $errorCorrectionLevel = intval($level);//容错级别 $matrixPointSize = intval($size);//生成图片大小 //生成二维码图片 ob_clean(); @@ -1003,34 +1016,36 @@ class PromoteController extends BaseController echo $object->png(base64_decode(base64_decode($url)), false, $errorCorrectionLevel, $matrixPointSize, 2); } - public function checkAccount($account){ + public function checkAccount($account) + { $user = get_promote_entity($account, true); - if($user){ - $this->ajaxReturn(array('status'=>1)); - }else{ - $this->ajaxReturn(array('status'=>0)); + if ($user) { + $this->ajaxReturn(array('status' => 1)); + } else { + $this->ajaxReturn(array('status' => 0)); } } - public function balance() { + + public function balance() + { if (IS_POST) { $real_amount = $amount = I('amount'); - - if(!is_numeric($amount)){ + if (!is_numeric($amount)) { $res_msg = '充值金额不是数字'; $this->show_balance(); echo "; return false;"; - $this->redirect('balance', array('status'=>1), 3, ''); + $this->redirect('balance', array('status' => 1), 3, ''); } - if($amount<0) { + if ($amount < 0) { $res_msg = '充值金额不正确'; $this->show_balance(); echo "; return false;"; - $this->redirect('balance', array('status'=>1), 3, ''); + $this->redirect('balance', array('status' => 1), 3, ''); } $amount = abs($amount); // $amount = 0.01;//测试金额 @@ -1096,21 +1111,21 @@ class PromoteController extends BaseController exit(); } - if(empty(C('goldpig.partner'))||empty(C('goldpig.wooolid'))) { + if (empty(C('goldpig.partner')) || empty(C('goldpig.wooolid'))) { $this->error("网站未配置金猪充值", '', 1); exit(); } - if($amount<1) { + if ($amount < 1) { $this->error("单笔金额不小于1", '', 1); exit(); } - $sign=think_encrypt(md5($real_amount.$order_no)); + $sign = think_encrypt(md5($real_amount . $order_no)); $create['pay_way'] = 8; $this->add_balance($user, $create); - file_put_contents("./Application/Home/OrderNo/".$order_no.'.txt',json_encode($create)); - redirect(U('goldpig_pay',array('userid'=>$user['id'],'account' =>$user['account'],'pay_amount'=>$real_amount,'sign'=>$sign,'pay_order_number'=>$order_no))); + file_put_contents("./Application/Home/OrderNo/" . $order_no . '.txt', json_encode($create)); + redirect(U('goldpig_pay', array('userid' => $user['id'], 'account' => $user['account'], 'pay_amount' => $real_amount, 'sign' => $sign, 'pay_order_number' => $order_no))); break; default: //判断是否开启支付宝充值 @@ -1126,33 +1141,33 @@ class PromoteController extends BaseController } - } else { $model = M('Promote', 'tab_'); $data = $model->find(session("promote_auth.pid")); $data['bank_area'] = explode(',', $data['bank_area']); - $this->assign('data',$data); + $this->assign('data', $data); $this->meta_title = '账户余额'; $this->display(); } } - public function balance_recharge() { + public function balance_recharge() + { if (IS_POST) { - $real_amount = $amount = I('amount',0,'intval'); + $real_amount = $amount = I('amount', 0, 'intval'); //$real_amount = $amount = 0.01; - if(!is_numeric($amount)){ + if (!is_numeric($amount)) { - $this->ajaxReturn(['status'=>0,'info'=>'充值金额不是数字']); + $this->ajaxReturn(['status' => 0, 'info' => '充值金额不是数字']); } - if($amount<0){ + if ($amount < 0) { - $this->ajaxReturn(['status'=>0,'info'=>'充值金额错误']); + $this->ajaxReturn(['status' => 0, 'info' => '充值金额错误']); } @@ -1184,7 +1199,7 @@ class PromoteController extends BaseController case 'swiftpass': //判断是否开启微信充值 if (pay_set_status('wei_xin') == 0 && pay_set_status('weixin') == 0) { - $this->ajaxReturn(['status'=>0,'info'=>'网站未开启微信充值']); + $this->ajaxReturn(['status' => 0, 'info' => '网站未开启微信充值']); } if (get_wx_type() == 0) { $weixn = new Weixin(); @@ -1198,7 +1213,7 @@ class PromoteController extends BaseController $create['pay_way'] = 2; $this->add_balance($user, $create); - $this->ajaxReturn(['status'=>1,'info'=>'','data'=>$json_]); + $this->ajaxReturn(['status' => 1, 'info' => '', 'data' => $json_]); } else { $vo->setService("pay.weixin.native") @@ -1207,26 +1222,25 @@ class PromoteController extends BaseController $all = $pay->buildRequestForm($vo); $all['amount'] = $vo->getMoney(); - $this->ajaxReturn(['status'=>1,'info'=>'','data'=>$all]); + $this->ajaxReturn(['status' => 1, 'info' => '', 'data' => $all]); } break; default: //判断是否开启支付宝充值 if (pay_set_status('alipay') == 0) { - $this->ajaxReturn(['status'=>0,'info'=>'网站未开启支付宝充值']); + $this->ajaxReturn(['status' => 0, 'info' => '网站未开启支付宝充值']); } $vo->setService("create_direct_pay_by_user") ->setPayWay(1); $pay = new \Think\Pay('alipay', C('alipay')); $url = $pay->buildRequestForm($vo); - $this->ajaxReturn(['status'=>1,'info'=>'','url'=>$url]); + $this->ajaxReturn(['status' => 1, 'info' => '', 'url' => $url]); } - } else { - $this->ajaxReturn(['status'=>0,'info'=>'请求有误']); + $this->ajaxReturn(['status' => 0, 'info' => '请求有误']); } } @@ -1237,22 +1251,25 @@ class PromoteController extends BaseController * @return [type] [description] * @author cb <[email address]> */ - public function goldpig_pay(){ - if(IS_POST){ + public function goldpig_pay() + { + if (IS_POST) { SafeFilter($_POST); - $msign=think_encrypt(md5($_POST['amount'].$_POST['pay_order_number'])); - if($msign!==$_POST['sign']){ - $this->error('验证失败',U('promote/balance'));exit; + $msign = think_encrypt(md5($_POST['amount'] . $_POST['pay_order_number'])); + if ($msign !== $_POST['sign']) { + $this->error('验证失败', U('promote/balance')); + exit; } - if($_POST['amount']<=0){ + if ($_POST['amount'] <= 0) { $this->error('金额有误'); } - $url="./Application/Home/OrderNo/".$_POST['pay_order_number'].'.txt'; - if(!file_exists($url) ){ - $this->error('操作有误',U('promote/balance'));exit; + $url = "./Application/Home/OrderNo/" . $_POST['pay_order_number'] . '.txt'; + if (!file_exists($url)) { + $this->error('操作有误', U('promote/balance')); + exit; } - $user = M('Promote','tab_')->field('id,account')->where(['account'=>$_POST['UserName']])->find(); + $user = M('Promote', 'tab_')->field('id,account')->where(['account' => $_POST['UserName']])->find(); if (empty($user)) { $this->error("账号不存在"); @@ -1264,9 +1281,10 @@ class PromoteController extends BaseController $url = $baseurl . "UserName={$_POST['UserName']}&Price={$_POST['amount']}&shouji={$_POST['shouji']}&PayID={$_POST['PayID']}&userid={$_POST['userid']}&wooolID={$_POST['wooolID']}&jinzhua={$_POST['pay_order_number']}&jinzhub={$_POST['jinzhub']}&jinzhuc={$_POST['jinzhuc']}&jinzhue={$_POST['pay_order_number']}"; - redirect($url);exit; + redirect($url); + exit; - }else{ + } else { $this->display(); } @@ -1274,57 +1292,61 @@ class PromoteController extends BaseController } - public function show_balance() { + public function show_balance() + { $model = M('Promote', 'tab_'); $data = $model->find(session("promote_auth.pid")); $data['bank_area'] = explode(',', $data['bank_area']); - $this->assign('data',$data); + $this->assign('data', $data); $this->meta_title = '账户余额'; $this->display('balance'); } - public function checkOrder($order_number){ + public function checkOrder($order_number) + { $map['pay_order_number'] = $order_number; - $data = M('Balance','tab_') + $data = M('Balance', 'tab_') ->where($map) ->field('pay_status') ->find(); - if ($data['pay_status'] == 1){ + if ($data['pay_status'] == 1) { $this->success('支付成功'); - }else{ + } else { $this->error('暂未支付'); } } - public function add_balance($promote,$data){ - $balance = M("Balance","tab_"); - $balance_data['order_number'] = ""; - $balance_data['pay_order_number'] = $data['pay_order_number']; - $balance_data['money'] = $data['amount']; - $balance_data['balance'] = $promote['balance_coin']; - $balance_data['pay_status'] = 0; - $balance_data['recharge_type'] = $data['pay_way']; - $balance_data['create_time'] = time(); - $balance_data['recharge_id'] = $promote['id']; - $balance_data['recharge_account'] = $promote['account']; - $balance_data['promote_id'] = PID; - $balance_data['promote_account'] = PROMOTE_ACCOUNT; + public function add_balance($promote, $data) + { + $balance = M("Balance", "tab_"); + $balance_data['order_number'] = ""; + $balance_data['pay_order_number'] = $data['pay_order_number']; + $balance_data['money'] = $data['amount']; + $balance_data['balance'] = $promote['balance_coin']; + $balance_data['pay_status'] = 0; + $balance_data['recharge_type'] = $data['pay_way']; + $balance_data['create_time'] = time(); + $balance_data['recharge_id'] = $promote['id']; + $balance_data['recharge_account'] = $promote['account']; + $balance_data['promote_id'] = PID; + $balance_data['promote_account'] = PROMOTE_ACCOUNT; $balance->create($balance_data); $result = $balance->add(); return $result; } - public function wxQrcode($promote='') { - if (C('wechat.status')>0) { - $appid = C('wechat.appid'); + public function wxQrcode($promote = '') + { + if (C('wechat.status') > 0) { + $appid = C('wechat.appid'); $appsecret = C('wechat.appsecret'); $token = session("token"); - if($token){ + if ($token) { $auth = new WechatAuth($appid, $appsecret, $token); } else { - $auth = new WechatAuth($appid, $appsecret); + $auth = new WechatAuth($appid, $appsecret); $token = $auth->getAccessToken(); session(array('expire' => $token['expires_in'])); @@ -1334,29 +1356,30 @@ class PromoteController extends BaseController $promote = D('promote')->detail(); } - $sign = $promote['weixin_openid_sign']?$promote['weixin_openid_sign']:rand(1,99999); + $sign = $promote['weixin_openid_sign'] ? $promote['weixin_openid_sign'] : rand(1, 99999); - $ticket = $auth->qrcodeCreate($sign,604800); + $ticket = $auth->qrcodeCreate($sign, 604800); - $this->assign('wxQrcodeUrl',$ticket['url']); + $this->assign('wxQrcodeUrl', $ticket['url']); } else { - $this->assign('wxQrcodeUrl',null); + $this->assign('wxQrcodeUrl', null); } } - public function wxQrcodeRedirect() { + public function wxQrcodeRedirect() + { $xml_str = $GLOBALS['HTTP_RAW_POST_DATA']; $this->logger($xml_str); - if(!empty($xml_str)){ + if (!empty($xml_str)) { libxml_disable_entity_loader(true); $request_xml = simplexml_load_string($xml_str, 'SimpleXMLElement', LIBXML_NOCDATA); - switch ($request_xml->MsgType){ + switch ($request_xml->MsgType) { case 'event': $this->_setOpenid($request_xml); break; @@ -1368,84 +1391,102 @@ class PromoteController extends BaseController } - public function _setOpenid($data,$type) { + public function _setOpenid($data, $type) + { $event = strtolower($data->Event); $openid = $data->FromUserName; // 用户 - $auth = new WechatAuth(C('wechat.appid'), C('wechat.appsecret')); + $auth = new WechatAuth(C('wechat.appid'), C('wechat.appsecret')); $model = D('Promote'); $promote = $model->detail(); - $data = array('id'=>$promote['id']); + $data = array('id' => $promote['id']); $user = $auth->userInfo($openid); - switch($event) { - case 'subscribe':{ - // 关注事件 - if (!empty($promote['weixin_openid'])) { - $auth->setText($openid,date('Y-m-d H:i:s').' 请先解绑微信');exit; - } - if (str_replace('qrscene_', '', $data['EventKey']) != $promote['weixin_openid_sign']) { - $auth->setText($openid,date('Y-m-d H:i:s').' 页面错误,请刷新页面重试');exit; - } - $data['weixin_account']=emoji_encode($user['nickname']); - $data['weixin_openid']=$openid; - $res = $model->update($data); - if ($res) { - $auth->sendText($openid,date('Y-m-d H:i:s').' 微信绑定成功'); - } else { - $auth->sendText($openid,date('Y-m-d H:i:s').' 微信绑定失败'); - } - };break; - case 'scan':{ - // 关注以后 - if ($user['subscribe'] != 1) {$auth->setText($openid,date('Y-m-d H:i:s').' 你未关注微信');exit;} - if (empty($promote['weixin_openid'])) { - $auth->setText($openid,date('Y-m-d H:i:s').' 请先绑定微信');exit; - } + switch ($event) { + case 'subscribe': + { + // 关注事件 + if (!empty($promote['weixin_openid'])) { + $auth->setText($openid, date('Y-m-d H:i:s') . ' 请先解绑微信'); + exit; + } + if (str_replace('qrscene_', '', $data['EventKey']) != $promote['weixin_openid_sign']) { + $auth->setText($openid, date('Y-m-d H:i:s') . ' 页面错误,请刷新页面重试'); + exit; + } + $data['weixin_account'] = emoji_encode($user['nickname']); + $data['weixin_openid'] = $openid; + $res = $model->update($data); + if ($res) { + $auth->sendText($openid, date('Y-m-d H:i:s') . ' 微信绑定成功'); + } else { + $auth->sendText($openid, date('Y-m-d H:i:s') . ' 微信绑定失败'); + } + }; + break; + case 'scan': + { + // 关注以后 + if ($user['subscribe'] != 1) { + $auth->setText($openid, date('Y-m-d H:i:s') . ' 你未关注微信'); + exit; + } + if (empty($promote['weixin_openid'])) { + $auth->setText($openid, date('Y-m-d H:i:s') . ' 请先绑定微信'); + exit; + } - };break; - case 'unsubscribe':{ - // 取消关注 - if ($promote['weixin_openid'] != $openid) { - $auth->setText($openid,date('Y-m-d H:i:s').' 对不起,你没有权限');exit; - } - if (str_replace('qrscene_', '', $data['EventKey']) != $promote['weixin_openid_sign']) { - $auth->setText($openid,date('Y-m-d H:i:s').' 页面错误,请刷新页面重试');exit; - } - if (empty($promote['weixin_openid'])) { - $auth->setText($openid,date('Y-m-d H:i:s').' 暂未绑定微信');exit; - } - $data['weixin_account']=''; - $data['weixin_openid']=''; - $res = $model->update($data); - if ($res) { - $auth->sendText($openid,date('Y-m-d H:i:s').' 微信解绑成功'); - } else { - $auth->sendText($openid,date('Y-m-d H:i:s').' 微信解绑失败'); - } + }; + break; + case 'unsubscribe': + { + // 取消关注 + if ($promote['weixin_openid'] != $openid) { + $auth->setText($openid, date('Y-m-d H:i:s') . ' 对不起,你没有权限'); + exit; + } + if (str_replace('qrscene_', '', $data['EventKey']) != $promote['weixin_openid_sign']) { + $auth->setText($openid, date('Y-m-d H:i:s') . ' 页面错误,请刷新页面重试'); + exit; + } + if (empty($promote['weixin_openid'])) { + $auth->setText($openid, date('Y-m-d H:i:s') . ' 暂未绑定微信'); + exit; + } + $data['weixin_account'] = ''; + $data['weixin_openid'] = ''; + $res = $model->update($data); + if ($res) { + $auth->sendText($openid, date('Y-m-d H:i:s') . ' 微信解绑成功'); + } else { + $auth->sendText($openid, date('Y-m-d H:i:s') . ' 微信解绑失败'); + } - };break; + }; + break; } } - public function logger($log_content) { - $fg_str="\n============================================================\n"; + public function logger($log_content) + { + $fg_str = "\n============================================================\n"; $max_size = 500000; - $log_filename = __ROOT__."/Uploads/Logs/log".date('Ymd').".xml"; - if(file_exists($log_filename) and (abs(filesize($log_filename)) > $max_size)){ + $log_filename = __ROOT__ . "/Uploads/Logs/log" . date('Ymd') . ".xml"; + if (file_exists($log_filename) and (abs(filesize($log_filename)) > $max_size)) { unlink($log_filename); } - if(is_array($log_content)){ - file_put_contents($log_filename, date('Y-m-d H:i:s')."\n".json_encode($log_content).$fg_str, FILE_APPEND); + if (is_array($log_content)) { + file_put_contents($log_filename, date('Y-m-d H:i:s') . "\n" . json_encode($log_content) . $fg_str, FILE_APPEND); - }else{ - file_put_contents($log_filename, date('Y-m-d H:i:s')."\n".$log_content.$fg_str, FILE_APPEND); + } else { + file_put_contents($log_filename, date('Y-m-d H:i:s') . "\n" . $log_content . $fg_str, FILE_APPEND); } } - public function promoteList($p=1){ + public function promoteList($p = 1) + { switch ($_GET['type']) { case '': @@ -1460,31 +1501,33 @@ class PromoteController extends BaseController // 推广员列表 const model_name = 'Promote'; - public function promoteLists($p){ + + public function promoteLists($p) + { $map = []; - $map['_string'] = 'id='. session('promote_auth.pid') + $map['_string'] = 'id=' . session('promote_auth.pid') . ' or parent_id=' . session('promote_auth.pid') . ' or grand_id=' . session('promote_auth.pid'); $selectMap = $map; - if(isset($_REQUEST['promote_id'])){ + if (isset($_REQUEST['promote_id'])) { $promoteid = $_REQUEST['promote_id']; unset($_REQUEST['promote_id']); - if(isset($_REQUEST['parent_id'])) { + if (isset($_REQUEST['parent_id'])) { $parent_id = $_REQUEST['parent_id']; unset($_REQUEST['parent_id']); - if($promoteid == $parent_id) { + if ($promoteid == $parent_id) { $map['id'] = $promoteid; } else { $maps['parent_id'] = $parent_id; $maps['grand_id'] = $parent_id; $maps['_logic'] = 'or'; - $pro = M('promote','tab_')->field('id,account')->where([array('id'=>$promoteid),$maps])->select(); + $pro = M('promote', 'tab_')->field('id,account')->where([array('id' => $promoteid), $maps])->select(); - if (!empty($pro_ids)){ - $map['id'] = array('eq',-1); + if (!empty($pro_ids)) { + $map['id'] = array('eq', -1); } } @@ -1506,35 +1549,35 @@ class PromoteController extends BaseController } } else { if (isset($_REQUEST['parent_id'])) { - if ($_REQUEST['parent_id']=='全部') { + if ($_REQUEST['parent_id'] == '全部') { unset($_REQUEST['parent_id']); } - $zid=get_zi_promote_id($_REQUEST['parent_id']); - if($zid){ - $zid=$zid.','.$_REQUEST['parent_id']; - }else{ - $zid=$_REQUEST['parent_id']; + $zid = get_zi_promote_id($_REQUEST['parent_id']); + if ($zid) { + $zid = $zid . ',' . $_REQUEST['parent_id']; + } else { + $zid = $_REQUEST['parent_id']; } - $map['id']=array('in',$zid); + $map['id'] = array('in', $zid); unset($_REQUEST['parent_id']); } } - if(isset($_REQUEST['admin_id'])){ - if($_REQUEST['admin_id']=="全部"){ + if (isset($_REQUEST['admin_id'])) { + if ($_REQUEST['admin_id'] == "全部") { unset($_REQUEST['admin']); - }else{ - $map['ba_id']=$_REQUEST['admin_id']; + } else { + $map['ba_id'] = $_REQUEST['admin_id']; } } - if(I('promote_level') == 1){ + if (I('promote_level') == 1) { $map['parent_id'] = 0; - }elseif(I('promote_level') == 2){ - $map['parent_id'] = ['neq',0]; + } elseif (I('promote_level') == 2) { + $map['parent_id'] = ['neq', 0]; $map['grand_id'] = 0; - }elseif (I('promote_level') == 3) { - $map['parent_id'] = ['neq',0]; - $map['grand_id'] = ['neq',0]; + } elseif (I('promote_level') == 3) { + $map['parent_id'] = ['neq', 0]; + $map['grand_id'] = ['neq', 0]; } $model = new PromoteModel(); @@ -1547,12 +1590,13 @@ class PromoteController extends BaseController /** * [数组分页,二维数组字段排序] * @param [type] $model [description] - * @param integer $p [description] - * @param array $extend_map [description] + * @param integer $p [description] + * @param array $extend_map [description] * @return [type] [description] * @author [yyh] <[email address]> */ - public function order_lists($model = null, $p = 0,$extend_map = array()){ + public function order_lists($model = null, $p = 0, $extend_map = array()) + { $model || $this->error('模型名标识必须!'); $page = intval($p); $page = $page ? $page : 1; //默认显示第一页数据 @@ -1562,28 +1606,30 @@ class PromoteController extends BaseController $model || $this->error('模型不存在!'); //解析列表规则 $fields = array(); - $grids = preg_split('/[;\r\n]+/s', trim($model['list_grid'])); + $grids = preg_split('/[;\r\n]+/s', trim($model['list_grid'])); foreach ($grids as &$value) { - if(trim($value) === ''){ + if (trim($value) === '') { continue; } // 字段:标题:链接 - $val = explode(':', $value); + $val = explode(':', $value); // 支持多个字段显示 - $field = explode(',', $val[0]); - $value = array('field' => $field, 'title' => $val[1]); - if(isset($val[2])){ + $field = explode(',', $val[0]); + $value = array('field' => $field, 'title' => $val[1]); + if (isset($val[2])) { // 链接信息 - $value['href'] = $val[2]; + $value['href'] = $val[2]; // 搜索链接信息中的字段信息 - preg_replace_callback('/\[([a-z_]+)\]/', function($match) use(&$fields){$fields[]=$match[1];}, $value['href']); + preg_replace_callback('/\[([a-z_]+)\]/', function ($match) use (&$fields) { + $fields[] = $match[1]; + }, $value['href']); } - if(strpos($val[1],'|')){ + if (strpos($val[1], '|')) { // 显示格式定义 - list($value['title'],$value['format']) = explode('|',$val[1]); + list($value['title'], $value['format']) = explode('|', $val[1]); } - foreach($field as $val){ - $array = explode('|',$val); + foreach ($field as $val) { + $array = explode('|', $val); $fields[] = $array[0]; } } @@ -1591,33 +1637,37 @@ class PromoteController extends BaseController $fields[] = 'grand_id'; // 过滤重复字段信息 - $fields = array_unique($fields); + $fields = array_unique($fields); // 关键字搜索 - $map = $extend_map; - $key = $model['search_key']?$model['search_key']:'title'; - if(isset($_REQUEST[$key])){ - $map[$key] = array('like','%'.$_GET[$key].'%'); + $map = $extend_map; + $key = $model['search_key'] ? $model['search_key'] : 'title'; + if (isset($_REQUEST[$key])) { + $map[$key] = array('like', '%' . $_GET[$key] . '%'); unset($_REQUEST[$key]); } // 条件搜索 - foreach($_REQUEST as $name=>$val){ - if(in_array($name,$fields)){ - $map[$name] = $val; + foreach ($_REQUEST as $name => $val) { + if (in_array($name, $fields)) { + $map[$name] = $val; } } - if(isset($_REQUEST['row'])) {$row = $_REQUEST['row'];}else{$row = 10;} + if (isset($_REQUEST['row'])) { + $row = $_REQUEST['row']; + } else { + $row = 10; + } //读取模型数据列表 - if($model['extend']){ - $name = get_table_name($model['id']); + if ($model['extend']) { + $name = get_table_name($model['id']); $parent = get_table_name($model['extend']); - $fix = C("DB_PREFIX"); + $fix = C("DB_PREFIX"); $key = array_search('id', $fields); - if(false === $key){ + if (false === $key) { array_push($fields, "{$fix}{$parent}.id as id"); } else { $fields[$key] = "{$fix}{$parent}.id as id"; @@ -1627,7 +1677,7 @@ class PromoteController extends BaseController $count = D($parent)->join("INNER JOIN {$fix}{$name} ON {$fix}{$parent}.id = {$fix}{$name}.id")->where($map)->count(); // 查询数据 - $data = D($parent) + $data = D($parent) ->join("INNER JOIN {$fix}{$name} ON {$fix}{$parent}.id = {$fix}{$name}.id") /* 查询指定字段,不指定则查询所有字段 */ ->field(empty($fields) ? true : $fields) @@ -1641,7 +1691,7 @@ class PromoteController extends BaseController ->select(); } else { - if($model['need_pk']){ + if ($model['need_pk']) { in_array('id', $fields) || array_push($fields, 'id'); } $name = parse_name(get_table_name($model['id']), true); @@ -1651,7 +1701,7 @@ class PromoteController extends BaseController // 查询条件 ->where($map) /* 默认通过id逆序排列 */ - ->order(empty($map['order'])?"id desc":$map['order']) + ->order(empty($map['order']) ? "id desc" : $map['order']) /* 数据分页 */ // ->page($page, $row)//需要查询所有数据 后面用数组分页,原因: 页面要排序 /* 执行查询 */ @@ -1661,38 +1711,40 @@ class PromoteController extends BaseController } //分页 - $page = set_pagination($count,$row); - if($page) {$this->assign('_page', $page);} + $page = set_pagination($count, $row); + if ($page) { + $this->assign('_page', $page); + } - $data = $this->parseDocumentList($data,$model['id']); - if(isset($extend_map['for_show_pic_list'])){ - if($extend_map['for_show_pic_list']=='icon'){ + $data = $this->parseDocumentList($data, $model['id']); + if (isset($extend_map['for_show_pic_list'])) { + if ($extend_map['for_show_pic_list'] == 'icon') { foreach ($data as $key => $value) { - $data[$key]['pic_path']=get_cover($value['icon'],'path'); + $data[$key]['pic_path'] = get_cover($value['icon'], 'path'); } } - if($extend_map['for_show_pic_list']=='novice'){ + if ($extend_map['for_show_pic_list'] == 'novice') { foreach ($data as $key => $value) { - $data[$key]['novice']=arr_count($value['novice']); + $data[$key]['novice'] = arr_count($value['novice']); } } } - if($_REQUEST['data_order']!=''){ - $data_order=reset(explode(',',$_REQUEST['data_order'])); - $data_order_type=end(explode(',',$_REQUEST['data_order'])); - $this->assign('userarpu_order',$data_order); - $this->assign('userarpu_order_type',$data_order_type); + if ($_REQUEST['data_order'] != '') { + $data_order = reset(explode(',', $_REQUEST['data_order'])); + $data_order_type = end(explode(',', $_REQUEST['data_order'])); + $this->assign('userarpu_order', $data_order); + $this->assign('userarpu_order_type', $data_order_type); } - $data=my_sort($data,$data_order_type,(int)$data_order); - $size=$row;//每页显示的记录数 + $data = my_sort($data, $data_order_type, (int)$data_order); + $size = $row;//每页显示的记录数 $pnum = ceil(count($data) / $size); //总页数,ceil()函数用于求大于数字的最小整数 //用array_slice(array,offset,length) 函数在数组中根据条件取出一段值;array(数组),offset(元素的开始位置),length(组的长度) - $data = array_slice($data, ($arraypage-1)*$size, $size); + $data = array_slice($data, ($arraypage - 1) * $size, $size); $this->assign('model', $model); $this->assign('list_grids', $grids); $this->assign('list_data', $data); - $this->meta_title = $model['title'].'列表'; + $this->meta_title = $model['title'] . '列表'; $this->display($model['template_list']); } @@ -1701,31 +1753,32 @@ class PromoteController extends BaseController * @param array $list 列表数据 * @param integer $model_id 模型id */ - protected function parseDocumentList($list,$model_id=null){ + protected function parseDocumentList($list, $model_id = null) + { $model_id = $model_id ? $model_id : 1; - $attrList = get_model_attribute($model_id,false,'id,name,type,extra'); + $attrList = get_model_attribute($model_id, false, 'id,name,type,extra'); // 对列表数据进行显示处理 - if(is_array($list)){ - foreach ($list as $k=>$data){ - foreach($data as $key=>$val){ - if(isset($attrList[$key])){ - $extra = $attrList[$key]['extra']; - $type = $attrList[$key]['type']; - if('select'== $type || 'checkbox' == $type || 'radio' == $type || 'bool' == $type) { + if (is_array($list)) { + foreach ($list as $k => $data) { + foreach ($data as $key => $val) { + if (isset($attrList[$key])) { + $extra = $attrList[$key]['extra']; + $type = $attrList[$key]['type']; + if ('select' == $type || 'checkbox' == $type || 'radio' == $type || 'bool' == $type) { // 枚举/多选/单选/布尔型 - $options = parse_field_attr($extra); - if($options && array_key_exists($val,$options)) { - $data[$key] = $options[$val]; + $options = parse_field_attr($extra); + if ($options && array_key_exists($val, $options)) { + $data[$key] = $options[$val]; } - }elseif('date'==$type){ // 日期型 - $data[$key] = date('Y-m-d',$val); - }elseif('datetime' == $type){ // 时间型 - $data[$key] = date('Y-m-d H:i:s',$val); + } elseif ('date' == $type) { // 日期型 + $data[$key] = date('Y-m-d', $val); + } elseif ('datetime' == $type) { // 时间型 + $data[$key] = date('Y-m-d H:i:s', $val); } } } $data['model_id'] = $model_id; - $list[$k] = $data; + $list[$k] = $data; } } return $list; @@ -1759,17 +1812,16 @@ class PromoteController extends BaseController $id = strtoupper($id); $regx = "/(^\d{15}$)|(^\d{17}([0-9]|X)$)/"; $arr_split = array(); - if(!preg_match($regx, $id)) { + if (!preg_match($regx, $id)) { return false; } - if (15==strlen($id)) { + if (15 == strlen($id)) { $regx = "/^(\d{6})+(\d{2})+(\d{2})+(\d{2})+(\d{3})$/"; @preg_match($regx, $id, $arr_split); //检查生日日期是否正确 - $dtm_birth = "19".$arr_split[2] . '/' . $arr_split[3]. '/' .$arr_split[4]; - if(!strtotime($dtm_birth)) - { + $dtm_birth = "19" . $arr_split[2] . '/' . $arr_split[3] . '/' . $arr_split[4]; + if (!strtotime($dtm_birth)) { return false; } else { return true; @@ -1777,8 +1829,8 @@ class PromoteController extends BaseController } else { $regx = "/^(\d{6})+(\d{4})+(\d{2})+(\d{2})+(\d{3})([0-9]|X)$/"; @preg_match($regx, $id, $arr_split); - $dtm_birth = $arr_split[2] . '/' . $arr_split[3]. '/' .$arr_split[4]; - if(!strtotime($dtm_birth)) { + $dtm_birth = $arr_split[2] . '/' . $arr_split[3] . '/' . $arr_split[4]; + if (!strtotime($dtm_birth)) { return false; } else { //检验18位身份证的校验码是否正确。 @@ -1786,14 +1838,14 @@ class PromoteController extends BaseController $arr_int = array(7, 9, 10, 5, 8, 4, 2, 1, 6, 3, 7, 9, 10, 5, 8, 4, 2); $arr_ch = array('1', '0', 'X', '9', '8', '7', '6', '5', '4', '3', '2'); $sign = 0; - for ( $i = 0; $i < 17; $i++ ) { - $b = (int) $id{$i}; + for ($i = 0; $i < 17; $i++) { + $b = (int)$id{$i}; $w = $arr_int[$i]; $sign += $b * $w; } $n = $sign % 11; $val_num = $arr_ch[$n]; - if ($val_num != substr($id,17, 1)) { + if ($val_num != substr($id, 17, 1)) { return false; } else { return true; @@ -1803,20 +1855,63 @@ class PromoteController extends BaseController } - function ajax_page($count, $row,$ajax_func='index',$current=1) { + function ajax_page($count, $row, $ajax_func = 'index', $current = 1) + { $aside = ''; - $count=$count?$count:0; - $row=$row?$row:10; + $count = $count ? $count : 0; + $row = $row ? $row : 10; if ($count > $row) { - $p = new \Think\AjaxPage($count,$row,$ajax_func); - $p->nowpage($count,$row,$current,$ajax_func); + $p = new \Think\AjaxPage($count, $row, $ajax_func); + $p->nowpage($count, $row, $current, $ajax_func); $p->setConfig('theme', '%first% %upPage% %linkPage% %downPage% %end% %header%'); //产生分页信息 - $html=$p->show(); - return "
".$html."
"; + $html = $p->show(); + return "
" . $html . "
"; } else { //return '
' .$aside. '共 '.$count.' 条记录
'; - return '
共 '.$count.' 条记录
'; + return '
共 ' . $count . ' 条记录
'; + } + } + + public function setChildGamePermission() + { + $parentId = getParentPromoteId(PID);//上级ID + if ($parentId > 0) { + $this->error('权限异常'); + } + + $securityCode = empty(session('game_divide_second_pwd')) ? '' : session('game_divide_second_pwd');//安全密码 + $model = new PromoteApi(); + $res = $model->verify_er_User(PID, $securityCode);//验证安全密码 + if ($_POST) { + if (!$res) { + $data['status'] = 0; + $data['msg'] = '权限异常'; + + $this->ajaxReturn($data); + } + + $save['child_game_permission'] = I('post.child_game_permission'); + $saveRes = D('Promote')->where(array('id' => PID))->save($save); + if ($saveRes === false) { + $data['status'] = 0; + $data['msg'] = '保存失败'; + } else { + $data['status'] = 1; + $data['msg'] = '保存成功'; + } + + $this->ajaxReturn($data); + } else { + if ($res) { + $map['id'] = PID; + $promoteData = D('Promote')->field('id,child_game_permission')->where($map)->find(); + + $this->assign('data', $promoteData); + } + + $this->meta_title = "设置"; + $this->display(); } } } diff --git a/Application/Home/Controller/QueryController.class.php b/Application/Home/Controller/QueryController.class.php index 3382bdd5b..80c8e6599 100644 --- a/Application/Home/Controller/QueryController.class.php +++ b/Application/Home/Controller/QueryController.class.php @@ -99,7 +99,7 @@ class QueryController extends BaseController $map['tab_spend.is_check'] = ['neq', 2]; $data = M('Spend', 'tab_') - ->field('tab_spend.*,tab_promote.account as pro_account,tab_promote.real_name as pro_real_name,tab_promote.grand_id as pro_grand_id') + ->field('tab_spend.*,tab_promote.account as pro_account,tab_promote.real_name as pro_real_name,tab_promote.grand_id as pro_grand_id,tab_promote.parent_id as pro_parent_id') ->join('tab_game on tab_spend.game_id = tab_game.id') ->join('left join tab_promote on tab_spend.promote_id = tab_promote.id') ->where($map) @@ -114,6 +114,14 @@ class QueryController extends BaseController if (!empty($data)) { foreach ($data as &$list) { + if ($list['pro_grand_id'] > 0) { + $thisPromoteData = D('Promote') + ->field('account,real_name') + ->where(array('id' => $list['pro_parent_id'])) + ->find(); + $list['p_pro_account'] = $thisPromoteData['account']; + $list['p_pro_real_name'] = $thisPromoteData['real_name']; + } $list['user_account'] = substr($list['user_account'], 0, 2) . '******' . substr($list['user_account'], 8); } } @@ -148,7 +156,7 @@ class QueryController extends BaseController $this->assign('pID', PID); $this->assign('ownId', I('own_id')); $this->assign('payWayData', QueryController::$payWay); - $this->meta_title = "充值明细"; + $this->meta_title = "订单查询"; $this->display(); } @@ -950,7 +958,7 @@ class QueryController extends BaseController $allData['spend_voucher'] = 0; foreach ($data as &$list) { $thisDateTime = strtotime($list['day']); - $userPlayInfoWhere['tab_user_play_info.play_time'] = ['between', [$thisDateTime, $thisDateTime + 86399]]; + $userPlayInfoWhere['tab_user_play_info.create_time'] = ['between', [$thisDateTime, $thisDateTime + 86399]]; $userGameLoginWhere['tab_user_game_login_record.login_time'] = ['between', [$thisDateTime, $thisDateTime + 86399]]; $spendWhere['tab_spend.pay_time'] = ['between', [$thisDateTime, $thisDateTime + 86399]]; @@ -968,7 +976,7 @@ class QueryController extends BaseController ->group('tab_user_play_info.user_id') ->select());//创角用户 - $newUserSql = '(select count(ti.id) from tab_user_play_info as ti where ti.user_id = tab_user_play_info.user_id and ti.game_id = tab_user_play_info.game_id and ti.play_time < ' . $thisDateTime . $newWhere . ') as old_num'; + $newUserSql = '(select count(ti.id) from tab_user_play_info as ti where ti.user_id = tab_user_play_info.user_id and ti.game_id = tab_user_play_info.game_id and ti.create_time < ' . $thisDateTime . $newWhere . ') as old_num'; $list['new_user_num'] = count($userPlayInfoModel ->field($newUserSql) ->join($join) @@ -977,15 +985,24 @@ class QueryController extends BaseController ->group('tab_user_play_info.user_id') ->having('old_num = 0') ->select());//新创角用户 - $list['new_device_num'] = 0;//新创角设备 - $newIpSql = '(select count(ti.id) from tab_user_play_info as ti where ti.play_ip = tab_user_play_info.play_ip and ti.game_id = tab_user_play_info.game_id and ti.play_time < ' . $thisDateTime . $newWhere . ') as old_num'; + $newDeviceSql = '(select count(ti.id) from tab_user_play_info as ti where ti.create_device_number = tab_user_play_info.create_device_number and ti.game_id = tab_user_play_info.game_id and ti.create_time < ' . $thisDateTime . $newWhere . ') as old_num'; + $list['new_device_num'] = count($userPlayInfoModel + ->field($newDeviceSql) + ->join($join) + ->where($userPlayInfoWhere) + ->where($map) + ->group('tab_user_play_info.create_device_number') + ->having('old_num = 0') + ->select());//新创角设备 + + $newIpSql = '(select count(ti.id) from tab_user_play_info as ti where ti.create_ip = tab_user_play_info.create_ip and ti.game_id = tab_user_play_info.game_id and ti.create_time < ' . $thisDateTime . $newWhere . ') as old_num'; $list['new_ip_num'] = count($userPlayInfoModel ->field($newIpSql) ->join($join) ->where($userPlayInfoWhere) ->where($map) - ->group('tab_user_play_info.play_ip') + ->group('tab_user_play_info.create_ip') ->having('old_num = 0') ->fetchSql(true) ->select());//新增创角IP @@ -1207,7 +1224,7 @@ class QueryController extends BaseController $newWhere = ''; $begTime = strtotime($initBegTime); $endTime = strtotime($initEndTime); - $userPlayInfoWhere['tab_user_play_info.play_time'] = ['between', [$begTime, $endTime + 86399]]; + $userPlayInfoWhere['tab_user_play_info.create_time'] = ['between', [$begTime, $endTime + 86399]]; $userGameLoginWhere['tab_user_game_login_record.login_time'] = ['between', [$begTime, $endTime + 86399]]; $spendWhere['tab_spend.pay_time'] = ['between', [$begTime, $endTime + 86399]]; $spendWhere['tab_spend.pay_status'] = 1; @@ -1230,7 +1247,7 @@ class QueryController extends BaseController ->group('tab_user_play_info.user_id') ->select());//创角用户 - $newUserSql = '(select count(ti.id) from tab_user_play_info as ti where ti.user_id = tab_user_play_info.user_id and ti.game_id = tab_user_play_info.game_id and ti.play_time < ' . $begTime . $newWhere . ') as old_num'; + $newUserSql = '(select count(ti.id) from tab_user_play_info as ti where ti.user_id = tab_user_play_info.user_id and ti.game_id = tab_user_play_info.game_id and ti.create_time < ' . $begTime . $newWhere . ') as old_num'; $list['new_user_num'] = count($userPlayInfoModel ->field($newUserSql) ->where($userPlayInfoWhere) @@ -1238,13 +1255,19 @@ class QueryController extends BaseController ->having('old_num = 0') ->select());//新创角用户 - $list['new_device_num'] = 0;//新创角设备 + $newDeviceSql = '(select count(ti.id) from tab_user_play_info as ti where ti.create_device_number = tab_user_play_info.create_device_number and ti.game_id = tab_user_play_info.game_id and ti.create_time < ' . $begTime . $newWhere . ') as old_num'; + $list['new_device_num'] = count($userPlayInfoModel + ->field($newDeviceSql) + ->where($userPlayInfoWhere) + ->group('tab_user_play_info.create_device_number') + ->having('old_num = 0') + ->select());//新创角设备 - $newIpSql = '(select count(ti.id) from tab_user_play_info as ti where ti.play_ip = tab_user_play_info.play_ip and ti.game_id = tab_user_play_info.game_id and ti.play_time < ' . $begTime . $newWhere . ') as old_num'; + $newIpSql = '(select count(ti.id) from tab_user_play_info as ti where ti.create_ip = tab_user_play_info.create_ip and ti.game_id = tab_user_play_info.game_id and ti.create_time < ' . $begTime . $newWhere . ') as old_num'; $list['new_ip_num'] = count($userPlayInfoModel ->field($newIpSql) ->where($userPlayInfoWhere) - ->group('tab_user_play_info.play_ip') + ->group('tab_user_play_info.create_ip') ->having('old_num = 0') ->fetchSql(true) ->select());//新增创角IP @@ -1880,6 +1903,7 @@ class QueryController extends BaseController } $this->assign('list_data', $spendData); + $this->meta_title = "订单详情"; $this->display('view_spend_detailed'); } } diff --git a/Application/Home/Controller/TestResourceController.class.php b/Application/Home/Controller/TestResourceController.class.php index fd71fce1a..acbdb29c7 100644 --- a/Application/Home/Controller/TestResourceController.class.php +++ b/Application/Home/Controller/TestResourceController.class.php @@ -3,10 +3,125 @@ namespace Home\Controller; +use Home\Model\SupportModel; + class TestResourceController extends BaseController { public function test(){ echo 'test1'; } + + public function supportNumberList($p = 1) { + $page = intval($p); + $page = $page ? $page : 1; //默认显示第一页数据 + $row=10; + if(isset($_REQUEST['row'])) {$row = $_REQUEST['row'];}else{$row = 10;} + + $map = []; + if(!empty(I('server_name'))){ + $map['server_name']=I('server_name'); + } + if(!empty(I('game_name'))){ + $map['game_name']=I('game_name'); + } + if(!empty(I('role_name'))){ + $map['tab_support.role_name']=['like','%'.I('role_name').'%']; + } + if(!empty(I('user_account'))){ + $map['user_account']=I('user_account'); + } + if(!empty(I('promote_name'))){ + $map['tab_support.promote_account']=I('promote_name'); + } + + $data = M('support','tab_') + ->field('tab_support.id,tab_support.role_name,tab_support.game_name,tab_support.promote_account,tab_support.create_time,user_account,role_name,server_name,freeze,user.device_number') + ->join('left join tab_user as user on tab_support.user_id = user.id') + ->where($map) + ->page($page,$row) + ->select(); + + foreach ($data as $key => $value) { + $data[$key]['create_time'] = date('Y-m-d H:m:i',$value['create_time']); + } + + $count = M('support','tab_') + ->field('tab_support.role_name,tab_support.game_id,tab_support.promote_id,tab_support.create_time,user_account,role_name,server_name,freeze,user.device_number') + ->join('left join tab_user as user on tab_support.user_id = user.id') + ->where($map) + ->select(); + $count = count($count); + + $page = set_pagination($count,$row); + if($page) {$this->assign('_page', $page);} + + $this->assign('data',$data); +// var_dump($data); + + $this->display(); + + } + + public function freezeSupport() { + $supportId = I('support_id', 0); + if ($supportId == 0) { + $this->ajaxReturn(['status'=>0,'msg'=>"参数错误"]); + } + + $isFreeze = D('support')->froze($supportId); + if ($isFreeze) { + $this->ajaxReturn(['status'=>1, 'msg'=> '冻结成功']); + } else { + $this->ajaxReturn(['status'=>0, 'msg'=> '冻结失败']); + } + } + + public function unfreezeSupport() { + $supportId = I('support_id', 0); + if ($supportId == 0) { + $this->ajaxReturn(['status'=>0,'msg'=>"参数错误"]); + } + + $isFreeze = D('support')->unfreeze($supportId); + if ($isFreeze) { + $this->ajaxReturn(['status'=>1, 'msg'=> '启用成功']); + } else { + $this->ajaxReturn(['status'=>0, 'msg'=> '启用失败']); + } + } + + public function rechangePassward() { + $supportId = I('support_id', 0); + if ($supportId == 0) { + $this->ajaxReturn(['status'=>0,'msg'=>"参数错误"]); + } + + $passward = D('support')->rechangePassward($supportId); + if ($passward) { + $this->ajaxReturn(['status'=>1, 'msg'=> '新密码:'.$passward]); + } else { + $this->ajaxReturn(['status'=>0, 'msg'=> '重置密码失败']); + } + } + + /** + * 获取区服列表 + * @param $game_id + */ + public function getServer($game_id=""){ + $map['game_id']=$game_id; + $map['start_time']=['lt',time()]; + if(I('status')==2){ + $map['show_status']=1; + } + $data = M('server','tab_') + ->field('tab_server.server_name,support_quota') + ->where($map) + ->join('join tab_game tg ON tg.id=tab_server.game_id') + ->select(); + + $this->AjaxReturn($data); + } + } \ No newline at end of file diff --git a/Application/Home/Model/SupportModel.class.php b/Application/Home/Model/SupportModel.class.php new file mode 100644 index 000000000..b2afb7b8c --- /dev/null +++ b/Application/Home/Model/SupportModel.class.php @@ -0,0 +1,107 @@ + +// +---------------------------------------------------------------------- + +namespace Home\Model; +use Think\Model; + +/** + * 分类模型 + */ +class SupportModel extends Model{ + + protected $_validate = array( + + ); + + protected $_auto = array( + ); + + /** + * 构造函数 + * @param string $name 模型名称 + * @param string $tablePrefix 表前缀 + * @param mixed $connection 数据库连接信息 + */ + public function __construct($name = '', $tablePrefix = '', $connection = '') { + /* 设置默认的表前缀 */ + $this->tablePrefix ='tab_'; + /* 执行构造方法 */ + parent::__construct($name, $tablePrefix, $connection); + } + + + /** + * 按照时间分组统计注册总数 + * @param integer $id 数据库表行id + */ + public function froze($id) { + $data = [ + 'freeze' => 0 + ]; + + return $this->where("id=".$id)->save($data); + } + + /** + * 按照时间分组统计注册总数 + * @param integer $id 数据库表行id + */ + public function unfreeze($id) + { + $data = [ + 'freeze' => 1 + ]; + return $this->where("id=".$id)->save($data); + } + + public function rechangePassward($id) { + + $passward = $this->getRandomPassword(6); + + $data = [ + 'user_password' => base64_encode($passward) + ]; + + if ($this->where("id=".$id)->save($data)) { + return $passward; + } else { + return false; + } + + } + + private function getRandomPassword($length, $special = true){ + $chars = array( + 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', + 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', + 'w', 'x', 'y', 'z', 'A', 'B', 'C', 'D', 'E', 'F', 'G', + 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', + 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', '0', '1', '2', + '3', '4', '5', '6', '7', '8', '9' + ); + + if($special){ + $chars = array_merge($chars, array( + '!', '@', '#', '$', '?', '|', '{', '/', ':', ';', + '%', '^', '&', '*', '(', ')', '-', '_', '[', ']', + '}', '<', '>', '~', '+', '=', ',', '.' + )); + } + + $charsLen = count($chars) - 1; + shuffle($chars); + + $password = ''; + for($i=0; $i<$length; $i++){ + $password .= $chars[mt_rand(0, $charsLen)]; + } + return $password; + } + +} diff --git a/Application/Home/View/default/Apply/feature.html b/Application/Home/View/default/Apply/feature.html new file mode 100644 index 000000000..5899f9518 --- /dev/null +++ b/Application/Home/View/default/Apply/feature.html @@ -0,0 +1,750 @@ + + + + + + + + + + + + + +
+
+
+
当前位置:游戏管理>资料专区
+
+ 资料专区 +
+
+ +
+
+
    + +
      +
    • + +

      暂无数据

      +
    • +
    + + +
  • +
    +
    + +
    +
    +
    + + 《{$vo.relation_game_name}》产品资料 + + 《{$vo.game_name}》产品资料 + +
    +

    {$vo.features}

    + +
    +
    + + + 查看详情 +
    +
    +
  • +
    +
    +
+
+
+ {$_page} +
+
+
+
+ +
+
+ +
+
+
+ + + + + + + diff --git a/Application/Home/View/default/Apply/index.html b/Application/Home/View/default/Apply/index.html index b97fa4100..8746e93da 100644 --- a/Application/Home/View/default/Apply/index.html +++ b/Application/Home/View/default/Apply/index.html @@ -108,7 +108,7 @@
-
当前位置:游戏管理>游戏列表
+
当前位置:游戏管理>{$position}
游戏列表
@@ -118,37 +118,31 @@ 全部游戏 - 全部游戏 + 全部游戏 Android+ios游戏 - Android+ios游戏 + Android+ios游戏 IOS游戏 - IOS游戏 + IOS游戏 Android游戏 - Android游戏 + Android游戏 - 我的游戏 + 我的游戏
- - - - - -
@@ -186,7 +180,7 @@
-
@@ -434,7 +428,7 @@ thisElement.addClass('highlight'); if (promoteRole == 1) { - location.href = "{:U('index', array('type' => $type))}"; + location.href = "{:U($game, array('type' => $type))}"; } else { getPromoteListByRole(promoteRole); } @@ -640,7 +634,7 @@ success: function (res) { if (res.status) { $(obj).attr("onclick", "").html("申请成功").addClass("proc wait"); - location.href = "{:U('index')}"; + location.href = "{:U($game)}"; } else { layer.msg(res.msg, {icon: 2}); } @@ -800,7 +794,7 @@ } //导航高亮 - highlight_subnav('{:U("Apply / index")}'); + highlight_subnav('{:U("Apply/".$game)}'); //查看游戏详情 function viewGameDetailed(id) { diff --git a/Application/Home/View/default/Apply/my_game.html b/Application/Home/View/default/Apply/my_game.html index 6b476d5b6..71be12117 100644 --- a/Application/Home/View/default/Apply/my_game.html +++ b/Application/Home/View/default/Apply/my_game.html @@ -92,17 +92,17 @@
-
当前位置:游戏管理>我的游戏
+
当前位置:游戏管理>{$position}
- 游戏列表 + 我的游戏
+ + + +
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
产品名称区服测试账号所属推广员角色名称设备信息状态创建时间操作

暂无数据

{$s.game_name}{$s.server_name}{$s.user_account}{$s.promote_account}{$s.role_name} + 尚未登录,无设备号 + {$s.device_number} + + + 冻结 + 启用 + + {$s.create_time} + + 冻结 + + 启用 + + + 重置密码 +
+ +
{$_page}
+
+
+
+
+ + + + + + + + + + diff --git a/Application/Mobile/Controller/SsgController.class.php b/Application/Mobile/Controller/SsgController.class.php index 354e53961..894fbe205 100644 --- a/Application/Mobile/Controller/SsgController.class.php +++ b/Application/Mobile/Controller/SsgController.class.php @@ -19,20 +19,26 @@ class SsgController extends BaseController { const RETURN_FALSE = 2; - public function login(){ + public function login() + { + $promoteId = I("promote_id", 0); $user = session("user_auth"); - $promoteId = I("promote_id"); - if (!$promoteId) { - $this->error("参数非法"); - } - $exists = M("promote", "tab_")->where(array('id' => $promoteId))->find(); - if (!$exists) { - $this->error("参数非法."); + if ($user) { + redirect(U("ssg/index", array('promete_id' => $promoteId))); } - - /*if ($user) { - redirect(U("ssg/index")); + + /*if (!$promoteId) { + echo "链接失效,请重新向推广员索取链接。"; + exit(); + $this->error("参数非法"); }*/ + if ($promoteId) { + $exists = M("promote", "tab_")->where(array('id' => $promoteId))->find(); + if (!$exists) { + $this->error("链接失效,请重新向推广员索取链接."); + } + } + $this->assign("promote_id", $promoteId); $this->display(); } @@ -46,13 +52,16 @@ class SsgController extends BaseController { { $account = I("Account"); $password = I("Password"); - $promoteId = I("promote_id"); - if (!$promoteId) { + $promoteId = I("promote_id", 0); + /*if (!$promoteId) { $this->ajaxReturn(array("ErrorCode" => -97, "ResultMsg" => "参数非法")); - } - $promote = M("promote", "tab_")->where(array('id' => $promoteId))->find(); - if (!$promote) { - $this->ajaxReturn(array("ErrorCode" => -97, "ResultMsg" => "参数非法.")); + }*/ + $promote = array(); + if ($promoteId) { + $promote = M("promote", "tab_")->where(array('id' => $promoteId))->find(); + if (!$promote) { + $this->ajaxReturn(array("ErrorCode" => -97, "ResultMsg" => "参数非法.")); + } } //var_dump($password); @@ -85,7 +94,7 @@ class SsgController extends BaseController { $user = M('user', 'tab_')->where(array( 'id' => $user_id ))->find(); - if (!$user['promote_id']) { + if (!$user['promote_id'] && $promote) { M('user', 'tab_')->where(array( 'id' => $user_id ))->save(array( diff --git a/Application/Mobile/Controller/UserController.class.php b/Application/Mobile/Controller/UserController.class.php index de17feae5..ee9a0d913 100644 --- a/Application/Mobile/Controller/UserController.class.php +++ b/Application/Mobile/Controller/UserController.class.php @@ -231,7 +231,7 @@ class UserController extends BaseController $userData = M('User', 'tab_')->where($whereUser)->find(); if (!empty($userData)) { - if (empty($userData['promote_id'])) { + if (empty($userData['promote_id']) && empty($userData['promote_account'])) { $saveData['promote_id'] = $promoteId; $saveData['promote_account'] = $promoteData['account']; diff --git a/Application/Mobile/View/Ssg/login.html b/Application/Mobile/View/Ssg/login.html index 31367ac15..ff0a56119 100644 --- a/Application/Mobile/View/Ssg/login.html +++ b/Application/Mobile/View/Ssg/login.html @@ -38,7 +38,7 @@
- +
diff --git a/Application/Sdk/Controller/Ipa365Controller.class.php b/Application/Sdk/Controller/Ipa365Controller.class.php index aadb1c3d9..3b62fb913 100644 --- a/Application/Sdk/Controller/Ipa365Controller.class.php +++ b/Application/Sdk/Controller/Ipa365Controller.class.php @@ -7,8 +7,16 @@ use Mobile\Controller\SsgController; // a8eeac3335cef5ee117d357738598f691932513b class Ipa365Controller extends BaseController{ const signprice = 10; // 超级签价格 + public $userinfo; + + public function __construct() { + $this->userinfo = $_SESSION['onethink_home']['user_auth']; + parent::__construct(); + } public function test(){ + $user = $this->userinfo; + pp($user); die(); $ipa365 = new Ipa365Controller(); $result = $ipa365->pay_notify(array( @@ -95,7 +103,7 @@ class Ipa365Controller extends BaseController{ * 发起支付 */ public function pay() { - $userId = $_SESSION['user_id']; + $userId = $this->userinfo['user_id']; if (!$userId ) { $this->error("请登入", "/mobile.php/ssg/login"); } @@ -165,8 +173,13 @@ class Ipa365Controller extends BaseController{ } - + // 微信分享页面 public function paytip(){ + $userId = $this->userinfo['user_id']; + if (!$userId ) { + $this->error("请登入", "/mobile.php/ssg/login"); + } + $orderId = I('order_id'); $payLog = M('game_supersign', 'tab_')->where(array( @@ -214,11 +227,15 @@ class Ipa365Controller extends BaseController{ public function install_show() { $orderId = I('order_id', 0); $gameId = I('game_id', 0); - $userId = I('user_id', 0); + /* $userId = I('user_id', 0); $user = M('user', 'tab_')->where(array( 'id' => $userId - ))->find(); + ))->find(); */ + $userId = $this->userinfo['user_id']; + if (!$userId ) { + $this->error("请登入", "/mobile.php/ssg/login"); + } // $userId = $_SESSION['user_id']; if (!$userId ) { @@ -250,7 +267,7 @@ class Ipa365Controller extends BaseController{ * 获取用户安装历史url */ public function get_install_list() { - $gameId = I('game_id', 0); + /* $gameId = I('game_id', 0); $where = array( 'pay_status' => 1, 'ticket' => array('neq', '') @@ -261,14 +278,14 @@ class Ipa365Controller extends BaseController{ // pp($list); $url = $game['supersign_url']."?code={$code}"; pp($url); - redirect($url); + redirect($url); */ } /** * 用户点击安装 */ public function install() { - $userId = I('user_id', 0); + $userId = $this->userinfo['user_id']; if (!$userId ) { $this->error("请登入", "/mobile.php/ssg/login"); } @@ -342,7 +359,11 @@ class Ipa365Controller extends BaseController{ * 打包列表 */ public function pay_list() { - $userId = 0; + $userId = $this->userinfo['user_id']; + if (!$userId ) { + $this->error("请登入", "/mobile.php/ssg/login"); + } + $list = M('game_supersion', 'tab_')->where(array( 'user_id' => $userId, ))->select(); diff --git a/Application/User/Api/PromoteApi.class.php b/Application/User/Api/PromoteApi.class.php index f752192a9..d57581935 100644 --- a/Application/User/Api/PromoteApi.class.php +++ b/Application/User/Api/PromoteApi.class.php @@ -119,7 +119,7 @@ class PromoteApi extends Api{ return $this->model->verifyUser($uid,$password_in); } public function verify_er_User($uid, $password_in){ - return $this->model->verifyUser($uid,$password_in); + return $this->model->verify_er_User($uid,$password_in); } diff --git a/Data/update.sql b/Data/update.sql index 95a8b522c..cfc582ede 100644 --- a/Data/update.sql +++ b/Data/update.sql @@ -63,5 +63,20 @@ INSERT INTO `tab_promote_quick_menu` VALUES ('18', '1', '1', '1569720739'); 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路径'; +-- ---------------------------- +-- 2019-10-08 cxj +-- ---------------------------- +ALTER TABLE `tab_game` ADD COLUMN `server_type` tinyint(2) NOT NULL DEFAULT 1 COMMENT '1-专服 2-混服' AFTER `support_ratio`; +ALTER TABLE `tab_game` ADD COLUMN `detail_content` MEDIUMTEXT NULL DEFAULT NULL COMMENT '游戏资料介绍' AFTER `features`; + +-- ---------------------------- +-- 2019-10-10 cxj +-- ---------------------------- +ALTER TABLE `tab_promote` ADD COLUMN `child_game_permission` tinyint(2) NOT NULL DEFAULT 0 COMMENT '下级游戏添加权限 0-本账号已添加游戏 1-所有游戏' AFTER `idcard`; + +-- ---------------------------- +-- 2019-10-11 zyx +-- ---------------------------- +ALTER TABLE `tab_support` ADD COLUMN `freeze` tinyint(2) NOT NULL DEFAULT 1 COMMENT '0-冻结 1-启用' AFTER `notice_status`; -- 2019-10-11 cxj ALTER TABLE `tab_apply` ADD COLUMN `bale_sort` int(5) NOT NULL DEFAULT 0 COMMENT '打包顺序' AFTER `offline_status`; \ No newline at end of file diff --git a/Uploads/Editor/2019-10-10/5d9e9fdaba243.png b/Uploads/Editor/2019-10-10/5d9e9fdaba243.png new file mode 100644 index 000000000..006f29a72 Binary files /dev/null and b/Uploads/Editor/2019-10-10/5d9e9fdaba243.png differ