diff --git a/Application/Home/Controller/QueryController.class.php b/Application/Home/Controller/QueryController.class.php index fe0848f..1768fc5 100644 --- a/Application/Home/Controller/QueryController.class.php +++ b/Application/Home/Controller/QueryController.class.php @@ -120,6 +120,8 @@ class QueryController extends BaseController $map['tab_spend.pay_way'] = $payWay; } } + } else { + $map['tab_spend.pay_way'] = ['not in', [41]]; } if (isset($_REQUEST['pay_status']) && $_REQUEST['pay_status'] !== '') { $payStatus = intval(I('pay_status')); @@ -267,6 +269,223 @@ class QueryController extends BaseController $this->display(); } + public function rechargeMine($p = 0) + { + $page = intval(I('p', 1)); + $row = intval(I('row', 10)); + $ownId = intval(I('own_id'), 0); //本账号 + $relationGameId = intval(I('relation_game_id', 0)); + $sdkVersion = intval(I('sdk_version', 0)); + $serverId = trim(I('server_id', '')); + $gamePlayerName = trim(I('game_player_name', '')); + $userAccount = trim(I('user_account', '')); + $payOrderNumber = trim(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); + $endTime += 3600 * 24; + + $payedBegTime = I("payed_begtime", ''); + if ($payedBegTime) $payedBegTime = strtotime($payedBegTime); + $payedEndTime = I("payed_endtime", ''); + if ($payedEndTime) { + $payedEndTime = strtotime($payedEndTime) + 3600 * 24; + } + if ($payedBegTime && $payedEndTime) { + if (!I('begtime', '') && !I('endtime', '')) { + $initBegTime = ''; + $initEndTime = ''; + $begTime = 0; + $endTime = 0; + } + } + + $levelPromote = $this->getLevelPromote(); + $queryPromote = $this->getQueryPromote($levelPromote); + $loginPromote = $this->getLoginPromote(); + + $map = []; + if ($ownId) { + $map['tab_spend.promote_id'] = $queryPromote['id']; + } else { + $map['chain'] = ['like', $queryPromote['chain'] . $queryPromote['id'] . '/%']; + $ids = M('promote', 'tab_')->where($map)->getField('id', true); + $ids[] = $queryPromote['id']; + + $map = []; + $map['tab_spend.promote_id'] = ['in', $ids]; + } + if (!empty($relationGameId)) { + $map['tab_game.relation_game_id'] = $relationGameId; + } + if (!empty($sdkVersion)) { + $map['tab_game.sdk_version'] = $sdkVersion; + } + if (!empty($serverId)) { + $map['tab_spend.server_id'] = $serverId; + } + if (!empty($gamePlayerName)) { + $map['tab_spend.game_player_name'] = $gamePlayerName; + } + if (!empty($userAccount)) { + $map['tab_spend.user_account'] = $userAccount; + } + if (!empty($payOrderNumber)) { + $map['tab_spend.pay_order_number'] = $payOrderNumber; + } + $map['tab_spend.pay_way'] = ['in', [41]]; + if (isset($_REQUEST['pay_real_status']) && $_REQUEST['pay_real_status'] !== '') { + $payStatus = intval(I('pay_real_status')); + + if (in_array($payStatus, array_keys(QueryController::$payStatus))) { + $map['tab_spend.pay_real_status'] = $payStatus; + } + } + if ($begTime && $endTime) { + $map['tab_spend.spend_time'] = ['between', [$begTime, $endTime - 1]]; + } + if ($payedBegTime && $payedEndTime) { + $map['tab_spend.payed_time'] = ['between', [$payedBegTime, $payedEndTime - 1]]; + } + + $map = $this->spendRepository->withIsCheck($map, 'tab_spend.is_check'); + + $data = []; + $count = 0; + $aggregation = [ + 'cost' => '0.00', + 'pay_amount' => '0.00', + 'discount_amount' => '0.00', + ]; + if ( + intval($endTime - $begTime) / (24 * 3600) <= 31 + || intval($payedEndTime - $payedBegTime) / (24 * 3600) <= 31 + ) { + $data = M('Spend', 'tab_') + ->field('tab_spend.*,tab_promote.account as pro_account,tab_promote.real_name as pro_real_name,tab_promote.chain as chain,tab_promote.level,tab_promote.parent_id') + ->join('tab_game on tab_spend.game_id = tab_game.id') + ->join('left join tab_promote on tab_spend.promote_id = tab_promote.id') + ->where($map) + ->order('tab_spend.id desc') + ->page($page, $row) + ->select(); + + $count = M('Spend', 'tab_') + ->join('tab_game on tab_spend.game_id = tab_game.id') + ->where($map) + ->count(); + + $aggregation = M('Spend', 'tab_') + ->field('sum(tab_spend.cost) as cost, sum(tab_spend.pay_amount) as pay_amount, sum(tab_spend.discount_amount) as discount_amount') + ->join('tab_game on tab_spend.game_id = tab_game.id') + ->join('left join tab_promote on tab_spend.promote_id = tab_promote.id') + ->where($map) + ->order('tab_spend.id desc') + ->find(); + } + if (!empty($data)) { + $promoteIdData = []; + foreach ($data as $list) { + switch ($list['level']) { + case 3: + $promoteIdData[] = $list['parent_id']; + break; + case 4: + $promoteIdData[] = $list['parent_id']; + $chain = trim($list['chain'], '/'); + $chainArr = explode('/', $chain); + $promoteIdData[] = $chainArr[1]; + break; + } + } + $promoteData = []; + if (!empty($promoteIdData)) { + $promoteIdData = array_unique($promoteIdData); + $promoteData = M('promote', 'tab_')->where(array('id' => ['in', $promoteIdData]))->getField('id,account,real_name,group_remark'); + } + foreach ($data as &$list) { + switch ($list['level']) { + case 1: + case 2: + $list['p_p_pro_account'] = $list['pro_account']; + $list['p_p_pro_real_name'] = $list['pro_real_name']; + $list['p_pro_account'] = $list['pro_account']; + $list['p_pro_real_name'] = $list['pro_real_name']; + break; + case 3: + $list['p_p_pro_account'] = $promoteData[$list['parent_id']]['account']; + $list['p_p_pro_real_name'] = $promoteData[$list['parent_id']]['real_name']; + $list['p_pro_account'] = $list['pro_account']; + $list['p_pro_real_name'] = $list['pro_real_name']; + break; + case 4: + $promoteIdData[] = $list['parent_id']; + $chain = trim($list['chain'], '/'); + $chainArr = explode('/', $chain); + $list['p_p_pro_account'] = $promoteData[$chainArr[1]]['account']; + $list['p_p_pro_real_name'] = $promoteData[$chainArr[1]]['real_name']; + $list['p_p_pro_group_remark'] = $promoteData[$chainArr[1]]['group_remark']; + $list['p_pro_account'] = $promoteData[$list['parent_id']]['account']; + $list['p_pro_real_name'] = $promoteData[$list['parent_id']]['real_name']; + $list['p_pro_group_remark'] = $promoteData[$list['parent_id']]['group_remark']; + break; + } + $list['user_account'] = getUserAccountOfPromote($list['user_account'], $loginPromote); + $list['spend_time'] = date('Y-m-d H:i:s', $list['spend_time']); + $list['pay_time'] = ($list['pay_status'] == 1) ? date('Y-m-d H:i:s', $list['pay_time']) : '--'; + $list['pay_status'] = isset(QueryController::$payStatus[$list['pay_status']]) ? QueryController::$payStatus[$list['pay_status']] : '未知状态'; + $list['sdk_version'] = getSDKTypeName($list['sdk_version']); + $list['pay_order_number'] = hideOrderNumber($list['pay_order_number']); + } + } + + //分页 + $parameter['p'] = $page; + $parameter['row'] = $row; + $parameter['begtime'] = $initBegTime; + $parameter['endtime'] = $initEndTime; + $parameter['payed_begtime'] = I("payed_begtime", ''); + $parameter['payed_endtime'] = I("payed_endtime", ''); + $parameter['relation_game_id'] = $relationGameId; + $parameter['sdk_version'] = $sdkVersion; + $parameter['server_id'] = $serverId; + $parameter['game_player_name'] = $gamePlayerName; + $parameter['user_account'] = $userAccount; + $parameter['pay_order_number'] = $payOrderNumber; + $parameter['own_id'] = $ownId; + $parameter['level_promote_2'] = $levelPromote[0]; + $parameter['level_promote_3'] = $levelPromote[1]; + $parameter['level_promote_4'] = $levelPromote[2]; + !isset($_REQUEST['pay_way']) || $parameter['pay_way'] = I('pay_way'); + !isset($_REQUEST['pay_status']) || $parameter['pay_status'] = I('pay_status', -1); + + $serverData = $this->getServer(I('relation_game_id'), I('sdk_version')); + $page = set_pagination($count, $row, $parameter); + if ($page) { + $this->assign('_page', $page); + } + $this->assign('listData', $data); + $this->assign('count', $count); + $this->assign('aggregation', $aggregation); + $this->assign('initBegTime', $initBegTime); + $this->assign('initEndTime', $initEndTime); + $this->assign('payedBegTime', I("payed_begtime", '')); + $this->assign('payedEndTime', I("payed_endtime", '')); + $this->assign('setdate', date("Y-m-d")); + $this->assign('serverData', $serverData['data']); + $this->assign('ownId', $ownId); + $this->assign('payWayData', QueryController::$payWay); + $this->assign('payStatusData', QueryController::$payStatus); + $this->meta_title = "订单查询"; + $this->display(); + } + public function register($p = 0) { $page = intval(I('p', 1)); diff --git a/Application/Home/View/default/Query/rechargeMine.html b/Application/Home/View/default/Query/rechargeMine.html new file mode 100644 index 0000000..371b50e --- /dev/null +++ b/Application/Home/View/default/Query/rechargeMine.html @@ -0,0 +1,472 @@ + + + + + + + + + + + + + + + + + + + + + + +