From 535f185e371c604ddaea2550c33f7bfd19719e59 Mon Sep 17 00:00:00 2001
From: chenxiaojun <956334972@qq.com>
Date: Thu, 16 Jan 2020 17:26:26 +0800
Subject: [PATCH 1/3] =?UTF-8?q?=E6=8E=A8=E5=B9=BF=E5=91=98=E6=8C=87?=
=?UTF-8?q?=E6=A0=87=E7=AE=A1=E7=90=86?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../Repository/PromoteRepository.class.php | 5 +-
.../Home/Controller/QueryController.class.php | 405 ++++++++++++++----
.../Home/View/default/Query/promoteQuota.html | 178 ++++++++
3 files changed, 501 insertions(+), 87 deletions(-)
create mode 100644 Application/Home/View/default/Query/promoteQuota.html
diff --git a/Application/Base/Repository/PromoteRepository.class.php b/Application/Base/Repository/PromoteRepository.class.php
index 518d2cc5e..253b2b392 100644
--- a/Application/Base/Repository/PromoteRepository.class.php
+++ b/Application/Base/Repository/PromoteRepository.class.php
@@ -45,7 +45,10 @@ class PromoteRepository {
if (isset($params['sdk_version'])) {
$map['sdk_version'] = $params['sdk_version'];
}
- if (isset($params['begin_time']) && isset($params['begin_time']) && isset($params['time_column'])) {
+ if (isset($params['role_level'])) {
+ $map['role_level'] = $params['role_level'];
+ }
+ if (isset($params['begin_time']) && isset($params['end_time']) && isset($params['time_column'])) {
$map[$params['time_column']] = ['between', [$params['begin_time'], $params['end_time']]];
}
if (isset($params['lock_status'])) {
diff --git a/Application/Home/Controller/QueryController.class.php b/Application/Home/Controller/QueryController.class.php
index b51415efc..da0bac1ea 100644
--- a/Application/Home/Controller/QueryController.class.php
+++ b/Application/Home/Controller/QueryController.class.php
@@ -1128,15 +1128,17 @@ class QueryController extends BaseController
$newDeviceNumList = $userRepository->getNewCreateRoleDeviceCountByDay($params);//新创角设备
$newIpNumList = $userRepository->getNewCreateRoleIpCountByDay($params);//新创角IP
$loginUserNumList = $userRepository->getLoginCountGroupByDayNew($params);//登录用户数
- $spendUserNumList = $spendRepository->getPayUserCountGroupByDayNew($params);//充值人数
- $spendNumList = $spendRepository->getPayCountGroupByDay($params);//充值次数
- $spendAllAmountList = $spendRepository->getPayAmountGroupByDayAndType($params);//充值总额
- $params['pay_way'] = ['in', '1,2,3,4,5,6'];
- $spendCashList = $spendRepository->getPayAmountGroupByDayAndType($params);//现金充值
- $params['pay_way'] = 0;
- $spendGenericList = $spendRepository->getPayAmountGroupByDayAndType($params);//通用币充值
- $params['pay_way'] = -1;
- $spendBindingList = $spendRepository->getPayAmountGroupByDayAndType($params);//绑定币充值
+ if ($this->canViewUserRecharge) {
+ $spendUserNumList = $spendRepository->getPayUserCountGroupByDayNew($params);//充值人数
+ $spendNumList = $spendRepository->getPayCountGroupByDay($params);//充值次数
+ $spendAllAmountList = $spendRepository->getPayAmountGroupByDayAndType($params);//充值总额
+ $params['pay_way'] = ['in', '1,2,3,4,5,6'];
+ $spendCashList = $spendRepository->getPayAmountGroupByDayAndType($params);//现金充值
+ $params['pay_way'] = 0;
+ $spendGenericList = $spendRepository->getPayAmountGroupByDayAndType($params);//通用币充值
+ $params['pay_way'] = -1;
+ $spendBindingList = $spendRepository->getPayAmountGroupByDayAndType($params);//绑定币充值
+ }
$allData['role_num'] = 0;
$allData['user_num'] = 0;
@@ -1144,17 +1146,19 @@ class QueryController extends BaseController
$allData['new_device_num'] = 0;
$allData['new_ip_num'] = 0;
$allData['login_user_num'] = 0;
- $allData['spend_user_num'] = 0;
- $allData['spend_num'] = 0;
- $allData['spend_all_amount'] = 0;
- $allData['spend_cash'] = 0;
- $allData['spend_generic'] = 0;
- $allData['spend_binding'] = 0;
- $allData['spend_discount'] = 0;
- $allData['spend_voucher'] = 0;
+ if ($this->canViewUserRecharge) {
+ $allData['spend_user_num'] = 0;
+ $allData['spend_num'] = 0;
+ $allData['spend_all_amount'] = 0;
+ $allData['spend_cash'] = 0;
+ $allData['spend_generic'] = 0;
+ $allData['spend_binding'] = 0;
+ $allData['spend_discount'] = 0;
+ $allData['spend_voucher'] = 0;
+ }
foreach ($dayList as $day) {
$date = date('Ymd', strtotime($day));
- $records[] = [
+ $record = [
'day' => $date,
'role_num' => $roleNumList[$day],
'user_num' => $userNumList[$day],
@@ -1162,14 +1166,6 @@ class QueryController extends BaseController
'new_device_num' => $newDeviceNumList[$day],
'new_ip_num' => $newIpNumList[$day],
'login_user_num' => $loginUserNumList[$day],
- 'spend_user_num' => $spendUserNumList[$day],
- 'spend_num' => $spendNumList[$day],
- 'spend_all_amount' => $spendAllAmountList[$day],
- 'spend_cash' => $spendCashList[$day],
- 'spend_generic' => $spendGenericList[$day],
- 'spend_binding' => $spendBindingList[$day],
- 'spend_discount' => 0,
- 'spend_voucher' => 0,
];
$allData['role_num'] += $roleNumList[$day];
@@ -1178,14 +1174,27 @@ class QueryController extends BaseController
$allData['new_device_num'] += $newDeviceNumList[$day];
$allData['new_ip_num'] += $newIpNumList[$day];
$allData['login_user_num'] += $loginUserNumList[$day];
- $allData['spend_user_num'] += $spendUserNumList[$day];
- $allData['spend_num'] += $spendNumList[$day];
- $allData['spend_all_amount'] = bcadd($allData['spend_all_amount'], $spendAllAmountList[$day], 2);
- $allData['spend_cash'] = bcadd($allData['spend_cash'], $spendCashList[$day], 2);
- $allData['spend_generic'] = bcadd($allData['spend_generic'], $spendGenericList[$day], 2);
- $allData['spend_binding'] = bcadd($allData['spend_binding'], $spendBindingList[$day], 2);
- $allData['spend_discount'] = bcadd($allData['spend_discount'], 0, 2);
- $allData['spend_voucher'] = bcadd($allData['spend_voucher'], 0, 2);
+
+ if ($this->canViewUserRecharge) {
+ $record['spend_user_num'] = $spendUserNumList[$day];
+ $record['spend_num'] = $spendNumList[$day];
+ $record['spend_all_amount'] = $spendAllAmountList[$day];
+ $record['spend_cash'] = $spendCashList[$day];
+ $record['spend_generic'] = $spendGenericList[$day];
+ $record['spend_binding'] = $spendBindingList[$day];
+ $record['spend_discount'] = 0;
+ $record['spend_voucher'] = 0;
+
+ $allData['spend_user_num'] += $spendUserNumList[$day];
+ $allData['spend_num'] += $spendNumList[$day];
+ $allData['spend_all_amount'] = bcadd($allData['spend_all_amount'], $spendAllAmountList[$day], 2);
+ $allData['spend_cash'] = bcadd($allData['spend_cash'], $spendCashList[$day], 2);
+ $allData['spend_generic'] = bcadd($allData['spend_generic'], $spendGenericList[$day], 2);
+ $allData['spend_binding'] = bcadd($allData['spend_binding'], $spendBindingList[$day], 2);
+ $allData['spend_discount'] = bcadd($allData['spend_discount'], 0, 2);
+ $allData['spend_voucher'] = bcadd($allData['spend_voucher'], 0, 2);
+ }
+ $records[] = $record;
}
foreach ($dayListReverse as $day) {
$date = date('Ymd', strtotime($day));
@@ -1194,8 +1203,10 @@ class QueryController extends BaseController
$summaryData['user_num'][] = $userNumList[$day];
$summaryData['new_user_num'][] = $newUserNumList[$day];
$summaryData['new_device_num'][] = $newDeviceNumList[$day];
- $summaryData['spend_user_num'][] = $spendUserNumList[$day];
- $summaryData['spend_all_amount'][] = $spendAllAmountList[$day];
+ if ($this->canViewUserRecharge) {
+ $summaryData['spend_user_num'][] = $spendUserNumList[$day];
+ $summaryData['spend_all_amount'][] = $spendAllAmountList[$day];
+ }
}
}
@@ -1314,18 +1325,20 @@ class QueryController extends BaseController
$newDeviceNumList = $userRepository->getNewCreateRoleDeviceCountByGame($params);//新创角设备
$newIpNumList = $userRepository->getNewCreateRoleIpCountByGame($params);//新创角IP
$loginUserNumList = $userRepository->getLoginCountGroupByGame($params);//登录用户数
- $spendUserNumList = $spendRepository->getPayUserCountGroupByGame($params);//充值人数
- $spendNumList = $spendRepository->getPayCountGroupByGame($params);//充值次数
- $spendAllAmountList = $spendRepository->getPayAmountGroupByGameAndType($params);//充值总额
- $params['pay_way'] = ['in', '1,2,3,4,5,6'];
- $spendCashList = $spendRepository->getPayAmountGroupByGameAndType($params);//现金充值
- $params['pay_way'] = 0;
- $spendGenericList = $spendRepository->getPayAmountGroupByGameAndType($params);//通用币充值
- $params['pay_way'] = -1;
- $spendBindingList = $spendRepository->getPayAmountGroupByGameAndType($params);//绑定币充值
+ if ($this->canViewUserRecharge) {
+ $spendUserNumList = $spendRepository->getPayUserCountGroupByGame($params);//充值人数
+ $spendNumList = $spendRepository->getPayCountGroupByGame($params);//充值次数
+ $spendAllAmountList = $spendRepository->getPayAmountGroupByGameAndType($params);//充值总额
+ $params['pay_way'] = ['in', '1,2,3,4,5,6'];
+ $spendCashList = $spendRepository->getPayAmountGroupByGameAndType($params);//现金充值
+ $params['pay_way'] = 0;
+ $spendGenericList = $spendRepository->getPayAmountGroupByGameAndType($params);//通用币充值
+ $params['pay_way'] = -1;
+ $spendBindingList = $spendRepository->getPayAmountGroupByGameAndType($params);//绑定币充值
+ }
foreach ($data as &$list) {
$gameId = $list['game_id'];
- $records[] = [
+ $record = [
'game_id' => $gameId,
'game_name' => $list['game_name'],
'sdk_version' => $list['sdk_version'],
@@ -1335,15 +1348,19 @@ class QueryController extends BaseController
'new_device_num' => $newDeviceNumList[$gameId],
'new_ip_num' => $newIpNumList[$gameId],
'login_user_num' => $loginUserNumList[$gameId],
- 'spend_user_num' => $spendUserNumList[$gameId],
- 'spend_num' => $spendNumList[$gameId],
- 'spend_all_amount' => $spendAllAmountList[$gameId],
- 'spend_cash' => $spendCashList[$gameId],
- 'spend_generic' => $spendGenericList[$gameId],
- 'spend_binding' => $spendBindingList[$gameId],
- 'spend_discount' => 0,
- 'spend_voucher' => 0,
];
+ if ($this->canViewUserRecharge) {
+ $record['spend_user_num'] = $spendUserNumList[$gameId];
+ $record['spend_num'] = $spendNumList[$gameId];
+ $record['spend_all_amount'] = $spendAllAmountList[$gameId];
+ $record['spend_cash'] = $spendCashList[$gameId];
+ $record['spend_generic'] = $spendGenericList[$gameId];
+ $record['spend_binding'] = $spendBindingList[$gameId];
+ $record['spend_discount'] = 0;
+ $record['spend_voucher'] = 0;
+ }
+
+ $records[] = $record;
}
$params['all_data'] = 1;
$params['game_ids'] = $allGameIs;
@@ -1353,18 +1370,20 @@ class QueryController extends BaseController
$allData['new_device_num'] = $userRepository->getNewCreateRoleDeviceCountByGame($params);//新创角设备
$allData['new_ip_num'] = $userRepository->getNewCreateRoleIpCountByGame($params);//新创角IP
$allData['login_user_num'] = $userRepository->getLoginCountGroupByGame($params);//登录用户数
- $allData['spend_user_num'] = $spendRepository->getPayUserCountByGame($params);//充值人数
- $allData['spend_num'] = $spendRepository->getPayCountByGame($params);//充值次数
- unset($params['pay_way']);
- $allData['spend_all_amount'] = null_to_0($spendRepository->getPayAmountByGameAndType($params));//充值总额
- $params['pay_way'] = ['in', '1,2,3,4,5,6'];
- $allData['spend_cash'] = null_to_0($spendRepository->getPayAmountByGameAndType($params));//现金充值
- $params['pay_way'] = 0;
- $allData['spend_generic'] = null_to_0($spendRepository->getPayAmountByGameAndType($params));//通用币充值
- $params['pay_way'] = -1;
- $allData['spend_binding'] = null_to_0($spendRepository->getPayAmountByGameAndType($params));//绑定币充值
- $allData['spend_discount'] = '0.00';
- $allData['spend_voucher'] = '0.00';
+ if ($this->canViewUserRecharge) {
+ $allData['spend_user_num'] = $spendRepository->getPayUserCountByGame($params);//充值人数
+ $allData['spend_num'] = $spendRepository->getPayCountByGame($params);//充值次数
+ unset($params['pay_way']);
+ $allData['spend_all_amount'] = null_to_0($spendRepository->getPayAmountByGameAndType($params));//充值总额
+ $params['pay_way'] = ['in', '1,2,3,4,5,6'];
+ $allData['spend_cash'] = null_to_0($spendRepository->getPayAmountByGameAndType($params));//现金充值
+ $params['pay_way'] = 0;
+ $allData['spend_generic'] = null_to_0($spendRepository->getPayAmountByGameAndType($params));//通用币充值
+ $params['pay_way'] = -1;
+ $allData['spend_binding'] = null_to_0($spendRepository->getPayAmountByGameAndType($params));//绑定币充值
+ $allData['spend_discount'] = '0.00';
+ $allData['spend_voucher'] = '0.00';
+ }
}
}
@@ -2093,9 +2112,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 +2131,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' => mb_strlen($parent['real_name'],'utf-8') == 2 ? mb_substr($parent['real_name'],0,1,'utf-8').'*':mb_substr($parent['real_name'],0,1,'utf-8').'**',
@@ -2120,18 +2142,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' => mb_strlen($promote['real_name'],'utf-8') == 2 ? mb_substr($promote['real_name'],0,1,'utf-8').'*':mb_substr($promote['real_name'],0,1,'utf-8').'**',
@@ -2142,14 +2170,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;
@@ -2179,4 +2210,206 @@ class QueryController extends BaseController
$this->ajaxReturn($data);
}
+
+ //推广员指标管理
+ public function promoteQuota()
+ {
+ $time = I('time', date('Y-m-d'));
+ if (!empty($time)) {
+ $defaultTime = $time;
+ } else {
+ $nowTime = date('Y-m-d', time());
+ $defaultTime = date('Y-m-d', strtotime('-6 day', time())) . " 至 " . $nowTime;
+ $time = $defaultTime;
+ }
+ $sdkVersion = I('sdk_version', 0);
+ $relationGameId = I('relation_game_id', 0);
+ $serverId = I('server_id', 0);
+ $parentId = I('parent_id', 0);
+ $promoteId = I('promote_id', 0);
+ $levelBegin = I('level_begin', '');
+ $levelEnd = I('level_end', '');
+ $prevParentId = 0;
+
+ $promoteService = new PromoteService();
+ $loginPromote = $this->getLoginPromote();
+
+ $parent = null;
+ if ($parentId > 0) {
+ $parent = M('promote', 'tab_')->where(['id' => $parentId])->find();
+ $currentDisplay = $promoteService->getLevelName($parent['level']) . '推广';
+ $prevParentId = $parent['parent_id'] == $loginPromote['parent_id'] ? 0 : $parent['parent_id'];
+ } else {
+ $parent = $loginPromote;
+ $currentDisplay = '自己';
+ }
+ $searchLevel = $parent['level'] + 1;
+ $searchLevelName = $promoteService->getLevelName($searchLevel);
+
+ $games = get_promote_serach_game();
+
+ $subPromotes = M('promote', 'tab_')->field(['id', 'account', 'real_name'])->where(['parent_id' => $parent['id']])->select();
+
+ $map = ['parent_id' => $parent['id']];
+ if ($promoteId > 0) {
+ $map['id'] = $promoteId;
+ }
+
+ $query = M('promote', 'tab_')->field(['id', 'account', 'real_name', 'level'])->where($map);
+ list($promotes, $pagination, $count) = $this->paginate($query);
+ $ids = array_column($promotes, 'id');
+
+ $rows = [];
+ if (count($ids) > 0) {
+ $rows = M('promote', 'tab_')
+ ->field(['id', 'chain'])
+ ->where(['chain' => ['like', [$parent['chain'] . $parent['id'] . '/%']], 'level' => ['gt', $parent['level'] + 1]])
+ ->select();
+ }
+
+ $basicPromotes = [];
+ foreach ($ids as $id) {
+ foreach ($rows as $row) {
+ $needChain = $parent['chain'] . $parent['id'] . '/' . $id . '/';
+ if (strpos($row['chain'], $needChain) !== false) {
+ $basicPromotes[$row['id']] = $id;
+ }
+ }
+ }
+ $params = [
+ 'isContainSubs' => true,
+ 'basicPromotes' => $basicPromotes,
+ ];
+ if ($relationGameId != 0 || $sdkVersion != 0) {
+ $gameIds = gameSearch($relationGameId, $sdkVersion);
+ $params['game_id'] = ['in', $gameIds];
+ }
+ if ($serverId > 0) {
+ $params['server_id'] = $serverId;
+ }
+ $where = $params;
+ if ($sdkVersion != 0) {
+ $where['sdk_version'] = $sdkVersion;
+ }
+ $game = $this->getGame($where);
+
+ if ($levelBegin !== '' || $levelEnd !== '') {
+ if ($levelBegin !== '' && $levelEnd !== '') {
+ $levelBegin = intval($levelBegin);
+ $levelEnd = intval($levelEnd);
+ if ($levelBegin > $levelEnd) {
+ $this->error('角色等级范围错误');
+ }
+ $params['role_level'] = ['between', [$levelBegin, $levelEnd]];
+ } elseif ($levelBegin !== '' && $levelEnd === '') {
+ $levelBegin = intval($levelBegin);
+ $params['role_level'] = ['egt', $levelBegin];
+ } elseif ($levelBegin === '' && $levelEnd !== '') {
+ $levelEnd = intval($levelEnd);
+ $params['role_level'] = ['elt', $levelEnd];
+ }
+ }
+ list($beginTime, $endTime) = $this->getBetweenTime($time);
+ $params['begin_time'] = $beginTime;
+ $params['end_time'] = $endTime;
+
+ $records = [];
+ $promoteRepository = new PromoteRepository();
+ $createRoleCountList = $promoteRepository->getCreateRoleCountByIds($ids, $params);
+
+ if (I('p', 1) == 1) {
+ $selfParams = $params;
+ $selfParams['isContainSubs'] = false;
+ $selfCreateRoleCountList = $promoteRepository->getCreateRoleCountByIds([$parent['id']], $selfParams);
+ $record = [
+ 'id' => $parent['id'],
+ 'account' => $parent['account'],
+ 'real_name' => mb_strlen($parent['real_name'],'utf-8') == 2 ? mb_substr($parent['real_name'],0,1,'utf-8').'*':mb_substr($parent['real_name'],0,1,'utf-8').'**',
+ 'level' => $parent['level'],
+ 'game_name' => $game['game_name'],
+ 'sdk_version_text' => $game['sdk_version_text'],
+ 'server_name' => $game['server_name'],
+ 'role_num' => $selfCreateRoleCountList[$parent['id']],
+ 'current_display' => $currentDisplay,
+ ];
+ $records[] = $record;
+ }
+ foreach ($promotes as $promote) {
+ $id = $promote['id'];
+ $record = [
+ 'id' => $id,
+ 'account' => $promote['account'],
+ 'real_name' => mb_strlen($promote['real_name'],'utf-8') == 2 ? mb_substr($promote['real_name'],0,1,'utf-8').'*':mb_substr($promote['real_name'],0,1,'utf-8').'**',
+ 'level' => $promote['level'],
+ 'game_name' => $game['game_name'],
+ 'sdk_version_text' => $game['sdk_version_text'],
+ 'server_name' => $game['server_name'],
+ 'role_num' => $createRoleCountList[$id],
+ 'current_display' => '',
+ ];
+ $records[] = $record;
+ }
+
+ $this->assign('prevParentId', $prevParentId);
+ $this->assign('searchLevelName', $searchLevelName);
+ $this->assign('games', $games);
+ $this->assign('parent', $parent);
+ $this->assign('subPromotes', $subPromotes);
+ $this->assign('records', $records);
+ $this->assign('pagination', $pagination);
+ $this->assign('parentId', $parentId);
+ $this->assign('count', $count);
+ $this->assign('time', $defaultTime);
+ $this->assign('meta_title', '推广员指标管理');
+ $this->display();
+ }
+
+ private function getGame($map = [])
+ {
+ $gameName = '全部游戏';
+ $sdkVersionText = getSDKTypeName(0, true);
+ $serverName = '--';
+ if (isset($map['game_id']) || isset($map['sdk_version'])) {
+ $where = [];
+ if (!isset($map['game_id'])) {
+ $sdkVersionText = getSDKTypeName($map['sdk_version'], true);
+ } elseif (!isset($map['sdk_version'])) {
+ $where['game_id'] = $map['game_id'];
+ $gameName = M('game', 'tab_')->where($where)->getField('relation_game_name');
+ if (isset($map['server_id'])) {
+ $serverName = $this->getServerName($map['game_id'], 0, $map['server_id']);
+ }
+ } else {
+ $where['game_id'] = $map['game_id'];
+ $where['sdk_version'] = $map['sdk_version'];
+ $gameName = M('game', 'tab_')->where($where)->getField('game_name');
+ $sdkVersionText = getSDKTypeName($map['sdk_version'], true);
+ if (isset($map['server_id'])) {
+ $serverName = $this->getServerName($map['game_id'], $map['sdk_version'], $map['server_id']);
+ }
+ }
+ }
+
+ $game = [
+ 'game_name' => $gameName,
+ 'sdk_version_text' => $sdkVersionText,
+ 'server_name' => $serverName,
+ ];
+ return $game;
+ }
+
+ private function getServerName($gameIds, $serverVersion, $serverId)
+ {
+ $map['_string'] = '1 = 1';
+ if ($gameIds) {
+ $map['game_id'] = $gameIds;
+ }
+ if ($serverVersion) {
+ $map['server_version'] = $serverVersion;
+ }
+ if ($serverId) {
+ $map['server_id'] = $serverId;
+ }
+ return M('server', 'tab_')->where($map)->getField('server_name');
+ }
}
diff --git a/Application/Home/View/default/Query/promoteQuota.html b/Application/Home/View/default/Query/promoteQuota.html
new file mode 100644
index 000000000..e499234fe
--- /dev/null
+++ b/Application/Home/View/default/Query/promoteQuota.html
@@ -0,0 +1,178 @@
+ 暂无数据
+
+
+
+
+ 推广员
+ 游戏名称
+ 平台
+ 游戏区服
+ 角色数量
+
+ 操作
+
+
+
+
+ {$record.account}({$record.real_name})
+
+ [{$record['current_display']}]
+
+
+ {$record.game_name}
+ {$record.sdk_version_text}
+ {$record.server_name}
+ {$record.role_num}
+
+
+
+ 查看下级
+
+
+
+