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 (