diff --git a/Application/Admin/Common/function.php b/Application/Admin/Common/function.php index d8400d0cc..42ad1b7fb 100644 --- a/Application/Admin/Common/function.php +++ b/Application/Admin/Common/function.php @@ -674,4 +674,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..c08d958a8 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,7 @@ class PromoteGameRatioController extends ThinkController { $params = I('post.'); $ids = $params['ids'] ?? []; + $remark = $params['remark'] ?? ''; if (empty($ids)) { $this->error('操作失败'); } @@ -213,6 +216,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 +235,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..44aef4d71 100644 --- a/Application/Admin/View/PromoteGameRatio/lists.html +++ b/Application/Admin/View/PromoteGameRatio/lists.html @@ -7,6 +7,8 @@ + +
@@ -157,7 +172,21 @@