Merge branch 'feature/promote' of 47.111.118.107:/srv/git/platform into feature/promote

master
zyx 5 years ago
commit 938c4e9eda

@ -171,6 +171,15 @@ class SpendRepository
return $this->assembleRecords($items, $gameIds, 'amount', 'game_id');
}
/**
* 按游戏统计付款总额--cxj
*/
public function getPayAmountByGameAndType($params)
{
$conditions = $this->getGameGroupConditionsNew($params);
return M('spend', 'tab_')->where($conditions)->sum('pay_amount');
}
/**
* 按天统计付款用户数
*/
@ -219,6 +228,15 @@ class SpendRepository
return $this->assembleRecords($items, $gameIds, 'count', 'game_id');
}
/**
* 按游戏统计付款次数--cxj
*/
public function getPayCountByGame($params)
{
$conditions = $this->getGameGroupConditions($params);
return M('spend', 'tab_')->where($conditions)->count();
}
/**
* 游戏统计付款用户数
*/
@ -231,6 +249,20 @@ class SpendRepository
return $this->assembleRecords($items, $gameIds, 'count', 'game_id');
}
/**
* 游戏统计付款用户数--cxj
*/
public function getPayUserCountByGame($params)
{
$conditions = $this->getGameGroupConditions($params);
$sql = M('spend', 'tab_')->field('distinct game_id, user_id')
->where($conditions)
->fetchSql(true)
->select();
$model = new \Think\Model();
return $model->query("select count(*) as num from ($sql) as t")[0]['num'];
}
/**
* 按照时间分组统计新增付费用户数
*/

