From ee139ae6f1e88b787508ba3e7910410a7d610e22 Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Wed, 6 Nov 2024 16:46:23 +0800 Subject: [PATCH] 1 --- webapp/controller/ToolsController.class.php | 9 +++++++++ webapp/mt/Robot.php | 9 +++++++++ 2 files changed, 18 insertions(+) diff --git a/webapp/controller/ToolsController.class.php b/webapp/controller/ToolsController.class.php index 46b9afe1..97fca3da 100644 --- a/webapp/controller/ToolsController.class.php +++ b/webapp/controller/ToolsController.class.php @@ -5,6 +5,7 @@ require_once('phpcommon/sqlhelper.php'); require_once('services/BlockChainService.php'); require_once('services/BattleBoxService.php'); require_once('models/BuyRecord.php'); +require_once('mt/Robot.php'); use models\Battle; use phpcommon\SqlHelper; @@ -521,4 +522,12 @@ class ToolsController extends BaseController { BattleBoxService::set($phase, $day); } + public function genAndroid() + { + mt\Robot::traverse(function ($meta) { + echo json_encode($meta); + return true; + }); + } + } diff --git a/webapp/mt/Robot.php b/webapp/mt/Robot.php index 578ca69b..d16bcbce 100644 --- a/webapp/mt/Robot.php +++ b/webapp/mt/Robot.php @@ -33,6 +33,15 @@ class Robot { return $members; } + public static function traverse($cb) + { + foreach (self::getMetaList() as $meta) { + if (!$cb($meta)) { + return; + } + } + } + protected static function getMetaList() { if (!self::$metaList) {