From f0acbc1c242de7465a8cca15e715e33c4af346c7 Mon Sep 17 00:00:00 2001 From: ELF <360197197@qq.com> Date: Tue, 14 Jan 2020 14:15:48 +0800 Subject: [PATCH] =?UTF-8?q?=E5=85=85=E5=80=BC=E4=BF=A1=E6=81=AF=E6=A0=B9?= =?UTF-8?q?=E6=8D=AE=E4=BC=9A=E9=95=BF=E6=9D=83=E9=99=90=E6=98=BE=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Home/Controller/BaseController.class.php | 43 +++++++++- .../Controller/CoinOrderController.class.php | 9 +- .../Controller/DownloadController.class.php | 86 +++++++++++-------- .../Controller/PromoteController.class.php | 11 +++ .../Home/Controller/QueryController.class.php | 52 ++++++----- .../Home/View/default/Promote/index.html | 8 ++ .../View/default/Public/promote_base.html | 13 ++- .../Home/View/default/Query/achievement.html | 4 + Data/update.sql | 4 + 9 files changed, 161 insertions(+), 69 deletions(-) diff --git a/Application/Home/Controller/BaseController.class.php b/Application/Home/Controller/BaseController.class.php index 31c126422..eda6e7e41 100644 --- a/Application/Home/Controller/BaseController.class.php +++ b/Application/Home/Controller/BaseController.class.php @@ -7,6 +7,14 @@ use Think\Controller; class BaseController extends HomeController { protected $loginPromote = null; + protected $canViewUserRecharge = true; + + protected $permControlUrls = [ + 'Home/Query/recharge', + 'Home/Players/playAction', + 'Home/Query/userRecharges', + 'Home/Query/arpu', + ]; protected function _initialize() { @@ -15,7 +23,7 @@ class BaseController extends HomeController $this->login(); $loginer = $this->getLoginPromote(); - $this->certifiCation(); + // $this->certifiCation(); $pid = is_login_promote(); define('PLEVEL', $loginer['parent_id']); define('PID', $pid); @@ -33,9 +41,13 @@ class BaseController extends HomeController define('G_SETTLEMENT_GRADE', 'sub_status,third_status'); } + $this->canViewUserRecharge = $this->promoteCan('view-user-recharge'); + $this->checkUrlPermission(); + $this->assign('loginer', $loginer); $this->assign("parent_id", $loginer['parent_id']); $this->assign("grand_id", $loginer['grand_id']); + $this->assign('canViewUserRecharge', $this->canViewUserRecharge); $result = M('site_apply', 'tab_')->where("promote_id=$pid")->getField('status'); if ($result['status'] == 1) { @@ -342,4 +354,33 @@ class BaseController extends HomeController break; } } + + public function checkUrlPermission() + { + $currentUrl = MODULE_NAME . '/' . CONTROLLER_NAME . '/' . ACTION_NAME; + if (!$this->canViewUserRecharge) { + foreach ($this->permControlUrls as $url) { + if (strtolower($currentUrl) == strtolower($url)) { + $this->error('无权限查看'); + } + } + } + } + + public function promoteCan($permission) + { + $promote = $this->getLoginPromote(); + if (!$promote) { + return false; + } + if ($permission == 'recharge') { + if ($promote['level'] == 1) { + return true; + } + } + if ($permission == 'view-user-recharge') { + return false; + } + return false; + } } diff --git a/Application/Home/Controller/CoinOrderController.class.php b/Application/Home/Controller/CoinOrderController.class.php index 652bb5556..1cd7cca4c 100644 --- a/Application/Home/Controller/CoinOrderController.class.php +++ b/Application/Home/Controller/CoinOrderController.class.php @@ -90,14 +90,7 @@ class CoinOrderController extends BaseController //创建订单 public function order_add(){ - - $status = promoteCan(session('promote_auth.pid'), function($level) { - if ($level == 1) { - return true; - } else { - return false; - } - }); + $status = $this->promoteCan('recharge'); if (!$status) { if (IS_POST) { $this->ajaxReturn(array('status' => 0, 'msg'=>'无权限操作')); diff --git a/Application/Home/Controller/DownloadController.class.php b/Application/Home/Controller/DownloadController.class.php index 6d36d1428..09c430336 100644 --- a/Application/Home/Controller/DownloadController.class.php +++ b/Application/Home/Controller/DownloadController.class.php @@ -3016,22 +3016,22 @@ class DownloadController extends BaseController { public function achievementExcelInfo($tid,$map) { $xlsName = "推广员业绩"; $xlsCell = array( - array('account','账号'), - array('real_name','姓名'), - array('create_role_count','创角数'), - array('create_role_user_count','创角用户'), - array('new_create_role_user_count','新创角用户'), - array('new_create_role_ip_count','新创角ip'), - array('login_user_count','登陆用户数'), - array('recharge_user_count','充值人数'), - array('recharge_count','充值次数'), - array('recharge_amount','充值总额'), - array('recharge_by_ban_coin','绑定币充值'), - array('recharge_by_coin','通用币充值'), - array('recharge_by_cash','现金充值'), - - - ); + array('account','账号'), + array('real_name','姓名'), + array('create_role_count','创角数'), + array('create_role_user_count','创角用户'), + array('new_create_role_user_count','新创角用户'), + array('new_create_role_ip_count','新创角ip'), + array('login_user_count','登陆用户数'), + ); + if ($this->canViewUserRecharge) { + $xlsCell[] = array('recharge_user_count','充值人数'); + $xlsCell[] = array('recharge_count','充值次数'); + $xlsCell[] = array('recharge_amount','充值总额'); + $xlsCell[] = array('recharge_by_ban_coin','绑定币充值'); + $xlsCell[] = array('recharge_by_coin','通用币充值'); + $xlsCell[] = array('recharge_by_cash','现金充值'); + } $params['isContainSubs'] = $map['isContainSubs']; $params['basicPromotes'] = json_decode($map['basicPromotes'],TRUE); $ids = $map['ids']; @@ -3067,9 +3067,16 @@ class DownloadController extends BaseController { $newCreateRoleDeviceCountList = $promoteRepository->getNewCreateRoleDeviceCountByIds($ids, $params); $newCreateRoleIpCountList = $promoteRepository->getNewCreateRoleIpCountByIds($ids, $params); $loginUserCountList = $promoteRepository->getLoginUserCountByIds($ids, $params); - $rechargeCountList = $promoteRepository->getRechargeCountByIds($ids, $params); - $rechargeUserCountList = $promoteRepository->getRechargeUserCountByIds($ids, $params); - $rechargeAmountList = $promoteRepository->getRechargeAmountByIds($ids, $params); + + $rechargeCountList = []; + $rechargeUserCountList = []; + $rechargeAmountList = []; + if ($this->canViewUserRecharge) { + $rechargeCountList = $promoteRepository->getRechargeCountByIds($ids, $params); + $rechargeUserCountList = $promoteRepository->getRechargeUserCountByIds($ids, $params); + $rechargeAmountList = $promoteRepository->getRechargeAmountByIds($ids, $params); + } + $records = []; if (I('p', 1) == 1) { $selfParams = $params; @@ -3079,12 +3086,8 @@ class DownloadController extends BaseController { $selfNewCreateRoleUserCountList = $promoteRepository->getNewCreateRoleUserCountByIds([$parent['id']], $selfParams); // $selfNewCreateRoleDeviceCountList = $promoteRepository->getNewCreateRoleDeviceCountByIds([$parent['id']], $selfParams); $selfNewCreateRoleIpCountList = $promoteRepository->getNewCreateRoleIpCountByIds([$parent['id']], $selfParams); - $selfLoginUserCountList = $promoteRepository->getLoginUserCountByIds([$parent['id']], $selfParams); - $selfRechargeCountList = $promoteRepository->getRechargeCountByIds([$parent['id']], $selfParams); - $selfRechargeUserCountList = $promoteRepository->getRechargeUserCountByIds([$parent['id']], $selfParams); - $selfRechargeAmountList = $promoteRepository->getRechargeAmountByIds([$parent['id']], $selfParams); - $records[] = [ + $record = [ 'id' => $parent['id'], 'account' => $parent['account'], 'real_name' => $parent['real_name'], @@ -3095,18 +3098,24 @@ class DownloadController extends BaseController { // 'new_create_role_device_count' => $selfNewCreateRoleDeviceCountList[$parent['id']], 'new_create_role_ip_count' => $selfNewCreateRoleIpCountList[$parent['id']], 'login_user_count' => $selfLoginUserCountList[$parent['id']], - 'recharge_count' => $selfRechargeCountList[$parent['id']], - 'recharge_user_count' => $selfRechargeUserCountList[$parent['id']], - 'recharge_amount' => $selfRechargeAmountList[$parent['id']]['ban_coin'] + $selfRechargeAmountList[$parent['id']]['coin'] + $selfRechargeAmountList[$parent['id']]['cash'], - 'recharge_by_ban_coin' => $selfRechargeAmountList[$parent['id']]['ban_coin'], - 'recharge_by_coin' => $selfRechargeAmountList[$parent['id']]['coin'], - 'recharge_by_cash' => $selfRechargeAmountList[$parent['id']]['cash'], 'current_display' => $currentDisplay, ]; + if ($this->canViewUserRecharge) { + $selfRechargeCountList = $promoteRepository->getRechargeCountByIds([$parent['id']], $selfParams); + $selfRechargeUserCountList = $promoteRepository->getRechargeUserCountByIds([$parent['id']], $selfParams); + $selfRechargeAmountList = $promoteRepository->getRechargeAmountByIds([$parent['id']], $selfParams); + $record['recharge_count'] = $selfRechargeCountList[$parent['id']]; + $record['recharge_user_count'] = $selfRechargeUserCountList[$parent['id']]; + $record['recharge_amount'] = $selfRechargeAmountList[$parent['id']]['ban_coin'] + $selfRechargeAmountList[$parent['id']]['coin'] + $selfRechargeAmountList[$parent['id']]['cash']; + $record['recharge_by_ban_coin'] = $selfRechargeAmountList[$parent['id']]['ban_coin']; + $record['recharge_by_coin'] = $selfRechargeAmountList[$parent['id']]['coin']; + $record['recharge_by_cash'] = $selfRechargeAmountList[$parent['id']]['cash']; + } + $records[] = $record; } foreach ($promotes as $promote) { $id = $promote['id']; - $records[] = [ + $record = [ 'id' => $id, 'account' => $promote['account'], 'real_name' => $promote['real_name'], @@ -3117,14 +3126,17 @@ class DownloadController extends BaseController { 'new_create_role_device_count' => $newCreateRoleDeviceCountList[$id], 'new_create_role_ip_count' => $newCreateRoleIpCountList[$id], 'login_user_count' => $loginUserCountList[$id], - 'recharge_count' => $rechargeCountList[$id], - 'recharge_user_count' => $rechargeUserCountList[$id], - 'recharge_amount' => $rechargeAmountList[$id]['ban_coin'] + $rechargeAmountList[$id]['coin'] + $rechargeAmountList[$id]['cash'], - 'recharge_by_ban_coin' => $rechargeAmountList[$id]['ban_coin'], - 'recharge_by_coin' => $rechargeAmountList[$id]['coin'], - 'recharge_by_cash' => $rechargeAmountList[$id]['cash'], 'current_display' => '', ]; + if ($this->canViewUserRecharge) { + $record['recharge_count'] = $rechargeCountList[$id]; + $record['recharge_user_count'] = $rechargeUserCountList[$id]; + $record['recharge_amount'] = $rechargeAmountList[$id]['ban_coin'] + $rechargeAmountList[$id]['coin'] + $rechargeAmountList[$id]['cash']; + $record['recharge_by_ban_coin'] = $rechargeAmountList[$id]['ban_coin']; + $record['recharge_by_coin'] = $rechargeAmountList[$id]['coin']; + $record['recharge_by_cash'] = $rechargeAmountList[$id]['cash']; + } + $records[] = $record; } $xlsData = []; foreach ($records as $key1 => $value1) { diff --git a/Application/Home/Controller/PromoteController.class.php b/Application/Home/Controller/PromoteController.class.php index 36055ccf8..d52dbba71 100644 --- a/Application/Home/Controller/PromoteController.class.php +++ b/Application/Home/Controller/PromoteController.class.php @@ -557,6 +557,17 @@ class PromoteController extends BaseController ->where("qmn.status=0") ->order("qmn.id asc") ->select(); + + if (!$this->canViewUserRecharge) { + foreach ($data_list as $key => $item) { + foreach ($this->permControlUrls as $url) { + if (stripos($item['url'], $url) !== false) { + unset($data_list[$key]); + } + } + } + } + $this->assign("data_list", $data_list); $this->meta_title = "快捷菜单"; $this->display(); diff --git a/Application/Home/Controller/QueryController.class.php b/Application/Home/Controller/QueryController.class.php index 660ccec8a..b36ad80ae 100644 --- a/Application/Home/Controller/QueryController.class.php +++ b/Application/Home/Controller/QueryController.class.php @@ -2093,9 +2093,15 @@ class QueryController extends BaseController // $newCreateRoleDeviceCountList = $promoteRepository->getNewCreateRoleDeviceCountByIds($ids, $params); $newCreateRoleIpCountList = $promoteRepository->getNewCreateRoleIpCountByIds($ids, $params); $loginUserCountList = $promoteRepository->getLoginUserCountByIds($ids, $params); - $rechargeCountList = $promoteRepository->getRechargeCountByIds($ids, $params); - $rechargeUserCountList = $promoteRepository->getRechargeUserCountByIds($ids, $params); - $rechargeAmountList = $promoteRepository->getRechargeAmountByIds($ids, $params); + + $rechargeCountList = []; + $rechargeUserCountList = []; + $rechargeAmountList = []; + if ($this->canViewUserRecharge) { + $rechargeCountList = $promoteRepository->getRechargeCountByIds($ids, $params); + $rechargeUserCountList = $promoteRepository->getRechargeUserCountByIds($ids, $params); + $rechargeAmountList = $promoteRepository->getRechargeAmountByIds($ids, $params); + } if (I('p', 1) == 1) { $selfParams = $params; @@ -2106,10 +2112,7 @@ class QueryController extends BaseController // $selfNewCreateRoleDeviceCountList = $promoteRepository->getNewCreateRoleDeviceCountByIds([$parent['id']], $selfParams); $selfNewCreateRoleIpCountList = $promoteRepository->getNewCreateRoleIpCountByIds([$parent['id']], $selfParams); $selfLoginUserCountList = $promoteRepository->getLoginUserCountByIds([$parent['id']], $selfParams); - $selfRechargeCountList = $promoteRepository->getRechargeCountByIds([$parent['id']], $selfParams); - $selfRechargeUserCountList = $promoteRepository->getRechargeUserCountByIds([$parent['id']], $selfParams); - $selfRechargeAmountList = $promoteRepository->getRechargeAmountByIds([$parent['id']], $selfParams); - $records[] = [ + $record = [ 'id' => $parent['id'], 'account' => $parent['account'], 'real_name' => $parent['real_name'], @@ -2120,18 +2123,24 @@ class QueryController extends BaseController // 'new_create_role_device_count' => $selfNewCreateRoleDeviceCountList[$parent['id']], 'new_create_role_ip_count' => $selfNewCreateRoleIpCountList[$parent['id']], 'login_user_count' => $selfLoginUserCountList[$parent['id']], - 'recharge_count' => $selfRechargeCountList[$parent['id']], - 'recharge_user_count' => $selfRechargeUserCountList[$parent['id']], - 'recharge_amount' => $selfRechargeAmountList[$parent['id']]['ban_coin'] + $selfRechargeAmountList[$parent['id']]['coin'] + $selfRechargeAmountList[$parent['id']]['cash'], - 'recharge_by_ban_coin' => $selfRechargeAmountList[$parent['id']]['ban_coin'], - 'recharge_by_coin' => $selfRechargeAmountList[$parent['id']]['coin'], - 'recharge_by_cash' => $selfRechargeAmountList[$parent['id']]['cash'], 'current_display' => $currentDisplay, ]; + if ($this->canViewUserRecharge) { + $selfRechargeCountList = $promoteRepository->getRechargeCountByIds([$parent['id']], $selfParams); + $selfRechargeUserCountList = $promoteRepository->getRechargeUserCountByIds([$parent['id']], $selfParams); + $selfRechargeAmountList = $promoteRepository->getRechargeAmountByIds([$parent['id']], $selfParams); + $record['recharge_count'] = $selfRechargeCountList[$parent['id']]; + $record['recharge_user_count'] = $selfRechargeUserCountList[$parent['id']]; + $record['recharge_amount'] = $selfRechargeAmountList[$parent['id']]['ban_coin'] + $selfRechargeAmountList[$parent['id']]['coin'] + $selfRechargeAmountList[$parent['id']]['cash']; + $record['recharge_by_ban_coin'] = $selfRechargeAmountList[$parent['id']]['ban_coin']; + $record['recharge_by_coin'] = $selfRechargeAmountList[$parent['id']]['coin']; + $record['recharge_by_cash'] = $selfRechargeAmountList[$parent['id']]['cash']; + } + $records[] = $record; } foreach ($promotes as $promote) { $id = $promote['id']; - $records[] = [ + $record = [ 'id' => $id, 'account' => $promote['account'], 'real_name' => $promote['real_name'], @@ -2142,14 +2151,17 @@ class QueryController extends BaseController // 'new_create_role_device_count' => $newCreateRoleDeviceCountList[$id], 'new_create_role_ip_count' => $newCreateRoleIpCountList[$id], 'login_user_count' => $loginUserCountList[$id], - 'recharge_count' => $rechargeCountList[$id], - 'recharge_user_count' => $rechargeUserCountList[$id], - 'recharge_amount' => $rechargeAmountList[$id]['ban_coin'] + $rechargeAmountList[$id]['coin'] + $rechargeAmountList[$id]['cash'], - 'recharge_by_ban_coin' => $rechargeAmountList[$id]['ban_coin'], - 'recharge_by_coin' => $rechargeAmountList[$id]['coin'], - 'recharge_by_cash' => $rechargeAmountList[$id]['cash'], 'current_display' => '', ]; + if ($this->canViewUserRecharge) { + $record['recharge_count'] = $rechargeCountList[$id]; + $record['recharge_user_count'] = $rechargeUserCountList[$id]; + $record['recharge_amount'] = $rechargeAmountList[$id]['ban_coin'] + $rechargeAmountList[$id]['coin'] + $rechargeAmountList[$id]['cash']; + $record['recharge_by_ban_coin'] = $rechargeAmountList[$id]['ban_coin']; + $record['recharge_by_coin'] = $rechargeAmountList[$id]['coin']; + $record['recharge_by_cash'] = $rechargeAmountList[$id]['cash']; + } + $records[] = $record; } } else { $timeout = 1; diff --git a/Application/Home/View/default/Promote/index.html b/Application/Home/View/default/Promote/index.html index 406f23825..aa8c3c342 100644 --- a/Application/Home/View/default/Promote/index.html +++ b/Application/Home/View/default/Promote/index.html @@ -4,6 +4,7 @@
+ + + +
+ $isOpenQuery = true; + ?> - @@ -128,10 +133,12 @@ + + diff --git a/Application/Home/View/default/Query/achievement.html b/Application/Home/View/default/Query/achievement.html index 06106905f..24f66ec0e 100644 --- a/Application/Home/View/default/Query/achievement.html +++ b/Application/Home/View/default/Query/achievement.html @@ -83,12 +83,14 @@ 新创角IP 登录用户数 + 充值人数 充值次数 充值总额 现金充值 通用币充值 绑定币充值 + 操作 @@ -109,12 +111,14 @@ {$record.new_create_role_ip_count} {$record.login_user_count} + {$record.recharge_user_count} {$record.recharge_count} {$record.recharge_amount} {$record.recharge_by_cash} {$record.recharge_by_coin} {$record.recharge_by_ban_coin} + diff --git a/Data/update.sql b/Data/update.sql index df2614a60..6c924bd21 100644 --- a/Data/update.sql +++ b/Data/update.sql @@ -1073,3 +1073,7 @@ CREATE TABLE `sys_document_pop_rules` ( `operater_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '操作者ID', PRIMARY KEY (`id`) ) ENGINE=InnoDB AUTO_INCREMENT=9 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin; + + +ALTER TABLE `tab_promote` +ADD COLUMN `can_view_recharge` tinyint(1) NOT NULL default 0 COMMENT '是否显示充值数据';