From 4a15d38c3a937788be8181247f84c43c3cb81f87 Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Fri, 24 Jun 2022 14:13:48 +0800 Subject: [PATCH] 1 --- .../controller/TempToolsController.class.php | 38 +++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/webapp/controller/TempToolsController.class.php b/webapp/controller/TempToolsController.class.php index 1886d94b..cb78a2ac 100644 --- a/webapp/controller/TempToolsController.class.php +++ b/webapp/controller/TempToolsController.class.php @@ -182,6 +182,8 @@ class TempToolsController extends BaseController { $this->exportData2(); } else if($type == 3) { $this->exportData3(); + } else if($type == 4) { + $this->exportData4(); } } @@ -265,4 +267,40 @@ class TempToolsController extends BaseController { } } + public function exportData4() + { + $conn = myself()->_getMysql(''); + $rows = $conn->execQuery( + 'SELECT account_id, name FROM t_user', + array( + + ) + ); + $data = array(); + foreach ($rows as $row) { + $channel = phpcommon\extractChannel($row['account_id']); + if ($channel == BC_CHANNEL) { + $row2 = $conn->execQueryOne( + 'SELECT count(*) AS battle_times FROM t_battle_record WHERE account_id=:account_id', + array( + ':account_id' => $row['account_id'] + ) + ); + $data[$row['account_id']] = array( + 'account_id' => $row['account_id'], + 'name' => $row['name'], + 'battle_times' => $row2 ? $row2['battle_times'] : 0 + ); + } + } + echo 'account_id' . ",name,game_times\n"; + foreach ($data as $item) { + echo + $item['account_id'] . ',' + . $item['name'] . ',' + . $item['battle_times'] + . "\n"; + } + } + }