From e020b09e4d4de150b89364fd6a38460355528625 Mon Sep 17 00:00:00 2001 From: ELF <360197197@qq.com> Date: Wed, 9 Oct 2019 18:36:36 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B5=8B=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Repository/PromoteRepository.class.php | 221 ++++++++++++++++++ .../Home/Controller/QueryController.class.php | 49 ++++ .../View/default/Public/promote_base.html | 23 +- .../Home/View/default/Query/achievement.html | 201 ++++++++++++++++ Data/update.sql | 7 +- 5 files changed, 488 insertions(+), 13 deletions(-) create mode 100644 Application/Base/Repository/PromoteRepository.class.php create mode 100644 Application/Home/View/default/Query/achievement.html diff --git a/Application/Base/Repository/PromoteRepository.class.php b/Application/Base/Repository/PromoteRepository.class.php new file mode 100644 index 000000000..41af955c3 --- /dev/null +++ b/Application/Base/Repository/PromoteRepository.class.php @@ -0,0 +1,221 @@ +field(['count(*) count', 'promote_id'])->where($map)->groupBy('promote_id')->select(); + + $records = []; + foreach ($items as $item) { + $records[$item['promote_id']] = $item['count']; + + } + + $records = $this->assembleZero($ids, $records, 0); + + return $records; + } + + /** + * 获取指定推广员底下的角色创建的用户数 + */ + public function getCreateRoleUserCountByIds($ids, $beginTime, $endTime) + { + $map = []; + $map['id'] = ['in', $ids]; + if (isset($params['begin_time']) && isset($params['begin_time'])) { + $map['create_time'] = ['between', [$params['begin_time'], $params['end_time']]]; + } + if (isset($params['game_id'])) { + $map['game_id'] = $params['game_id']; + } + if (isset($params['server_id'])) { + $map['server_id'] = $params['server_id']; + } + if (isset($params['sdk_version'])) { + $map['sdk_version'] = $params['sdk_version']; + } + $items = M('user_play_info', 'tab_')->field(['count(distinct user_id) count', 'promote_id'])->where($map)->groupBy('promote_id')->select(); + + $records = []; + foreach ($items as $item) { + $records[$item['promote_id']] = $item['count']; + } + + $records = $this->assembleZero($ids, $records, 0); + + return $records; + } + + /** + * + */ + public function getCreateRoleDeviceCountByIds($ids, $beginTime, $endTime) + { + + } + + public function getCreateRoleIpCountByIds($ids, $beginTime, $endTime) + { + + } + + /** + * 获取指定推广员底下的登录用户数 + */ + public function getLoginUserCountByIds($ids, $beginTime, $endTime) + { + $map = []; + $map['id'] = ['in', $ids]; + if (isset($params['begin_time']) && isset($params['begin_time'])) { + $map['login_time'] = ['between', [$params['begin_time'], $params['end_time']]]; + } + if (isset($params['game_id'])) { + $map['game_id'] = $params['game_id']; + } + if (isset($params['server_id'])) { + $map['server_id'] = $params['server_id']; + } + if (isset($params['sdk_version'])) { + $map['sdk_version'] = $params['sdk_version']; + } + $items = M('user', 'tab_')->field(['count(*) count', 'promote_id'])->where($map)->groupBy('promote_id')->select(); + + $records = []; + foreach ($items as $item) { + $records[$item['promote_id']] = $item['count']; + } + + $records = $this->assembleZero($ids, $records, 0); + + return $records; + } + + /** + * 获取指定推广员底下的充值次数 + */ + public function getRechargeCountByIds($ids, $beginTime, $endTime) + { + $map = ['pay_status' => 1, 'id' => ['in', $ids]]; + if (isset($params['begin_time']) && isset($params['begin_time'])) { + $map['pay_time'] = ['between', [$params['begin_time'], $params['end_time']]]; + } + if (isset($params['game_id'])) { + $map['game_id'] = $params['game_id']; + } + if (isset($params['server_id'])) { + $map['server_id'] = $params['server_id']; + } + if (isset($params['sdk_version'])) { + $map['sdk_version'] = $params['sdk_version']; + } + + $items = M('spend', 'tab_')->field(['count(*) count', 'promote_id'])->where($map)->groupBy('promote_id')->select(); + + $records = []; + foreach ($items as $item) { + $records[$item['promote_id']] = $item['count']; + } + + $records = $this->assembleZero($ids, $records, 0); + + return $records; + } + + /** + * 获取指定推广员底下的充值用户数 + */ + public function getRechargeUserCountByIds($ids, $beginTime, $endTime) + { + $map = ['pay_status' => 1, 'id' => ['in', $ids]]; + if (isset($params['begin_time']) && isset($params['begin_time'])) { + $map['pay_time'] = ['between', [$params['begin_time'], $params['end_time']]]; + } + if (isset($params['game_id'])) { + $map['game_id'] = $params['game_id']; + } + if (isset($params['server_id'])) { + $map['server_id'] = $params['server_id']; + } + if (isset($params['sdk_version'])) { + $map['sdk_version'] = $params['sdk_version']; + } + $items = M('spend', 'tab_')->field(['count(distinct user_id) count', 'promote_id'])->where($map)->groupBy('promote_id')->select(); + + $records = []; + foreach ($items as $item) { + $records[$item['promote_id']] = $item['count']; + } + + $records = $this->assembleZero($ids, $records, 0); + + return $records; + } + + public function getRechargeAmountByIds($ids, $beginTime, $endTime) + { + $map = ['pay_status' => 1, 'id' => ['in', $ids]]; + if (isset($params['begin_time']) && isset($params['begin_time'])) { + $map['pay_time'] = ['between', [$params['begin_time'], $params['end_time']]]; + } + if (isset($params['game_id'])) { + $map['game_id'] = $params['game_id']; + } + if (isset($params['server_id'])) { + $map['server_id'] = $params['server_id']; + } + if (isset($params['sdk_version'])) { + $map['sdk_version'] = $params['sdk_version']; + } + $items = M('spend', 'tab_')->field(['sum(pay_amount) amount', 'promote_id', 'pay_way'])->where($map)->groupBy('promote_id, pay_way')->select(); + $records = []; + foreach ($items as $item) { + if (isset($records[$item['promote_id']])) { + if ($item['pay_way'] == -1) { + $records[$item['promote_id']]['ban_coin'] = $item['amount']; + } elseif ($item['pay_way'] == 0) { + $records[$item['promote_id']]['coin'] = $item['amount']; + } else { + $records[$item['promote_id']]['cash'] = isset$item['amount']; + } + } else { + + } + $records[$item['promote_id']] = $item['count']; + } + } +} \ No newline at end of file diff --git a/Application/Home/Controller/QueryController.class.php b/Application/Home/Controller/QueryController.class.php index 3382bdd5b..35c91c518 100644 --- a/Application/Home/Controller/QueryController.class.php +++ b/Application/Home/Controller/QueryController.class.php @@ -4,6 +4,7 @@ namespace Home\Controller; use OT\DataDictionary; use User\Api\PromoteApi; +use Base\Repository\PromoteRepository; /** * 前台首页控制器 @@ -1882,4 +1883,52 @@ class QueryController extends BaseController $this->assign('list_data', $spendData); $this->display('view_spend_detailed'); } + + public function achievement() + { + $time = I('time', ''); + $sdkVersion = I('sdk_version', 0); + $gameId = I('game_id', 0); + $serverId = I('server_id', 0); + $promoteId = I('promote_id', 0); + + $promote = $this->getLoginPromote(); + + $query = M('promote', 'tab_')->field(['id', 'account', 'real_name'])->where(['parent_id' => $promote['id']])->select(); + list($promotes, $pagination, $count) = $this->paginate($query); + + $ids = array_column($promotes, 'id'); + $promoteRepository = new PromoteRepository(); + $createRoleCountList = $promoteRepository->getCreateRoleCountByIds($ids, $beginTime, $endTime); + $createRoleUserCountList = $promoteRepository->getCreateRoleUserCountByIds($ids, $beginTime, $endTime); + $createRoleDeviceCountList = $promoteRepository->getCreateRoleDeviceCountByIds($ids, $beginTime, $endTime); + $createRoleIpCountList = $promoteRepository->getCreateRoleIpCountByIds($ids, $beginTime, $endTime); + $loginUserCountList = $promoteRepository->getLoginUserCountByIds($ids, $beginTime, $endTime); + $rechargeCountList = $promoteRepository->getRechargeCountByIds($ids, $beginTime, $endTime); + $rechargeUserCountList = $promoteRepository->getRechargeUserCountByIds($ids, $beginTime, $endTime); + $rechargeAmountList = $promoteRepository->getRechargeAmountByIds($ids, $beginTime, $endTime); + + $records = []; + foreach ($promotes as $promote) { + $id = $promote['id']; + $records[] = [ + 'id' => $id, + 'account' => $promote['account'], + 'real_name' => $promote['real_name'], + 'create_role_count' => $createRoleCountList[$id], + 'create_role_user_count' => $createRoleUserCountList[$id], + 'create_role_device_count' => $createRoleDeviceCountList[$id], + 'create_role_ip_count' => $createRoleIpCountList[$id], + 'login_user_count' => $loginUserCountList[$id], + 'recharge_count' => $rechargeCountList[$id], + 'recharge_user_count' => $rechargeUserCountList[$id], + 'recharge_amount' => $rechargeAmountList[$id], + ]; + } + + $this->assign('records', $records); + $this->assign('pagination', $pagination); + $this->assign('count', $count); + $this->display(); + } } diff --git a/Application/Home/View/default/Public/promote_base.html b/Application/Home/View/default/Public/promote_base.html index 5fc9abf33..d75d13e0d 100644 --- a/Application/Home/View/default/Public/promote_base.html +++ b/Application/Home/View/default/Public/promote_base.html @@ -47,17 +47,18 @@ 推广员管理 - - - - - - - - - - - +
账号(姓名) | +创角数 | +创角用户 | +新创角用户 | +新创角设备 | +新创角IP | +登录用户数 | +充值人数 | +充值次数 | +充值总额 | +现金充值 | +通用币充值 | +绑定币充值 | +操作 | +|
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
![]() 暂无数据 | ||||||||||||||
{$record.account}({$record.real_name}) | +{$record.create_role_count} | +{$record.create_role_user_count} | ++ | + | + | {$record.login_user_count} | +{$record.create_role_user_count} | +{$record.recharge_count} | +{$record.recharge_user_count} | +{$record.recharge_amount} | ++ | + | + | 查看下级 | +