From a583fcbc434ec6399a053e217ab05a630ded6eea Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Wed, 6 Nov 2024 17:19:33 +0800 Subject: [PATCH] 1 --- webapp/controller/ToolsController.class.php | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/webapp/controller/ToolsController.class.php b/webapp/controller/ToolsController.class.php index 6e978f35..220429ac 100644 --- a/webapp/controller/ToolsController.class.php +++ b/webapp/controller/ToolsController.class.php @@ -524,9 +524,19 @@ class ToolsController extends BaseController { public function genAndroid() { - mt\Robot::traverse(function ($meta) { - echo 'INSERT INTO t_android(robot_id, name, createtime, modifytime)VALUES(' + $data = array(); + mt\Robot::traverse(function ($meta) use(&$data) { + $row = SqlHelper::ormSelectOne + ($this->_getMysql(''), + 't_android', + array( + 'name' => $meta['name'] + ) + ); + if (!$row) { + echo 'INSERT INTO t_android(robot_id, name, createtime, modifytime)VALUES(' . $meta['id'] . ",'" . $meta['name'] . "'," . myself()->_getNowTime() . ',' . myself()->_getNowTime() . ");\n"; + } return true; }); }