From 1561e719778b84834764a8eb174d73eeb55a3557 Mon Sep 17 00:00:00 2001 From: chenxiaojun <956334972@qq.com> Date: Tue, 5 Nov 2019 17:04:38 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8E=A8=E5=B9=BF=E5=90=8E=E5=8F=B0->=E9=AA=8C?= =?UTF-8?q?=E8=AF=81=E5=AE=89=E5=85=A8=E5=AF=86=E7=A0=81--=E6=9B=B4?= =?UTF-8?q?=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Home/Controller/BaseController.class.php | 291 ++++++++++-------- .../Controller/FinanceController.class.php | 9 +- .../Controller/GameDivideController.class.php | 27 +- .../Controller/PromoteController.class.php | 9 +- .../View/default/Finance/settlementDtl.html | 215 +++++-------- .../Home/View/default/GameDivide/index.html | 244 +++++---------- .../Promote/setChildGamePermission.html | 80 +---- .../View/default/Public/verify_password.html | 198 ++++++++++++ 8 files changed, 555 insertions(+), 518 deletions(-) create mode 100644 Application/Home/View/default/Public/verify_password.html diff --git a/Application/Home/Controller/BaseController.class.php b/Application/Home/Controller/BaseController.class.php index b43c29817..c168b29ad 100644 --- a/Application/Home/Controller/BaseController.class.php +++ b/Application/Home/Controller/BaseController.class.php @@ -1,7 +1,11 @@ login(); - + $loginer = $this->getLoginPromote(); $pid = is_login_promote(); define('PLEVEL', $loginer['parent_id']); define('PID', $pid); - define('PROMOTE_ACCOUNT',session('promote_auth.account')); - - if($loginer['grand_id']>0) {/* 三级 */ - define('PRO_GRADE',3); - } elseif($loginer['parent_id']>0) {/* 二级 */ - define('PRO_GRADE',2); - define('SETTLEMENT_GRADE','third_status'); /* 给三级结算 */ - define('G_SETTLEMENT_GRADE','third_status'); + define('PROMOTE_ACCOUNT', session('promote_auth.account')); + + if ($loginer['grand_id'] > 0) {/* 三级 */ + define('PRO_GRADE', 3); + } elseif ($loginer['parent_id'] > 0) {/* 二级 */ + define('PRO_GRADE', 2); + define('SETTLEMENT_GRADE', 'third_status'); /* 给三级结算 */ + define('G_SETTLEMENT_GRADE', 'third_status'); } else {/* 一级 */ - define('PRO_GRADE',1); - define('SETTLEMENT_GRADE','sub_status'); /* 给二级结算 */ - define('G_SETTLEMENT_GRADE','sub_status,third_status'); + define('PRO_GRADE', 1); + define('SETTLEMENT_GRADE', 'sub_status'); /* 给二级结算 */ + define('G_SETTLEMENT_GRADE', 'sub_status,third_status'); } - + $this->assign('loginer', $loginer); $this->assign("parent_id", $loginer['parent_id']); $this->assign("grand_id", $loginer['grand_id']); - $result = M('site_apply','tab_')->where("promote_id=$pid")->getField('status'); - if($result['status'] == 1) { - $this -> assign('noapplysite', $result); + $result = M('site_apply', 'tab_')->where("promote_id=$pid")->getField('status'); + if ($result['status'] == 1) { + $this->assign('noapplysite', $result); } - if (in_array(CONTROLLER_NAME,array('SiteBase','SiteGame','SiteGift','SiteGroup','SiteServer','SiteAdv'))) { - if ($result != 1) { - $this->redirect('SiteApply/index',array('msg'=>1)); - } + if (in_array(CONTROLLER_NAME, array('SiteBase', 'SiteGame', 'SiteGift', 'SiteGroup', 'SiteServer', 'SiteAdv'))) { + if ($result != 1) { + $this->redirect('SiteApply/index', array('msg' => 1)); + } } } - - /* 用户登录检测 */ - protected function login(){ + protected function login() + { /* 用户登录检测 */ is_login_promote() || $this->error('您还没有登录,请先登录!', U('Index/index')); } @@ -56,10 +59,11 @@ class BaseController extends HomeController{ /** * 显示指定模型列表数据 - * @param String $model 模型标识 + * @param String $model 模型标识 * @author 麦当苗儿 */ - public function lists($model = null, $p = 0, $extend_map = array(), \Closure $appendCallback = null){ + public function lists($model = null, $p = 0, $extend_map = array(), \Closure $appendCallback = null) + { $model || $this->error('模型名标识必须!'); $page = intval($p); $page = $page ? $page : 1; //默认显示第一页数据 @@ -71,92 +75,105 @@ class BaseController extends HomeController{ //解析列表规则 $fields = array(); // 关键字搜索 - $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; + } + $name = parse_name(get_table_name($model['id']), true); - $data = M($name,"tab_") + $data = M($name, "tab_") /* 查询指定字段,不指定则查询所有字段 */ ->field(empty($fields) ? true : $fields) // 查询条件 ->where($map) /* 默认通过id逆序排列 */ - ->order($model['need_pk']?'id DESC':'') + ->order($model['need_pk'] ? 'id DESC' : '') /* 数据分页 */ ->page($page, $row) /* 执行查询 */ ->select(); /* 查询记录总数 */ - $count = M($name,"tab_")->where($map)->count(); - + $count = M($name, "tab_")->where($map)->count(); + //分页 - $parameter = $_POST; - $parameter['p']=I('get.p',1); - $parameter['row']=I('get.row'); - - $page = set_pagination($count,$row,$parameter); - if($page) {$this->assign('_page', $page);} - + $parameter = $_POST; + $parameter['p'] = I('get.p', 1); + $parameter['row'] = I('get.row'); + + $page = set_pagination($count, $row, $parameter); + if ($page) { + $this->assign('_page', $page); + } + $hasList = false; if ($appendCallback) { - $appends = $appendCallback($data); - foreach ($appends as $key => $value) { - if ($key == 'list_data') { - $hasList = true; + $appends = $appendCallback($data); + foreach ($appends as $key => $value) { + if ($key == 'list_data') { + $hasList = true; + } + $this->assign($key, $value); } - $this->assign($key, $value); - } } - - $this->assign("count",$count); + + $this->assign("count", $count); $this->assign('model', $model); $this->assign('list_grids', $grids); if ($hasList == false) { - $this->assign('list_data', $data); + $this->assign('list_data', $data); } - $this->meta_title = $model['title'].'列表'; + $this->meta_title = $model['title'] . '列表'; $this->display($model['template_list']); } - public function data_lists($p,$model,$extend=[]){ + public function data_lists($p, $model, $extend = []) + { $page = intval($p); $page = $page ? $page : 1; //默认显示第一页数据 - - if(isset($_REQUEST['row'])) {$row = $_REQUEST['row'];}else{$row = 10;} - + + if (isset($_REQUEST['row'])) { + $row = $_REQUEST['row']; + } else { + $row = 10; + } + $model = D($model); // 条件搜索 $map = []; - foreach(I('get.') as $name=>$val){ - $map[$name] = $val; + foreach (I('get.') as $name => $val) { + $map[$name] = $val; } - $map = array_merge($map,$extend['map']); - $lists_data = $model->where($map)->page($page,$row)->order($extend['order'])->select(); + $map = array_merge($map, $extend['map']); + $lists_data = $model->where($map)->page($page, $row)->order($extend['order'])->select(); $count = $model->where($map)->count(); //分页 - - $parameter = $_POST; - $parameter['p']=I('get.p',1); - $parameter['row']=I('get.row'); - - $page = set_pagination($count,$row,$parameter); - if($page) {$this->assign('_page', $page);} - - $this->assign('lists_data',$lists_data); - $this->assign('count',$count); + + $parameter = $_POST; + $parameter['p'] = I('get.p', 1); + $parameter['row'] = I('get.row'); + + $page = set_pagination($count, $row, $parameter); + if ($page) { + $this->assign('_page', $page); + } + + $this->assign('lists_data', $lists_data); + $this->assign('count', $count); $this->display(); } @@ -166,63 +183,63 @@ class BaseController extends HomeController{ */ public function paginate($query, $defaultPageSize = 10, $defaultPage = 1) { - $page = I('get.p', $defaultPage); - $pageSize = I('get.row', $defaultPageSize); - - $countQuery = clone $query; - $count = $countQuery->count(); - $records = $query->page($page, $pageSize)->select(); - - $params = [ - 'p' => $page, - 'row' => $pageSize - ]; - $params = array_merge($params, $_POST); - $params = array_merge($params, $_GET); - $pagination = set_pagination($count, $pageSize, $params); - - return [$records, $pagination, $count]; + $page = I('get.p', $defaultPage); + $pageSize = I('get.row', $defaultPageSize); + + $countQuery = clone $query; + $count = $countQuery->count(); + $records = $query->page($page, $pageSize)->select(); + + $params = [ + 'p' => $page, + 'row' => $pageSize + ]; + $params = array_merge($params, $_POST); + $params = array_merge($params, $_GET); + $pagination = set_pagination($count, $pageSize, $params); + + return [$records, $pagination, $count]; } public function getRecordsByIds($query, $ids, $params = []) { - if (count($ids) == 0) { - return []; - } - $field = isset($params['field']) ? $params['field'] : 'id'; - $indexBy = isset($params['indexBy']) ? $params['indexBy'] : ''; - - $items = $query->where([$field => ['in', $ids]])->select(); - $records = []; - if ($indexBy) { - foreach ($items as $item) { - $records[$item[$field]] = $item; + if (count($ids) == 0) { + return []; } - return $records; - } - return $items; + $field = isset($params['field']) ? $params['field'] : 'id'; + $indexBy = isset($params['indexBy']) ? $params['indexBy'] : ''; + + $items = $query->where([$field => ['in', $ids]])->select(); + $records = []; + if ($indexBy) { + foreach ($items as $item) { + $records[$item[$field]] = $item; + } + return $records; + } + return $items; } public function getColumnsByIds($query, $ids, $column, $params = []) { - if (count($ids) == 0) { - return []; - } - $field = isset($params['field']) ? $params['field'] : 'id'; - $indexBy = isset($params['indexBy']) ? $params['indexBy'] : ''; - - $items = $query->where([$field => ['in', $ids]])->select(); - $records = []; - if ($indexBy) { - foreach ($items as $item) { - $records[$item[$field]] = $item[$column]; - } - } else { - foreach ($items as $item) { - $records[] = $item[$column]; - } - } - return $records; + if (count($ids) == 0) { + return []; + } + $field = isset($params['field']) ? $params['field'] : 'id'; + $indexBy = isset($params['indexBy']) ? $params['indexBy'] : ''; + + $items = $query->where([$field => ['in', $ids]])->select(); + $records = []; + if ($indexBy) { + foreach ($items as $item) { + $records[$item[$field]] = $item[$column]; + } + } else { + foreach ($items as $item) { + $records[] = $item[$column]; + } + } + return $records; } public function getLoginPromote() @@ -233,4 +250,32 @@ class BaseController extends HomeController{ } return $this->loginPromote; } + + //验证安全密码视图 + public function verifyPasswordView($modelList, $metaTitle) + { + $this->assign('modelList', $modelList); + $this->assign('metaTitle', $metaTitle); + $this->display('Public/verify_password'); + } + + //验证安全密码 + public function verifyPassword() + { + $password = I('post.password'); + $model = new \User\Api\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); + } } diff --git a/Application/Home/Controller/FinanceController.class.php b/Application/Home/Controller/FinanceController.class.php index 54fb169d5..d17e0efd4 100644 --- a/Application/Home/Controller/FinanceController.class.php +++ b/Application/Home/Controller/FinanceController.class.php @@ -15,6 +15,7 @@ class FinanceController extends BaseController { public function settlementDtl() { + $metaTitle = '结算明细'; $securityCode = empty(session('game_divide_second_pwd')) ? '' : session('game_divide_second_pwd');//安全密码 $model = new PromoteApi(); $res = $model->verify_er_User(PID, $securityCode);//验证安全密码 @@ -85,9 +86,11 @@ class FinanceController extends BaseController $this->assign('initBegTime', $initBegTime); $this->assign('initEndTime', $initEndTime); $this->assign('_page', $page); + $this->assign('meta_title', '结算明细'); + $this->display(); + } else { + $modelList = ['财务管理', $metaTitle]; + $this->verifyPasswordView($modelList, $metaTitle); } - - $this->assign('meta_title', '结算明细'); - $this->display(); } } \ No newline at end of file diff --git a/Application/Home/Controller/GameDivideController.class.php b/Application/Home/Controller/GameDivideController.class.php index 6db691700..a277d05c6 100644 --- a/Application/Home/Controller/GameDivideController.class.php +++ b/Application/Home/Controller/GameDivideController.class.php @@ -20,6 +20,7 @@ class GameDivideController extends BaseController $this->error('权限异常'); } + $metaTitle = '分成比例'; $securityCode = empty(session('game_divide_second_pwd')) ? '' : session('game_divide_second_pwd');//安全密码 $model = new PromoteApi(); $res = $model->verify_er_User(PID, $securityCode);//验证安全密码 @@ -77,29 +78,11 @@ class GameDivideController extends BaseController $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'] = '验证成功'; + $this->meta_title = $metaTitle; + $this->display(); } else { - $data['status'] = 0; - $data['msg'] = '安全密码不正确'; + $modelList = ['游戏管理', $metaTitle]; + $this->verifyPasswordView($modelList, $metaTitle); } - - $this->ajaxReturn($data); } } \ No newline at end of file diff --git a/Application/Home/Controller/PromoteController.class.php b/Application/Home/Controller/PromoteController.class.php index 50b732cbb..025216f0a 100644 --- a/Application/Home/Controller/PromoteController.class.php +++ b/Application/Home/Controller/PromoteController.class.php @@ -2281,15 +2281,18 @@ class PromoteController extends BaseController $this->ajaxReturn($data); } else { + $metaTitle = '设置'; if ($res) { $map['id'] = PID; $promoteData = D('Promote')->field('id,child_game_permission')->where($map)->find(); $this->assign('data', $promoteData); + $this->meta_title = $metaTitle; + $this->display(); + } else { + $modelList = ['游戏管理', $metaTitle]; + $this->verifyPasswordView($modelList, $metaTitle); } - - $this->meta_title = "设置"; - $this->display(); } } diff --git a/Application/Home/View/default/Finance/settlementDtl.html b/Application/Home/View/default/Finance/settlementDtl.html index d995d0d40..f4c2a7744 100644 --- a/Application/Home/View/default/Finance/settlementDtl.html +++ b/Application/Home/View/default/Finance/settlementDtl.html @@ -3,7 +3,6 @@ - @@ -63,144 +62,95 @@ width: 180px; height: 34px; } - - .input-security { - width: 500px; - height: 2.5rem; - padding-left: 10px; - border-radius: 5px; - border: 0; - } - - .btn-security { - width: 300px; - height: 2.4rem; - border: 0; - border-radius: 5px; - background-color: #358fe4; - color: #fff; - } - - .btn-security-close { - width: 300px; - height: 2.4rem; - border: 0; - border-radius: 5px; - background-color: #fff; - color: #999; - }