This commit is contained in:
aozhiwei 2022-06-24 14:13:48 +08:00
parent 7de3f3c545
commit 4a15d38c3a

View File

@ -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";
}
}
}