游戏统计bug修正

master
zhengyongxing 5 years ago
parent 8d7dbe5469
commit 4b63c7b786

@ -885,16 +885,12 @@ SUM(CASE WHEN pay_way = -1 THEN pay_amount ELSE 0 END) as inside_cash_count,g.sd
public function totalGameStatistics($map, $join = true)
{
$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($map)
->find();
$query = M("Spend s use index(game_time)","tab_")
->field("SUM(CASE WHEN pay_way > 0 THEN pay_amount ELSE 0 END) as cash_count,
SUM(CASE WHEN pay_way = 0 THEN pay_amount ELSE 0 END) as balance_coin_count,
SUM(CASE WHEN pay_way = -1 THEN pay_amount ELSE 0 END) as inside_cash_count");
SUM(CASE WHEN pay_way = -1 THEN pay_amount ELSE 0 END) as inside_cash_count,group_concat(s.game_id separator ',') gc_game_id");
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');
@ -902,6 +898,15 @@ SUM(CASE WHEN pay_way = -1 THEN pay_amount ELSE 0 END) as inside_cash_count");
$data = $query->where(['s.pay_status' => 1, 'pay_game_status' => 1])
->where($map)
->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,'game_id'=>['in',$gc_game_id]])
->where($map)
->find();
$data['notice_fail_count'] = $noticeFailData['notice_fail_count'];
// dd($query->_sql());
return $data;

Loading…
Cancel
Save