diff --git a/Application/Admin/Controller/StatController.class.php b/Application/Admin/Controller/StatController.class.php index 325a530f8..163fe452a 100644 --- a/Application/Admin/Controller/StatController.class.php +++ b/Application/Admin/Controller/StatController.class.php @@ -1407,7 +1407,7 @@ class StatController extends ThinkController $model = M('device_statistics','tab_'); if ($type == 0) { - $return = $model->where(['time'=>['neq',0]])->sum('new_device'); + $return = $model->where(array('time'=>array('neq',0)))->sum('new_device'); // $return = $device->all_device(); } else if($type == 1) { $return = $model->where(['time'=>array('between',[$todaystart,$todaystart+86399])])->sum('new_device'); diff --git a/Application/Home/Controller/DownloadController.class.php b/Application/Home/Controller/DownloadController.class.php index d9104acdd..eb1a918fc 100644 --- a/Application/Home/Controller/DownloadController.class.php +++ b/Application/Home/Controller/DownloadController.class.php @@ -2501,7 +2501,15 @@ class DownloadController extends BaseController { $data = $model->field('pay_order_number,game_name,user_account,promote_account,pay_amount,pay_way,if(selle_ratio >= 0,selle_ratio,0) as selle_ratio,pay_time,selle_status,pay_status,withdraw_id') ->where($map) ->order('id desc') - ->select(); + ->select(); + $total = []; + $total = $model->field('sum(pay_amount) as pay_amount,sum(if(pay_way > -1,pay_amount,0)) as direct_pay_amount,sum(if(pay_way = -1,pay_amount,0)) as inner_pay_amount,sum(if(selle_ratio >= 0,selle_ratio * pay_amount,0)) as income') + ->where($map) + ->find(); + $total['direct_pay_amount'] = empty($total['direct_pay_amount']) ? '0.00' : $total['direct_pay_amount']; + $total['inner_pay_amount'] = empty($total['inner_pay_amount']) ? '0.00' : $total['inner_pay_amount']; + $total['income'] = empty($total['income']) ? 0 : $total['income']; + $total['income'] = bcdiv($total['income'], 100, 2); //提现状态 $withdrawIds = []; foreach ($data as $key => $value) { @@ -2548,6 +2556,19 @@ class DownloadController extends BaseController { } } + $allData['pay_order_number'] = '合计'; + $allData['game_name'] = '--'; + $allData['user_account'] = '--'; + $allData['promote_account'] = '--'; + $allData['pay_amount'] = $total['pay_amount']; + $allData['pay_amount_zhi'] = $total['direct_pay_amount']; + $allData['pay_amount_nei'] = $total['inner_pay_amount']; + $allData['selle_ratio'] = '--'; + $allData['selle_ratio'] = '--'; + $allData['income'] = $total['income']; + $allData['pay_time'] = '--'; + $allData['selle_status'] = '--'; + $data[] = $allData; $xlsData = $data; $this->exportExcel($xlsName, $xlsCell, $xlsData,$id); @@ -2895,6 +2916,12 @@ class DownloadController extends BaseController { $roles = M()->alias('record') ->table($subQuery) ->select(); + $total = []; + $total = M('user_play_data_count', 'tab_')->alias('uc') + ->field($fieldUC) + ->join('tab_user_play_info as ui on ui.game_id = uc.game_id and ui.server_id = uc.server_id and ui.role_id = uc.role_id') + ->where($map) + ->find(); foreach ($roles as $role) { $records[] = [ 'user_account' => encryption($role['user_account']), @@ -2915,7 +2942,22 @@ class DownloadController extends BaseController { 'unlogin_day' => intval((strtotime(date('Y-m-d 00:00:00')) - strtotime(date('Y-m-d 00:00:00', $role['play_time']))) / (24 * 3600)) ]; } - + $allData['user_account'] = '合计'; + $allData['game_name'] = '--'; + $allData['role_name'] = '--'; + $allData['role_id'] = '--'; + $allData['role_level'] = '--'; + $allData['server_id'] = '--'; + $allData['server_name'] = '--'; + $allData['recharge_cost'] = $total['recharge_cost']; + $allData['recharge_count'] = $total['recharge_count']; + $allData['recharge_cost_today'] = $total['recharge_cost_today']; + $allData['play_time'] = '--'; + $allData['play_ip'] = '--'; + $allData['promote_id'] = '--'; + $allData['promote_account'] = '--'; + $allData['sdk_version'] = '--'; + $allData['unlogin_day'] = '--'; $xlsData = []; foreach ($records as $key1 => $value1) { $value1['user_account'] = $this->encryption($value1['user_account']); @@ -2927,6 +2969,7 @@ class DownloadController extends BaseController { } $xlsData[] = $value1; } + $xlsData[] = $allData; $this->exportExcel($xlsName, $xlsCell, $xlsData,$id); } @@ -3027,6 +3070,28 @@ class DownloadController extends BaseController { ob_flush(); flush(); } + $income = '0.00'; + $income = M('Spend', 'tab_') + ->field('sum(tab_spend.pay_amount) as income') + ->join('tab_game on tab_spend.game_id = tab_game.id') + ->join('left join tab_promote on tab_spend.promote_id = tab_promote.id') + ->where($map) + ->order('tab_spend.id desc') + ->find()['income']; + $csvData1["user_account"] = "合计"; + $csvData1["order_number"] = "--"; + $csvData1["pay_amount"] = $income; + $csvData1["pay_way"] = "--"; + $csvData1["game_name"] = "--"; + $csvData1["server_name"] = "--"; + $csvData1["game_player_name"] = "--"; + $csvData1["p_p_proinfo"] = "--"; + $csvData1["p_proinfo"] = "--"; + $csvData1["proinfo"] = "--"; + $csvData1["pay_time"] = "--"; + mb_convert_variables('GBK', 'UTF-8', $csvData1); + fputcsv($fp, $csvData1); + $xlsData[] = $csvData1; fclose($fp); $this->backSuccessExport($id); } diff --git a/Application/Home/Controller/FinanceController.class.php b/Application/Home/Controller/FinanceController.class.php index b9d6d174f..c0c245b2e 100644 --- a/Application/Home/Controller/FinanceController.class.php +++ b/Application/Home/Controller/FinanceController.class.php @@ -223,9 +223,12 @@ class FinanceController extends BaseController ->page($page, $row) ->select(); $count = $model->where($map)->count(); - $total = $model->field('sum(pay_amount) as pay_amount,pay_way,sum(if(selle_ratio >= 0,selle_ratio * pay_amount,0)) as income') + $total = $model->field('sum(pay_amount) as pay_amount,sum(if(pay_way > -1,pay_amount,0)) as direct_pay_amount,sum(if(pay_way = -1,pay_amount,0)) as inner_pay_amount,sum(if(selle_ratio >= 0,selle_ratio * pay_amount,0)) as income') ->where($map) ->find(); + $total['direct_pay_amount'] = empty($total['direct_pay_amount']) ? '0.00' : $total['direct_pay_amount']; + $total['inner_pay_amount'] = empty($total['inner_pay_amount']) ? '0.00' : $total['inner_pay_amount']; + $total['income'] = empty($total['income']) ? 0 : $total['income']; $total['income'] = bcdiv($total['income'], 100, 2); //提现状态 diff --git a/Application/Home/View/default/Finance/settlementDtl.html b/Application/Home/View/default/Finance/settlementDtl.html index a62bdff29..f8aecb696 100644 --- a/Application/Home/View/default/Finance/settlementDtl.html +++ b/Application/Home/View/default/Finance/settlementDtl.html @@ -164,11 +164,11 @@