游戏统计

master
liuweiwen 5 years ago
parent 5d6716b239
commit c0fac39c18

@ -6456,8 +6456,6 @@ if ($key == 'model'){
*充值-》财务管理-》游戏统计-》导出
*/
public function exportGameStatistics() {
dd($_REQUEST);
$month = I("count_date");
$xlsName = $month . '游戏统计导出';
@ -6496,10 +6494,12 @@ if ($key == 'model'){
$data[$key]['all_cash_count'] = $value['cash_count'] + $value['balance_coin_count'] + $value['inside_cash_count'];
}
$sumCash = D("spend_count")->sumSpendCountField($map,"cash_count");
$sumBalance = D("spend_count")->sumSpendCountField($map,"balance_coin_count");
$sumInside = number_format(array_sum($insideDataSum),2,'.','');
$sumAll = D("spend_count")->sumSpendCountField($map,"cash_count+balance_coin_count") + array_sum($insideDataSum);
$totalData = D("spend")->totalGameStatistics($map);
$sumCash = $totalData['cash_count'];
$sumBalance = $totalData['balance_coin_count'];
$sumInside = $totalData['inside_cash_count'];
$sumAll = $sumCash + $sumBalance + $sumInside;
$sumData = [['game_name'=>'总计',
'cash_count'=>$sumCash,

@ -719,13 +719,23 @@ class FinanceController extends ThinkController
$map['_string'] .= " and s.pay_time < {$timeend}";
}
//游戏统计列表
$data = D("spend")->gameStatistics($map);
foreach ($data as $key => $value) {
$data[$key]['all_cash_count'] = $value['cash_count'] + $value['balance_coin_count'] + $value['inside_cash_count'];
}
$totalData = D("spend")->totalGameStatistics($map);
$sumCash = $totalData['cash_count'];
$sumBalance = $totalData['balance_coin_count'];
$sumInside = $totalData['inside_cash_count'];
$sumAll = $sumCash + $sumBalance + $sumInside;
$this->assign('sumCash', $sumCash);
$this->assign('sumBalance', $sumBalance);
$this->assign('sumInside', $sumInside);
$this->assign('sumAll', $sumAll);
$this->assign('data',$data);
$this->display();

@ -847,5 +847,22 @@ SUM(CASE WHEN pay_way = -1 THEN pay_amount ELSE 0 END) as inside_cash_count")
return $data;
}
/**
*获取游戏统计列表数据
*/
public function totalGameStatistics($map)
{
$data = $this->alias("s")
->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")
->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)
->find();
return $data;
}
}

Loading…
Cancel
Save