From aa5e404188d8709cac0665c153df42152192d370 Mon Sep 17 00:00:00 2001 From: chenxiaojun <956334972@qq.com> Date: Thu, 19 Dec 2019 14:35:54 +0800 Subject: [PATCH] =?UTF-8?q?=E7=AE=A1=E7=90=86=E5=90=8E=E5=8F=B0>=E6=8E=A8?= =?UTF-8?q?=E5=B9=BF=E5=91=98=E7=AE=A1=E7=90=86>=E5=85=AC=E4=BC=9A?= =?UTF-8?q?=E5=88=86=E6=88=90=E7=AE=A1=E7=90=86--=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Application/Admin/Common/function.php | 46 +++++++ .../PromoteGameRatioController.class.php | 19 ++- .../Admin/View/PromoteGameRatio/lists.html | 126 ++++++++---------- 3 files changed, 116 insertions(+), 75 deletions(-) diff --git a/Application/Admin/Common/function.php b/Application/Admin/Common/function.php index eca80c14c..101a8db89 100644 --- a/Application/Admin/Common/function.php +++ b/Application/Admin/Common/function.php @@ -668,4 +668,50 @@ function getAllGameList($groupByRelation = false) $games = M('game', 'tab_')->field($field)->select(); } return $games; +} + +//获取管理员权限列表 +function getAdminRules($adminId) +{ + $rules = []; + if ($adminId) { + $groupId = M('auth_group_access')->where(array('uid' => intval($adminId)))->getField('group_id'); + if ($groupId) { + $rules = M('auth_group')->where(array('id' => $groupId))->getField('rules'); + $rules = explode(',', $rules); + } + } + return $rules; +} + +//获取权限id +function getRule($name, $module) +{ + $ruleId = 0; + if ($name) { + if ($module) { + $map['module'] = $module; + } + $map['name'] = trim($name); + $ruleId = M('auth_rule')->where($map)->getField('id'); + } + return $ruleId; +} + +//下划线转驼峰 $littleHump 是否转换成小驼峰 +function camelize($str, $separator = '_', $littleHump = false) +{ + if ($littleHump) { + $str = $separator . str_replace($separator, " ", strtolower($str)); + } else { + $str = str_replace($separator, " ", strtolower($str)); + } + + return ltrim(str_replace(" ", "", ucwords($str)), $separator ); +} + +//驼峰转下划线 +function unCamelize($str, $separator = '_') +{ + return strtolower(preg_replace('/([a-z])([A-Z])/', "$1" . $separator . "$2", $str)); } \ No newline at end of file diff --git a/Application/Admin/Controller/PromoteGameRatioController.class.php b/Application/Admin/Controller/PromoteGameRatioController.class.php index 137c63913..f2981a573 100644 --- a/Application/Admin/Controller/PromoteGameRatioController.class.php +++ b/Application/Admin/Controller/PromoteGameRatioController.class.php @@ -112,12 +112,14 @@ class PromoteGameRatioController extends ThinkController } } -// var_dump(get_defined_constants());die; + $reviewRule = $this->getReviewRule(); + $this->assign('records', $records); $this->assign('count', $count); $this->assign('gameList', getAllGameList()); $this->assign('promoteList', getPromoteByLevel(1)); $this->assign('statusList', self::$statusList); + $this->assign('reviewRule', $reviewRule); $this->meta_title = '公会分成管理'; $this->display(); } @@ -200,6 +202,8 @@ class PromoteGameRatioController extends ThinkController { $params = I('post.'); $ids = $params['ids'] ?? []; + $remark = $params['remark'] ?? ''; + var_dump($remark);die; if (empty($ids)) { $this->error('操作失败'); } @@ -213,6 +217,9 @@ class PromoteGameRatioController extends ThinkController $save['reviewer_id'] = is_login(); $save['review_time'] = $time; $save['update_time'] = $time; + if ($remark) { + $save['remark'] = $remark; + } $result = D(self::MODEL_NAME)->where($map)->save($save); if ($result) { $this->success('操作成功'); @@ -229,6 +236,16 @@ class PromoteGameRatioController extends ThinkController return $createTime; } + private function getReviewRule() + { + $rules = getAdminRules(is_login()); + $rulesName = BIND_MODULE . '/' . CONTROLLER_NAME . '/setStatus'; + $ruleId = getRule($rulesName, 'admin'); + $reviewRule = in_array($ruleId, $rules) ? true : false; + $reviewRule = (is_login() == 1) ? true : $reviewRule; + return $reviewRule; + } + public function getGameRatio() { $gameId = I('post.game_id', 0); diff --git a/Application/Admin/View/PromoteGameRatio/lists.html b/Application/Admin/View/PromoteGameRatio/lists.html index b82ce950e..f40446030 100644 --- a/Application/Admin/View/PromoteGameRatio/lists.html +++ b/Application/Admin/View/PromoteGameRatio/lists.html @@ -7,6 +7,8 @@ + +
@@ -157,7 +171,24 @@