|
|
@ -875,12 +875,14 @@ class SpendModel extends Model
|
|
|
|
$gameQuery->page($page,$row);
|
|
|
|
$gameQuery->page($page,$row);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
$games = $gameQuery->select();
|
|
|
|
$games = $gameQuery->select();
|
|
|
|
|
|
|
|
|
|
|
|
$partners = [];
|
|
|
|
|
|
|
|
if (count($games)) {
|
|
|
|
if (count($games)) {
|
|
|
|
$map['s.game_id'] = ['in', array_column($games, 'game_id')];
|
|
|
|
$map['s.game_id'] = ['in', array_column($games, 'game_id')];
|
|
|
|
|
|
|
|
}else{
|
|
|
|
|
|
|
|
$map['s.game_id'] = '-1';
|
|
|
|
}
|
|
|
|
}
|
|
|
|
$data = M("Spend s use index(game_time)","tab_")
|
|
|
|
$data = SM("Spend","tab_")
|
|
|
|
|
|
|
|
->alias('s')
|
|
|
|
|
|
|
|
->index('game_time')
|
|
|
|
->where(['s.pay_status' => 1])
|
|
|
|
->where(['s.pay_status' => 1])
|
|
|
|
->where($map)
|
|
|
|
->where($map)
|
|
|
|
->group('s.game_id')
|
|
|
|
->group('s.game_id')
|
|
|
@ -914,40 +916,20 @@ class SpendModel extends Model
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
*获取游戏统计列表数据
|
|
|
|
*获取游戏统计列表数据
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
public function totalGameStatistics($map, $join = true)
|
|
|
|
public function totalGameStatistics($map,$gameIds, $join = true)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
$noticeFailData = M("Spend s use index(game_time)","tab_")
|
|
|
|
$map['s.game_id'] = ['in', $gameIds];
|
|
|
|
->field("SUM(pay_amount) as notice_fail_count,game_id")
|
|
|
|
$data = SM("Spend","tab_")
|
|
|
|
->join('LEFT JOIN tab_game as g ON s.game_id=g.id')
|
|
|
|
->alias('s')
|
|
|
|
->join('LEFT JOIN tab_partner as p ON g.partner_id=p.id')
|
|
|
|
->index('game_time')
|
|
|
|
->where(['s.pay_status' => 1, 'pay_game_status' => 0])
|
|
|
|
->field("
|
|
|
|
->where($map)
|
|
|
|
SUM(CASE WHEN pay_way > 0 and s.pay_status = 1 and pay_game_status = 1 THEN pay_amount ELSE 0 END) as cash_count,
|
|
|
|
->find();
|
|
|
|
SUM(CASE WHEN pay_way = 0 and s.pay_status = 1 and pay_game_status = 1 THEN pay_amount ELSE 0 END) as balance_coin_count,
|
|
|
|
// var_dump($noticeFailData);die();
|
|
|
|
SUM(CASE WHEN pay_way = -1 and s.pay_status = 1 and pay_game_status = 1 THEN pay_amount ELSE 0 END) as inside_cash_count,
|
|
|
|
|
|
|
|
SUM(CASE WHEN s.pay_status = 1 and pay_game_status = 0 THEN pay_amount ELSE 0 END) as notice_fail_count")
|
|
|
|
|
|
|
|
->where(['s.pay_status' => 1])
|
|
|
|
$query = M("Spend s use index(game_time)","tab_")
|
|
|
|
|
|
|
|
->field("SUM(CASE WHEN pay_way > 0 and s.pay_status = 1 and pay_game_status = 1 THEN pay_amount ELSE 0 END) as cash_count,
|
|
|
|
|
|
|
|
SUM(CASE WHEN pay_way = 0 and s.pay_status = 1 and pay_game_status = 1 THEN pay_amount ELSE 0 END) as balance_coin_count,
|
|
|
|
|
|
|
|
SUM(CASE WHEN pay_way = -1 and s.pay_status = 1 and pay_game_status = 1 THEN pay_amount ELSE 0 END) as inside_cash_count");
|
|
|
|
|
|
|
|
if ($join) {
|
|
|
|
|
|
|
|
$query = $query->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');
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
$data = $query->where(['s.pay_status' => 1])
|
|
|
|
|
|
|
|
->where($map)
|
|
|
|
->where($map)
|
|
|
|
->find();
|
|
|
|
->find();
|
|
|
|
|
|
|
|
|
|
|
|
// $gc_game_id = array_unique(explode(',',$data['gc_game_id']));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// $noticeFailData = M("Spend s use index(game_time)","tab_")
|
|
|
|
|
|
|
|
// ->field("SUM(pay_amount) as notice_fail_count,game_id")
|
|
|
|
|
|
|
|
// ->where(['s.pay_status' => 1, 'pay_game_status' => 0])
|
|
|
|
|
|
|
|
// ->where($noticeMap)
|
|
|
|
|
|
|
|
// ->find();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$data['notice_fail_count'] = $noticeFailData['notice_fail_count'];
|
|
|
|
|
|
|
|
// dd($query->_sql());
|
|
|
|
|
|
|
|
return $data;
|
|
|
|
return $data;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|