You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
137 lines
5.0 KiB
PHP
137 lines
5.0 KiB
PHP
<?php
|
|
|
|
namespace Home\Controller;
|
|
|
|
|
|
|
|
/**
|
|
* 前台首页控制器
|
|
* 主要获取首页聚合数据
|
|
*/
|
|
class PlayersController extends BaseController {
|
|
|
|
//玩家行为日志
|
|
public function playAction() {
|
|
$page = intval(I('p', 1));
|
|
$row = intval(I('row', 10));
|
|
$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', ''));
|
|
$userId = trim(I('user_id', ''));
|
|
$extend = trim(I('extend', '')); //cp订单号
|
|
$begTime = strtotime(I('begtime'));
|
|
$endTime = strtotime(I('endtime'));
|
|
$levelPromote = $this->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;
|
|
}
|
|
} |