diff --git a/Application/Admin/Controller/PromoteController.class.php b/Application/Admin/Controller/PromoteController.class.php index c17d531f2..654a0b42d 100644 --- a/Application/Admin/Controller/PromoteController.class.php +++ b/Application/Admin/Controller/PromoteController.class.php @@ -97,7 +97,7 @@ unset($_REQUEST['parent_id']); parent::order_lists(self::model_name,$p,$map); } - private function siteApplyList($request,$p){ + private function siteApplyList($p){ if(isset($_REQUEST['promote_id'])){ $map['promote_id']=$_REQUEST['promote_id']; unset($_REQUEST['promote_id']); diff --git a/Application/Base/Repository/PromoteRepository.class.php b/Application/Base/Repository/PromoteRepository.class.php index 9f2f55f50..b21ee2073 100644 --- a/Application/Base/Repository/PromoteRepository.class.php +++ b/Application/Base/Repository/PromoteRepository.class.php @@ -8,7 +8,8 @@ class PromoteRepository { } - private function assembleZero($allKeys, $records, $zeroValue) { + private function assembleZero($allKeys, $records, $zeroValue) + { $noExistKeys = array_diff($allKeys, array_keys($records)); foreach ($noExistKeys as $key) { $records[$key] = $zeroValue; 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/FinanceController.class.php b/Application/Home/Controller/FinanceController.class.php index 8296697fe..67a5c6191 100644 --- a/Application/Home/Controller/FinanceController.class.php +++ b/Application/Home/Controller/FinanceController.class.php @@ -13,5 +13,75 @@ use Base\Repository\UserRepository; */ class FinanceController extends BaseController { - + public function settlementDtl() + { + $model = M('spend', 'tab_'); + $page = intval(I('get.p', 1)); + $page = $page ? $page : 1; //默认显示第一页数据arraypage + $row = intval(I('get.row', 10)); + $payOrderNumber = I('pay_order_number', ''); + $nowTime = date('Y-m-d'); + $initBegTime = date('Y-m-d', strtotime('-6 day', strtotime($nowTime))); + $initBegTime = empty(I('begtime')) ? $initBegTime : I('begtime'); + $initEndTime = $nowTime; + $initEndTime = empty(I('endtime')) ? $initEndTime : I('endtime'); + $begTime = strtotime($initBegTime); + $endTime = strtotime($initEndTime); + $loginPromote = $this->getLoginPromote(); + + $parameter['p'] = $page; + $parameter['row'] = $row; + $parameter['pay_order_number'] = $payOrderNumber; + $parameter['begtime'] = $initBegTime; + $parameter['endtime'] = $initEndTime; + + $map['chain'] = ['like', $loginPromote['chain'] . $loginPromote['id'] . '/%']; + $ids = M('promote', 'tab_')->where($map)->getField('id', true); + $ids[] = $loginPromote['id']; + $ids = implode(',', $ids); +// var_dump($ids); +// die; + + $map = []; + $map['promote_id'] = ['in', $ids]; + if (!empty($payOrderNumber)) { + $map['pay_order_number'] = $payOrderNumber; + } + if (!empty($begTime) && empty($endTime)) { + $map['pay_time'] = ['egt', $begTime]; + } elseif (empty($begTime) && !empty($endTime)) { + $map['pay_time'] = ['elt', $endTime + 86399]; + } elseif (!empty($begTime) && !empty($endTime)) { + $map['pay_time'] = ['between', [$begTime, $endTime + 86399]]; + } + + $data = $model->field('pay_order_number,game_name,user_account,promote_account,pay_amount,pay_way,if(selle_ratio >= 0,selle_ratio,0) as selle_ratio,convert(pay_amount*if(selle_ratio >= 0,selle_ratio,0),decimal(10,2)) as income,pay_time,selle_status') + ->where($map) + ->order('id desc') + ->page($page, $row) + ->select(); + $count = $model->where($map)->count(); + + foreach ($data as &$list) { + switch ($list['selle_status']) { + case 0: + $list['selle_status'] = '未提现'; + break; + default: + $list['selle_status'] = ''; + break; + } + $list['pay_time'] = date('Y-m-d H:i:s', $list['pay_time']); + } + + $page = set_pagination($count, $row, $parameter); + + $this->assign('listData', $data); + $this->assign('count', $count); + $this->assign('initBegTime', $initBegTime); + $this->assign('initEndTime', $initEndTime); + $this->assign('_page', $page); + $this->assign('meta_title', '结算明细'); + $this->display(); + } } \ No newline at end of file diff --git a/Application/Home/Controller/PromoteCoinController.class.php b/Application/Home/Controller/PromoteCoinController.class.php index 8b0b048e3..e81487c71 100644 --- a/Application/Home/Controller/PromoteCoinController.class.php +++ b/Application/Home/Controller/PromoteCoinController.class.php @@ -588,13 +588,9 @@ class PromoteCoinController extends BaseController if ($promoteCoin['source_type'] == 2) { return '玩家转账'; } else { - if ($promote['parent_id'] == 1) { - return '会长转账'; - } elseif ($promote['parent_id'] > 0 && $promote['grand_id'] == 0) { - return '组长转账'; - } elseif ($promote['grand_id'] > 0) { - return '推广员转账'; - } + $promoteService = new PromoteService(); + $levelName = $promoteService->getLevelName($promote['level']); + return $levelName . '转账'; } } @@ -760,9 +756,10 @@ class PromoteCoinController extends BaseController { $account = I('account', ''); $mobile = I('mobile', ''); - $id = session('promote_auth.pid'); - $promoteIds = D('Promote')->field('id')->where('parent_id=' . $id . ' or grand_id=' . $id)->select(); - $promoteIds = array_merge(array_column($promoteIds, 'id'), [$id]); + $promote = $this->getLoginPromote(); + $map = ['chain' => ['like', $promote['chain'] . $promote['id'] . '/%']]; + $promoteIds = D('Promote')->field('id')->where($map)->getField('id', true); + $promoteIds[] = $id; $rows = D('UserPlay')->field(['id', 'user_id'])->where(['promote_id' => ['in', $promoteIds]])->select(); $map = []; diff --git a/Application/Home/Controller/QueryController.class.php b/Application/Home/Controller/QueryController.class.php index 07da8188e..3d851aa28 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($parent['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/Finance/settlementDtl.html b/Application/Home/View/default/Finance/settlementDtl.html new file mode 100644 index 000000000..b202784fe --- /dev/null +++ b/Application/Home/View/default/Finance/settlementDtl.html @@ -0,0 +1,227 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Application/Home/View/default/Public/promote_base.html b/Application/Home/View/default/Public/promote_base.html index 6135f4ce0..8c3a509e5 100644 --- a/Application/Home/View/default/Public/promote_base.html +++ b/Application/Home/View/default/Public/promote_base.html @@ -69,15 +69,15 @@ - - + + - -
- 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 @@ + - - - - \ No newline at end of file diff --git a/Data/update.sql b/Data/update.sql index 3887716ff..933115d79 100644 --- a/Data/update.sql +++ b/Data/update.sql @@ -298,4 +298,28 @@ CREATE TABLE `tab_spend_user_count` ( KEY `chain` (`chain`) USING BTREE, KEY `level` (`level`) USING BTREE, KEY `count_date` (`count_date`) USING BTREE -) ENGINE=MyISAM AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC COMMENT='流水角色聚合表'; \ No newline at end of file +) ENGINE=MyISAM AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC COMMENT='流水角色聚合表'; + +--downloadlog下载日志数据表 +DROP TABLE IF EXISTS `tab_downloadlog`; +CREATE TABLE IF NOT EXISTS `tab_downloadlog` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `logid` varchar(254) NOT NULL DEFAULT '0' COMMENT '日志id', + `admin_id` int(11) NOT NULL DEFAULT '0' COMMENT '推广者|管理员id', + `type` varchar(254) NOT NULL DEFAULT '0' COMMENT '下载控制器地址', + `dataname` varchar(254) NOT NULL DEFAULT '0' COMMENT '导出数据名称', + `status` int(11) NOT NULL DEFAULT '0' COMMENT '下载状态 0未下载 1已下载', + `addtime` int(11) NOT NULL DEFAULT '0' COMMENT '添加下载时间戳', + `begintime` int(11) NOT NULL DEFAULT '0' COMMENT '开始下载时间戳', + `content` mediumtext COMMENT '备注内容', + `conditions` varchar(1024) DEFAULT '[]' COMMENT '下载筛选条件', + PRIMARY KEY (`id`) +) ENGINE=MyISAM AUTO_INCREMENT=220 DEFAULT CHARSET=utf8 COMMENT='下载管理日志'; + +ALTER TABLE `tab_promote` + ADD COLUMN `ver_status` TINYINT(2) NULL DEFAULT NULL COMMENT '资质认证审核状态(1是审核成功,2审核失败,3未审核)' AFTER `child_game_permission`, + ADD COLUMN `idcarpic` CHAR(253) NULL DEFAULT NULL COMMENT '身份证证件照' AFTER `ver_status`, + ADD COLUMN `businesspic` CHAR(253) NULL DEFAULT NULL COMMENT '营业执照' AFTER `idcarpic`, + ADD COLUMN `agreementpic` CHAR(253) NULL DEFAULT NULL COMMENT '合同' AFTER `businesspic`, + ADD COLUMN `address` VARCHAR(520) NULL DEFAULT NULL COMMENT '住址' AFTER `agreementpic`, + ADD COLUMN `account_type` INT(11) NULL DEFAULT NULL COMMENT '(1为公司,2为个人)' AFTER `address`; \ No newline at end of file