diff --git a/Application/Base/Service/PromoteService.class.php b/Application/Base/Service/PromoteService.class.php index e07dba79c..179249605 100644 --- a/Application/Base/Service/PromoteService.class.php +++ b/Application/Base/Service/PromoteService.class.php @@ -762,7 +762,7 @@ class PromoteService { public function getLevelName($level) { - return self::levels[$level] ?? '未知'; + return self::$levels[$level] ?? '未知'; } public function addPromote($params, $parent = null) diff --git a/Application/Home/Controller/QueryController.class.php b/Application/Home/Controller/QueryController.class.php index 07da8188e..33c30beb4 100644 --- a/Application/Home/Controller/QueryController.class.php +++ b/Application/Home/Controller/QueryController.class.php @@ -7,6 +7,7 @@ use User\Api\PromoteApi; use Base\Repository\PromoteRepository; use Base\Repository\SpendRepository; use Base\Repository\UserRepository; +use Base\Service\PromoteService; /** * 前台首页控制器 @@ -705,21 +706,13 @@ class QueryController extends BaseController $sdkVersion = I('sdk_version', 0); $gameId = I('game_id', 0); $serverId = I('server_id', 0); - $promoteId = I('promote_id', 0); - $subPromoteId = I('sub_promote_id', 0); - $promote = $this->getLoginPromote(); - $searchPromote = $promote; - if ($promoteId > 0) { - $searchPromote = M('promote', 'tab_')->where(['id' => $promoteId])->find(); - } - if ($subPromoteId > 0) { - $searchPromote = M('promote', 'tab_')->where(['id' => $subPromoteId])->find(); - } - $map = [ + $levelPromote = $this->getLevelPromote(); + $searchPromote = $this->getQueryPromote($levelPromote); + + $map[] = [ '_logic' => 'or', 'id' => $searchPromote['id'], - 'parent_id' => $searchPromote['id'], - 'grand_id' => $searchPromote['id'], + 'chain' => ['like', $searchPromote['chain'] . $searchPromote['id'] . '/%'] ]; $ids = M('promote', 'tab_')->where($map)->getField('id', true); @@ -795,11 +788,10 @@ class QueryController extends BaseController public function gameArpu() { $promote = $this->getLoginPromote(); - $map = [ + $map[] = [ '_logic' => 'or', 'id' => $promote['id'], - 'parent_id' => $promote['id'], - 'grand_id' => $promote['id'], + 'chain' => ['like', $promote['chain'] . $promote['id'] . '/%'] ]; $ids = M('promote', 'tab_')->where($map)->getField('id', true); @@ -1649,42 +1641,6 @@ class QueryController extends BaseController $this->display('view_role'); } - public function users() - { - $promote = $this->getLoginPromote(); - $promoteId = $promote['id']; - $map = [ - '_logic' => 'or', - 'id' => $promoteId, - 'parent_id' => $promoteId, - 'grand_id' => $promoteId, - ]; - $ids = M('promote', 'tab_')->where($map)->getField('id', true); - - $promotes = []; - $groupPromotes = []; - if ($promote['parent_id'] == 0) { - $groupPromotes = M('promote', 'tab_')->field(['id', 'account', 'real_name'])->where(['parent_id' => $promoteId])->select(); - $promotes = M('promote', 'tab_')->field(['id', 'account', 'real_name'])->where(['grand_id' => $promoteId])->select(); - } - if ($promote['parent_id'] > 0 && $promote['grand_id'] == 0) { - $promotes = M('promote', 'tab_')->field(['id', 'account', 'real_name'])->where(['parent_id' => $promoteId])->select(); - } - - $fields = [ - 'id', 'account', 'promote_account', 'promote_id', 'device_number', 'register_time', 'register_ip', 'login_time', 'login_ip', 'device_type' - ]; - $query = M('user', 'tab_')->field($fields)->where(['promote_id' => ['in', $ids]]); - list($records, $pagination, $count) = $this->paginate($query); - - $this->assign('promotes', $promotes); - $this->assign('groupPromotes', $groupPromotes); - $this->assign('records', $records); - $this->assign('pagination', $pagination); - $this->assign('count', $count); - $this->display(); - } - private function getLevelPromote() { $levelPromote = []; @@ -1933,17 +1889,6 @@ class QueryController extends BaseController return $promotes; } - private function getNormalPromotes($promote) - { - $promotes = []; - if ($promote['parent_id'] > 0 && $promote['grand_id'] == 0) { - $promotes = M('promote', 'tab_')->field(['id', 'account', 'real_name'])->where(['parent_id' => $promote['id']])->select(); - } elseif ($promote['parent_id'] == 0) { - $promotes = M('promote', 'tab_')->field(['id', 'account', 'real_name'])->where(['grand_id' => $promote['id']])->select(); - } - return $promotes; - } - public function getGameServers() { $gameId = I('game_id', 0); @@ -2018,29 +1963,36 @@ class QueryController extends BaseController $parentId = I('parent_id', 0); $promoteId = I('promote_id', 0); $status = I('status', 0); + $searchLevel = 0; + $searchLevelName = ''; + $currentDisplay = ''; + $prevParentId = 0; + $promoteService = new PromoteService(); $loginPromote = $this->getLoginPromote(); - $promote = null; - $searchPromoteType = 0; + $parent = null; if ($parentId > 0) { - $promote = M('promote', 'tab_')->where(['id' => $parentId])->find(); - $searchPromoteType = 2; + $parent = M('promote', 'tab_')->where(['id' => $parentId])->find(); + $currentDisplay = $promoteService->getLevelName($promote['level']) . '推广'; + $prevParentId = $parent['parent_id'] == $loginPromote['parent_id'] ? 0 : $parent['parent_id']; } else { - $promote = $loginPromote; - $searchPromoteType = 1; + $parent = $loginPromote; + $currentDisplay = '自己'; } + $searchLevel = $parent['level'] + 1; + $searchLevelName = $promoteService->getLevelName($searchLevel); - $games = $this->getGamesByPromote($promote); + $games = $this->getGamesByPromote($parent); - $subPromotes = M('promote', 'tab_')->field(['id', 'account', 'real_name'])->where(['parent_id' => $promote['id']])->select(); + $subPromotes = M('promote', 'tab_')->field(['id', 'account', 'real_name'])->where(['parent_id' => $parent['id']])->select(); - $map = ['parent_id' => $promote['id']]; + $map = ['parent_id' => $parent['id']]; if ($promoteId > 0) { $map['id'] = $promoteId; } - $query = M('promote', 'tab_')->field(['id', 'account', 'real_name'])->where($map); + $query = M('promote', 'tab_')->field(['id', 'account', 'real_name', 'level'])->where($map); list($promotes, $pagination, $count) = $this->paginate($query); $ids = array_column($promotes, 'id'); @@ -2099,9 +2051,10 @@ class QueryController extends BaseController $selfRechargeAmountList = $promoteRepository->getRechargeAmountByIds([$promote['id']], $selfParams); $records[] = [ - 'id' => $promote['id'], - 'account' => $promote['account'], - 'real_name' => $promote['real_name'], + 'id' => $parent['id'], + 'account' => $parent['account'], + 'real_name' => $parent['real_name'], + 'level' => $parent['level'], 'create_role_count' => $selfCreateRoleCountList[$promote['id']], 'create_role_user_count' => $selfCreateRoleUserCountList[$promote['id']], 'new_create_role_user_count' => $selfNewCreateRoleUserCountList[$promote['id']], @@ -2114,16 +2067,16 @@ class QueryController extends BaseController 'recharge_by_ban_coin' => $selfRechargeAmountList[$promote['id']]['ban_coin'], 'recharge_by_coin' => $selfRechargeAmountList[$promote['id']]['coin'], 'recharge_by_cash' => $selfRechargeAmountList[$promote['id']]['cash'], - 'search_promote_type' => $searchPromoteType, + 'current_display' => $currentDisplay, ]; } - foreach ($promotes as $promote) { $id = $promote['id']; $records[] = [ 'id' => $id, 'account' => $promote['account'], 'real_name' => $promote['real_name'], + 'level' => $promote['level'], 'create_role_count' => $createRoleCountList[$id], 'create_role_user_count' => $createRoleUserCountList[$id], 'new_create_role_user_count' => $newCreateRoleUserCountList[$id], @@ -2136,23 +2089,14 @@ class QueryController extends BaseController 'recharge_by_ban_coin' => $rechargeAmountList[$id]['ban_coin'], 'recharge_by_coin' => $rechargeAmountList[$id]['coin'], 'recharge_by_cash' => $rechargeAmountList[$id]['cash'], - 'search_promote_type' => 0, + 'current_display' => '', ]; } - $level = 0; - if ($parentId > 0) { - $level = 2; - } elseif ($loginPromote['parent_id'] == 0) { - $level = 1; - } elseif ($loginPromote['parent_id'] > 0 && $loginPromote['grand_id'] == 0) { - $level = 2; - } elseif ($loginPromote['parent_id'] > 0 && $loginPromote['grand_id'] > 0) { - $level = 3; - } - + $this->assign('prevParentId', $prevParentId); + $this->assign('searchLevelName', $searchLevelName); $this->assign('games', $games); - $this->assign('level', $level); + $this->assign('parent', $parent); $this->assign('subPromotes', $subPromotes); $this->assign('records', $records); $this->assign('pagination', $pagination); diff --git a/Application/Home/View/default/Query/achievement.html b/Application/Home/View/default/Query/achievement.html index 506ec05a1..19d77a275 100644 --- a/Application/Home/View/default/Query/achievement.html +++ b/Application/Home/View/default/Query/achievement.html @@ -46,42 +46,29 @@
- -
- -
- + + +
-
-
-
-
- 0):?> + 0):?>
- 返回上级 + 返回上级
@@ -102,7 +89,7 @@ 现金充值 通用币充值 绑定币充值 - + 操作 @@ -112,8 +99,9 @@ {$record.account}({$record.real_name}) - [自己] - [组长推广] + + [{$record['current_display']}] + {$record.create_role_count} {$record.create_role_user_count} @@ -127,8 +115,12 @@ {$record.recharge_by_cash} {$record.recharge_by_coin} {$record.recharge_by_ban_coin} - - 查看下级 + + + + 查看下级 + + diff --git a/Application/Home/View/default/Query/arpu.html b/Application/Home/View/default/Query/arpu.html index 8dd2956cd..d2ff25d5d 100644 --- a/Application/Home/View/default/Query/arpu.html +++ b/Application/Home/View/default/Query/arpu.html @@ -217,6 +217,7 @@ +