From 9fdaaf1dbb45421569abd3a9d0fd3c669fb4a719 Mon Sep 17 00:00:00 2001 From: xudan Date: Thu, 3 Jul 2025 16:02:00 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E6=94=B9=E6=9C=BA=E5=99=A8?= =?UTF-8?q?=E4=BA=BA=E6=B3=A8=E5=86=8C=E6=8E=A5=E5=8F=A3=E8=BF=94=E5=9B=9E?= =?UTF-8?q?=E5=80=BC=E5=A4=84=E7=90=86=EF=BC=8C=E7=A1=AE=E4=BF=9D=E6=B3=A8?= =?UTF-8?q?=E5=86=8C=E5=A4=B1=E8=B4=A5=E6=97=B6=E6=8A=9B=E5=87=BA=E9=94=99?= =?UTF-8?q?=E8=AF=AF=E5=B9=B6=E6=9B=B4=E6=96=B0=E7=9B=B8=E5=85=B3=E9=80=BB?= =?UTF-8?q?=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/apis/robot/api.ts | 3 ++- src/components/modal/robot-register-modal.vue | 2 +- 自动部署脚本.bat | 6 +++--- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/apis/robot/api.ts b/src/apis/robot/api.ts index 58a4e2e..7e8ad80 100644 --- a/src/apis/robot/api.ts +++ b/src/apis/robot/api.ts @@ -25,13 +25,14 @@ export async function getAllRobots(): Promise> { export async function registerRobot(robot: Omit): Promise { type B = Omit; type D = RobotInfo; + try { const body = robot; const data = await http.post(API.注册机器人, body); return data ?? null; } catch (error) { console.debug(error); - return null; + return false as never; } } diff --git a/src/components/modal/robot-register-modal.vue b/src/components/modal/robot-register-modal.vue index 86bd036..3d98a99 100644 --- a/src/components/modal/robot-register-modal.vue +++ b/src/components/modal/robot-register-modal.vue @@ -38,7 +38,7 @@ const submit = async () => { try { await form.value?.validate(); const robot = await registerRobot(data); - // if (isNil(robot)) throw Error('机器人注册失败'); + if (robot === (false as never)) throw Error('机器人注册失败'); editor.value.addRobots(data.gid, [data as RobotDetail]); show.value = false; } catch (error) { diff --git a/自动部署脚本.bat b/自动部署脚本.bat index 3c2cf01..2cad569 100644 --- a/自动部署脚本.bat +++ b/自动部署脚本.bat @@ -284,15 +284,15 @@ echo [成功] 文件上传到 !current_name! 完成 echo [信息] 正在远程服务器上解压部署... if defined use_expect ( :: 为SSH创建expect脚本 - echo set timeout 30 > temp_ssh_expect.exp - echo spawn ssh -o StrictHostKeyChecking=no !current_user!@!current_host! "mkdir -p !current_path! && rm -r !current_path!/* 2>/dev/null \|\| true && cd !current_path! && unzip -o /tmp/dist_temp.zip && rm /tmp/dist_temp.zip && echo 'Web-AMR项目部署完成,文件列表:' && ls -la !current_path! \|\| echo '文件列表显示失败,但部署成功'" >> temp_ssh_expect.exp + echo set timeout 60 > temp_ssh_expect.exp + echo spawn ssh -o StrictHostKeyChecking=no !current_user!@!current_host! "mkdir -p !current_path! && echo '[步骤1] 正在清空目标目录...' && cd !current_path! && find . -mindepth 1 -delete 2>/dev/null \|\| rm -rf ./* ./.[^.]* 2>/dev/null \|\| true && echo '[步骤2] 目录清理完成,开始解压文件...' && unzip -q -o /tmp/dist_temp.zip && echo '[步骤3] 文件解压完成,清理临时文件...' && rm /tmp/dist_temp.zip && echo '[步骤4] 验证部署结果...' && \[ -f index.html \] && echo '[成功] Web-AMR项目部署完成!' && echo '部署文件列表:' && ls -la !current_path! \|\| echo '[警告] 部署可能存在问题,请检查'" >> temp_ssh_expect.exp echo expect "password:" >> temp_ssh_expect.exp echo send "!current_pass!\r" >> temp_ssh_expect.exp echo expect eof >> temp_ssh_expect.exp expect temp_ssh_expect.exp if exist temp_ssh_expect.exp del temp_ssh_expect.exp ) else ( - !ssh_cmd! !current_user!@!current_host! "mkdir -p !current_path! && rm -r !current_path!/* 2>/dev/null || true && cd !current_path! && unzip -o /tmp/dist_temp.zip && rm /tmp/dist_temp.zip && echo 'Web-AMR项目部署完成,文件列表:' && ls -la !current_path! || echo '文件列表显示失败,但部署成功'" + !ssh_cmd! !current_user!@!current_host! "mkdir -p !current_path! && echo '[步骤1] 正在清空目标目录...' && cd !current_path! && find . -mindepth 1 -delete 2>/dev/null || rm -rf ./* ./.[^.]* 2>/dev/null || true && echo '[步骤2] 目录清理完成,开始解压文件...' && unzip -q -o /tmp/dist_temp.zip && echo '[步骤3] 文件解压完成,清理临时文件...' && rm /tmp/dist_temp.zip && echo '[步骤4] 验证部署结果...' && [ -f index.html ] && echo '[成功] Web-AMR项目部署完成!' && echo '部署文件列表:' && ls -la !current_path! || echo '[警告] 部署可能存在问题,请检查'" ) if !errorlevel! neq 0 (