1
This commit is contained in:
parent
273e7ce611
commit
1cf277742b
44
webapp/controller/TempToolsController.class.php
Normal file
44
webapp/controller/TempToolsController.class.php
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use phpcommon\SqlHelper;
|
||||||
|
|
||||||
|
class TempToolsController extends BaseController {
|
||||||
|
|
||||||
|
public function _handlePre()
|
||||||
|
{
|
||||||
|
parent::_handlePre();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getBattleData()
|
||||||
|
{
|
||||||
|
$targetId = getReqVal('target_id', '');
|
||||||
|
$conn = myself()->_getMysql($targetId);
|
||||||
|
$data = array();
|
||||||
|
$survivalTime = 0;
|
||||||
|
{
|
||||||
|
$rows = SqlHelper::ormSelect(
|
||||||
|
$conn,
|
||||||
|
't_battle_record',
|
||||||
|
array(
|
||||||
|
'account_id' => $targetId
|
||||||
|
)
|
||||||
|
);
|
||||||
|
foreach ($rows as $row) {
|
||||||
|
$reqObj = json_decode($row['request'], true);
|
||||||
|
$reqObj['start_time'] = $reqObj['game_time'] -
|
||||||
|
$reqObj['alive_time']/1000;
|
||||||
|
$survivalTime += $reqObj['alive_time']/1000;
|
||||||
|
array_push($data, $reqObj);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
usort($data, function ($a, $b) {
|
||||||
|
return $a['start_time'] < $b['start_time'];
|
||||||
|
});
|
||||||
|
myself()->_rspData(array(
|
||||||
|
'battle_times' => count($data),
|
||||||
|
'survival_time' => $survivalTime,
|
||||||
|
'data' => $data
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user