getLevelPromote(); $queryPromote = $this->getQueryPromote($levelPromote); // $loginPromote = $this->getLoginPromote(); $map = []; $map['chain'] = ['like', $queryPromote['chain'] . $queryPromote['id'] . '/%']; $ids = M('promote', 'tab_')->where($map)->getField('id', true); $ids[] = $queryPromote['id']; $map = []; $map['tab_pay_info.promote_id'] = ['in', $ids]; if ($relationGameId != 0 || $sdkVersion != 0) { if ($relationGameId != 0) { $gameMap['relation_game_id'] = $relationGameId; } if ($sdkVersion != 0) { $gameMap['sdk_version'] = $sdkVersion; } $gameId = M('game', 'tab_')->where($gameMap)->getField('id', true); $map['game_id'] = ['in', $gameId]; } if (!empty($serverId)) { $map['tab_pay_info.server_id'] = $serverId; } if (!empty($gamePlayerName)) { $map['tab_pay_info.game_player_name'] = $gamePlayerName; } if (!empty($userAccount)) { $map['tab_pay_info.user_account'] = $userAccount; } if (!empty($extend)) { $map['tab_pay_info.extend'] = $extend; } if (!empty($userId)) { $map['tab_pay_info.user_id'] = $userId; } if (!empty($begTime) && !empty($endTime)) { $map['tab_pay_info.create_time'] = ['between', [$begTime, $endTime - 1]]; }else if (empty($begTime) && !empty($endTime)) { $map['tab_pay_info.create_time'] = ['elt',$endTime]; }else if (!empty($begTime) && empty($endTime)) { $map['tab_pay_info.create_time'] = ['EGT',$begTime]; } $page = intval(I('get.p', 1)); $page = $page ? $page : 1; //默认显示第一页数据arraypage $row=10; $rs = M('pay_info','tab_')->where($map)->order('tab_pay_info.create_time desc') ->page($page, $row)->select(); foreach($rs as $key => $v) { $rs[$key]['extend'] = encryption($v['extend']); $rs[$key]['create_time'] = date('Y-m-d H:i:s',$v['create_time']); $promoteInfo = M('promote','tab_')->field("nickname")->where(['id' => intval($v['promote_id'])])->find(); $rs[$key]['promote_id']= $promoteInfo['nickname']; } $count = M('pay_info', 'tab_') ->field('tab_pay_info.id') ->where($map) ->select(); $count = count($count); //分页 $parameter['p'] = $page; $parameter['row'] = $row; $parameter['begtime'] = $initBegTime; $parameter['endtime'] = $initEndTime; $parameter['relation_game_id'] = $relationGameId; $parameter['sdk_version'] = $sdkVersion; $parameter['server_id'] = $serverId; $parameter['game_player_name'] = $gamePlayerName; $parameter['user_account'] = $userAccount; $parameter['extend'] = $extend; $parameter['user_id'] = $user_id; $parameter['level_promote_2'] = $levelPromote[0]; $parameter['level_promote_3'] = $levelPromote[1]; $parameter['level_promote_4'] = $levelPromote[2]; $page = set_pagination($count, $row, $parameter); if ($page) { $this->assign('_page', $page); } $this->assign('listData',$rs); $this->assign('initBegTime', I('begtime')); $this->assign('initEndTime', I('endtime')); $this->display(); } private function getLevelPromote() { $levelPromote = []; $levelPromote[] = I('level_promote_2', 0); $levelPromote[] = I('level_promote_3', 0); $levelPromote[] = I('level_promote_4', 0); return $levelPromote; } private function getQueryPromote($levelPromote) { $queryPromote = null; $promote = $this->getLoginPromote(); $queryPromoteId = 0; foreach ($levelPromote as $item) { if ($item != 0) { $queryPromoteId = $item; } } if ($queryPromoteId == 0) { $queryPromote = $this->getLoginPromote(); } else { $queryPromote = M('promote', 'tab_')->where(['id' => $queryPromoteId])->find(); } return $queryPromote; } }