fix: 修改机器人注册接口返回值处理,确保注册失败时抛出错误并更新相关逻辑
This commit is contained in:
parent
cd422d54f1
commit
9fdaaf1dbb
@ -25,13 +25,14 @@ export async function getAllRobots(): Promise<Array<RobotInfo>> {
|
||||
export async function registerRobot(robot: Omit<RobotDetail, 'id'>): Promise<RobotInfo | null> {
|
||||
type B = Omit<RobotDetail, 'id'>;
|
||||
type D = RobotInfo;
|
||||
|
||||
try {
|
||||
const body = robot;
|
||||
const data = await http.post<D, B>(API.注册机器人, body);
|
||||
return data ?? null;
|
||||
} catch (error) {
|
||||
console.debug(error);
|
||||
return null;
|
||||
return false as never;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -38,7 +38,7 @@ const submit = async () => {
|
||||
try {
|
||||
await form.value?.validate();
|
||||
const robot = await registerRobot(<RobotDetail>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) {
|
||||
|
@ -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 (
|
||||
|
Loading…
x
Reference in New Issue
Block a user