|
|
@ -831,6 +831,20 @@ class SpendModel extends Model
|
|
|
|
return $sum;
|
|
|
|
return $sum;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private function getGameMapByGameStatMap($map)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
$gameMap = [];
|
|
|
|
|
|
|
|
if (isset($map['s.game_id'])) {
|
|
|
|
|
|
|
|
$gameMap['id'] = $map['s.game_id'];
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (isset($map['g.partner_id'])) {
|
|
|
|
|
|
|
|
$gameMap['partner_id'] = $map['g.partner_id'];
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (isset($map['g.game_type_id'])) {
|
|
|
|
|
|
|
|
$gameMap['game_type_id'] = $map['g.game_type_id'];
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return $gameMap;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
*获取游戏统计列表数据
|
|
|
|
*获取游戏统计列表数据
|
|
|
@ -840,6 +854,18 @@ class SpendModel extends Model
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
public function gameStatistics($map, $row = 0, $page = 1)
|
|
|
|
public function gameStatistics($map, $row = 0, $page = 1)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
$gameMap = $this->getGameMapByGameStatMap($map);
|
|
|
|
|
|
|
|
$gameQuery = M('game', 'tab_')->field(['id', 'relation_game_name', 'unique_code', 'partner_id', 'game_type_name', 'sdk_version'])->where($gameMap);
|
|
|
|
|
|
|
|
if ($row) {
|
|
|
|
|
|
|
|
$gameQuery->page($page,$row);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
$games = $gameQuery->select();
|
|
|
|
|
|
|
|
$partners = [];
|
|
|
|
|
|
|
|
if (count($games)) {
|
|
|
|
|
|
|
|
$map['s.game_id'] = ['in', array_column($games, 'id')];
|
|
|
|
|
|
|
|
$partners = M('partner', 'tab_')->field(['id', 'partner'])->where(['id' => ['in', array_column($games, 'partner_id')]])->select();
|
|
|
|
|
|
|
|
$partners = index_by_column('id', $partners);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
$noticeFailData = M("Spend s use index(game_time)","tab_")
|
|
|
|
$noticeFailData = M("Spend s use index(game_time)","tab_")
|
|
|
|
->field("SUM(pay_amount) as notice_fail_count,game_id")
|
|
|
|
->field("SUM(pay_amount) as notice_fail_count,game_id")
|
|
|
@ -862,26 +888,38 @@ SUM(CASE WHEN pay_way = -1 and s.pay_status = 1 and pay_game_status = 1 THEN pay
|
|
|
|
// ->where("(s.pay_status = 1 and pay_game_status = 1) or (s.pay_status = 1 and pay_game_status = 0)")
|
|
|
|
// ->where("(s.pay_status = 1 and pay_game_status = 1) or (s.pay_status = 1 and pay_game_status = 0)")
|
|
|
|
->where($map)
|
|
|
|
->where($map)
|
|
|
|
->group('s.game_id');
|
|
|
|
->group('s.game_id');
|
|
|
|
if ($row) {
|
|
|
|
/* if ($row) {
|
|
|
|
$query = $query->page($page,$row);
|
|
|
|
$query = $query->page($page,$row);
|
|
|
|
}
|
|
|
|
} */
|
|
|
|
$data = $query->select();
|
|
|
|
$data = $query->select();
|
|
|
|
// var_dump($data);die();
|
|
|
|
$data = index_by_column('game_id', $data);
|
|
|
|
return $data;
|
|
|
|
$records = [];
|
|
|
|
|
|
|
|
foreach ($games as $game) {
|
|
|
|
|
|
|
|
if (isset($data[$game['id']])) {
|
|
|
|
|
|
|
|
$records[] = $data[$game['id']];
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
$partner = $partners[$game['partner_id']] ?? null;
|
|
|
|
|
|
|
|
$records[] = [
|
|
|
|
|
|
|
|
'game_id' => $game['id'],
|
|
|
|
|
|
|
|
'game_name' => $game['relation_game_name'],
|
|
|
|
|
|
|
|
'unique_code' => $game['unique_code'],
|
|
|
|
|
|
|
|
'partner_name' => $partner ? $partner['partner'] : '无',
|
|
|
|
|
|
|
|
'game_type_name' => $game['game_type_name'],
|
|
|
|
|
|
|
|
'cash_count' => 0,
|
|
|
|
|
|
|
|
'balance_coin_count' => 0,
|
|
|
|
|
|
|
|
'inside_cash_count' => 0,
|
|
|
|
|
|
|
|
'sdk_version' => $game['sdk_version'],
|
|
|
|
|
|
|
|
'notice_fail_count' => 0
|
|
|
|
|
|
|
|
];
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return $records;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
public function gameStatisticsCount($map)
|
|
|
|
public function gameStatisticsCount($map)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
$gameMap = $this->getGameMapByGameStatMap($map);
|
|
|
|
$query = M("Spend s use index(game_time)","tab_")
|
|
|
|
return M('game', 'tab_')->where($gameMap)->count();
|
|
|
|
->field("game_id")
|
|
|
|
|
|
|
|
->join('LEFT JOIN tab_game as g ON s.game_id=g.id')
|
|
|
|
|
|
|
|
->join('LEFT JOIN tab_partner as p ON g.partner_id=p.id')
|
|
|
|
|
|
|
|
->where(['s.pay_status' => 1])
|
|
|
|
|
|
|
|
->where($map)
|
|
|
|
|
|
|
|
->group('s.game_id');
|
|
|
|
|
|
|
|
$data = $query->select();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return count($data);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
@ -889,8 +927,6 @@ SUM(CASE WHEN pay_way = -1 and s.pay_status = 1 and pay_game_status = 1 THEN pay
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
public function totalGameStatistics($map, $join = true)
|
|
|
|
public function totalGameStatistics($map, $join = true)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$noticeFailData = M("Spend s use index(game_time)","tab_")
|
|
|
|
$noticeFailData = M("Spend s use index(game_time)","tab_")
|
|
|
|
->field("SUM(pay_amount) as notice_fail_count,game_id")
|
|
|
|
->field("SUM(pay_amount) as notice_fail_count,game_id")
|
|
|
|
->join('LEFT JOIN tab_game as g ON s.game_id=g.id')
|
|
|
|
->join('LEFT JOIN tab_game as g ON s.game_id=g.id')
|
|
|
|