@ -66,9 +66,11 @@ class UserRepository
$conditions = [];
$conditions['promote_id'] = ['in', $ids];
$conditions[$params['time_column']] = ['between', [$beginTime, $endTime]];
$conditions['game_id'] = ['in', $gameIds];
if (!empty($params['server_id'])) {
$conditions['server_id'] = $params['server_id'];
if (!empty($gameIds)) {
$conditions['game_id'] = ['in', $gameIds];
if (!empty($params['server_id'])) {
$conditions['server_id'] = $params['server_id'];
}
}
return $conditions;
@ -154,12 +156,21 @@ class UserRepository
$gameIds = $params['game_ids'] ?? [];
$params['time_column'] = 'login_time';
$conditions = $this->getGameGroupConditions($params);
$items = M('user_login_record', 'tab_')->field('game_id, count(DISTINCT user_id) as count')
->where($conditions)
->group('game_id')
->select();
if (isset($params['all_data'])) {
$sql = M('user_login_record', 'tab_')->field('distinct game_id, user_id')
->where($conditions)
->fetchSql(true)
->select();
$model = new \Think\Model();
return $model->query("select count(*) as num from ($sql) as t")[0]['num'];
} else {
$items = M('user_login_record', 'tab_')->field('game_id, count(DISTINCT user_id) as count')
->where($conditions)
->group('game_id')
->select();
return $this->assembleRecords($items, $gameIds, 'count', 'game_id');
return $this->assembleRecords($items, $gameIds, 'count', 'game_id');
}
}
/**
@ -268,11 +279,17 @@ class UserRepository
$params['time_column'] = 'create_time';
$conditions = $this->getCreateRoleByGameConditions($params);
$items = M('user_play_info', 'tab_')->field('count(*) count, game_id')
->where($conditions)
->group('game_id')
->select();
return $this->assembleRecords($items, $gameIds, 'count', 'game_id');
if (isset($params['all_data'])) {
return M('user_play_info', 'tab_')
->where($conditions)
->count();
} else {
$items = M('user_play_info', 'tab_')->field('count(*) count, game_id')
->where($conditions)
->group('game_id')
->select();
return $this->assembleRecords($items, $gameIds, 'count', 'game_id');
}
}
/**
@ -300,11 +317,20 @@ class UserRepository
$params['time_column'] = 'create_time';
$conditions = $this->getCreateRoleByGameConditions($params);
$items = M('user_play_info', 'tab_')->field('count(distinct game_id,user_id) count, game_id')
->where($conditions)
->group('game_id')
->select();
return $this->assembleRecords($items, $gameIds, 'count', 'game_id');
if (isset($params['all_data'])) {
$sql = M('user_play_info', 'tab_')->field('distinct game_id, user_id')
->where($conditions)
->fetchSql(true)
->select();
$model = new \Think\Model();
return $model->query("select count(*) as num from ($sql) as t")[0]['num'];
} else {
$items = M('user_play_info', 'tab_')->field('count(distinct user_id) count, game_id')
->where($conditions)
->group('game_id')
->select();
return $this->assembleRecords($items, $gameIds, 'count', 'game_id');
}
}
/**
@ -356,12 +382,20 @@ class UserRepository
->where("ti.user_id = user_id and ti.game_id = game_id and ti.create_time < " . $params['begin_time'])
->fetchSql(true)
->count();
$items = $model->field("count(distinct game_id,user_id) count, game_id, (" . $sql . ") as num")
->where($conditions)
->group("game_id")
->having('num = 0')
->select();
return $this->assembleRecords($items, $gameIds, 'count', 'game_id');
if (isset($params['all_data'])) {
return count($model->field("game_id, (" . $sql . ") as num")
->where($conditions)
->group('game_id, user_id')
->having('num = 0')
->select());
} else {
$items = $model->field("count(distinct user_id) count, game_id, (" . $sql . ") as num")
->where($conditions)
->group("game_id")
->having('num = 0')
->select();
return $this->assembleRecords($items, $gameIds, 'count', 'game_id');
}
}
/**
@ -413,12 +447,20 @@ class UserRepository
->where("ti.create_device_number = create_device_number and ti.game_id = game_id and ti.create_time < " . $params['begin_time'])
->fetchSql(true)
->count();
$items = $model->field("count(distinct game_id,create_device_number) count, game_id, (" . $sql . ") as num")
->where($conditions)
->group("game_id")
->having('num = 0')
->select();
return $this->assembleRecords($items, $gameIds, 'count', 'game_id');
if (isset($params['all_data'])) {
return count($model->field("game_id, (" . $sql . ") as num")
->where($conditions)
->group('game_id, create_device_number')
->having('num = 0')
->select());
} else {
$items = $model->field("count(distinct game_id,create_device_number) count, game_id, (" . $sql . ") as num")
->where($conditions)
->group("game_id")
->having('num = 0')
->select();
return $this->assembleRecords($items, $gameIds, 'count', 'game_id');
}
}
/**
@ -470,11 +512,19 @@ class UserRepository
->where("ti.create_ip = create_ip and ti.game_id = game_id and ti.create_time < " . $params['begin_time'])
->fetchSql(true)
->count();
$items = $model->field("count(distinct game_id,create_ip) count, game_id, (" . $sql . ") as num")
->where($conditions)
->group("game_id")
->having('num = 0')
->select();
return $this->assembleRecords($items, $gameIds, 'count', 'game_id');
if (isset($params['all_data'])) {
return count($model->field("game_id, (" . $sql . ") as num")
->where($conditions)
->group('game_id, create_ip')
->having('num = 0')
->select());
} else {
$items = $model->field("count(distinct game_id,create_ip) count, game_id, (" . $sql . ") as num")
->where($conditions)
->group("game_id")
->having('num = 0')
->select();
return $this->assembleRecords($items, $gameIds, 'count', 'game_id');
}
}
}

@ -1194,6 +1194,7 @@ class QueryController extends BaseController
$page = intval(I('get.p', 1));
$page = $page ? $page : 1; //默认显示第一页数据arraypage
$row = intval(I('get.row', 10));
$ownId = intval(I('own_id'), 0);//本账号
$relationGameId = intval(I('relation_game_id', 0));
$sdkVersion = intval(I('sdk_version', 0));
$serverId = intval(I('server_id'), 0);
@ -1216,13 +1217,13 @@ class QueryController extends BaseController
$parameter['level_promote_4'] = $levelPromote[2];
$parameter['begtime'] = $initBegTime;
$parameter['endtime'] = $initEndTime;
$parameter['own_id'] = $ownId;
$parameter['p'] = $page;
$parameter['row'] = $row;
$loginPromote = $this->getLoginPromote();
$map = [];
$ownId = intval(I('own_id'), 0);//本账号
if ($ownId) {
$map['a.promote_id'] = $queryPromote['id'];
$params['promote_ids'] = $queryPromote['id'];
@ -1265,6 +1266,13 @@ class QueryController extends BaseController
->join($serverJoin)
->where($map)
->count('distinct a.game_id');
$allGameIs = M('Apply', 'tab_')->alias('a')
->field('distinct a.game_id')
->join('tab_game as g on g.id = a.game_id')
->join($serverJoin)
->where($map)
->select();
$allGameIs = array_column($allGameIs, 'game_id');
$records = [];
$allData['role_num'] = 0;
@ -1327,22 +1335,25 @@ class QueryController extends BaseController
'spend_discount' => 0,
'spend_voucher' => 0,
];
$allData['role_num'] += $roleNumList[$gameId];
$allData['user_num'] += $userNumList[$gameId];
$allData['new_user_num'] += $newUserNumList[$gameId];
$allData['new_device_num'] += $newDeviceNumList[$gameId];
$allData['new_ip_num'] += $newIpNumList[$gameId];
$allData['login_user_num'] += $loginUserNumList[$gameId];
$allData['spend_user_num'] += $spendUserNumList[$gameId];
$allData['spend_num'] += $spendNumList[$gameId];
$allData['spend_all_amount'] = bcadd($allData['spend_all_amount'], $spendAllAmountList[$gameId], 2);
$allData['spend_cash'] = bcadd($allData['spend_cash'], $spendCashList[$gameId], 2);
$allData['spend_generic'] = bcadd($allData['spend_generic'], $spendGenericList[$gameId], 2);
$allData['spend_binding'] = bcadd($allData['spend_binding'], $spendBindingList[$gameId], 2);
$allData['spend_discount'] = bcadd($allData['spend_discount'], 0, 2);
$allData['spend_voucher'] = bcadd($allData['spend_voucher'], 0, 2);
}
$params['all_data'] = 1;
$params['game_ids'] = $allGameIs;
$allData['role_num'] = $userRepository->getCreateRoleCountByGame($params);//创角数
$allData['user_num'] = $userRepository->getCreateRoleUserCountByGame($params);//创角用户
$allData['new_user_num'] = $userRepository->getNewCreateRoleUserCountByGame($params);//新创角用户
$allData['new_device_num'] = $userRepository->getNewCreateRoleDeviceCountByGame($params);//新创角设备
$allData['new_ip_num'] = $userRepository->getNewCreateRoleIpCountByGame($params);//新创角IP
$allData['login_user_num'] = $userRepository->getLoginCountGroupByGame($params);//登录用户数
$allData['spend_user_num'] = $spendRepository->getPayUserCountByGame($params);//充值人数
$allData['spend_num'] = $spendRepository->getPayCountByGame($params);//充值次数
unset($params['pay_way']);
$allData['spend_all_amount'] = $spendRepository->getPayAmountByGameAndType($params);//充值总额
$params['pay_way'] = ['in', '1,2,3,4,5,6'];
$allData['spend_cash'] = $spendRepository->getPayAmountByGameAndType($params);//现金充值
$params['pay_way'] = 0;
$allData['spend_generic'] = $spendRepository->getPayAmountByGameAndType($params);//通用币充值
$params['pay_way'] = -1;
$allData['spend_binding'] = $spendRepository->getPayAmountByGameAndType($params);//绑定币充值
}
}

@ -81,7 +81,7 @@
<div class="form-group normal_space">
<select id="relation_game_id" name="relation_game_id" class="reselect select_gallery">
<option value="">请选择游戏</option>
<option value="0">请选择游戏</option>
<volist name=":get_promote_serach_game()" id="vo">
<option value="{$vo.relation_game_id}" title="{$vo.relation_game_name}">{$vo.relation_game_name}</option>
</volist>
@ -99,7 +99,7 @@
<div class="form-group normal_space">
<select id="server_id" name="server_id" class=" reselect select_gallery">
<option value="">请选择区服</option>
<option value="0">请选择区服</option>
<volist name="serverData" id="vo">
<option value="{$vo.server_id}">{$vo.server_name}</option>
</volist>

Loading…
Cancel
Save