diff --git a/webapp/controller/ToolsController.class.php b/webapp/controller/ToolsController.class.php index b6c98fcb..d92b79af 100644 --- a/webapp/controller/ToolsController.class.php +++ b/webapp/controller/ToolsController.class.php @@ -577,4 +577,9 @@ class ToolsController extends BaseController { var_dump(NameService::nameUsed($name)); } + public function genAndroidData() + { + myself()->_callServiceStatic('CircuitRankingService', 'genAndroidData'); + } + } diff --git a/webapp/services/CircuitRankingService.php b/webapp/services/CircuitRankingService.php index f152d237..3c25563e 100644 --- a/webapp/services/CircuitRankingService.php +++ b/webapp/services/CircuitRankingService.php @@ -2,6 +2,11 @@ namespace services; +require_once('mt/CircuitTime.php'); + +use mt; +use phpcommon\SqlHelper; + class CircuitRankingService extends BaseService { public static function fillPhaseRanking($currentCircuitMeta, $currentStageMeta) @@ -69,4 +74,38 @@ class CircuitRankingService extends BaseService { } } + public static function genAndroidData() + { + $currentStageMeta = mt\CircuitTime::getCurrentStage(); + if (empty($currentStageMeta)) { + myself()->_rspErr(1, 'currentStageMeta Is empty'); + return; + } + $rows = SqlHelper::ormSelect + (myself()->_getMysql(''), + 't_android', + array( + 'used' => 0 + ) + ); + foreach ($rows as $row) { + SqlHelper::upsert + (myself()->_getMysql(''), + 't_circuit_battle_phase', + array( + 'account_id' => $row['robot_id'], + ), + array(), + array( + 'account_id' => $row['robot_id'], + 'is_android' => 1, + 'cumulative_score' => 10, + 'createtime' => myself()->_getNowTime(), + 'modifytime' => myself()->_getNowTime(), + ) + ); + } + myself()->_rspOk(); + } + }