hejianhao
2026-03-26 2e1780f1fea1d552386e135830605fb06080ddfd
refactor(robotaxi): 移除不必要的OTP检查直接轮询热修状态

简化useEffect逻辑,直接开始轮询热修状态,无需等待OTP验证结果。这消除了不必要的条件嵌套并使代码更清晰。
1个文件已修改
40 ■■■■■ 已修改文件
src/pages/robotaxi/home/index.tsx 40 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/pages/robotaxi/home/index.tsx
@@ -323,28 +323,24 @@
  });
  useEffect(() => {
    checkOtp(false).then(otp => {
      if (otp) {
        let timer: any = null;
        const check = () => {
          getHotFixInfo().then((res: any) => {
            const status = Number(res?.hotfixStatus);
            if (status === 1) {
              setIsMaintain(true);
              setHotfixEndText(res?.hotfixEndTime);
            } else {
              setIsMaintain(false);
              setHotfixEndText('');
            }
          }).catch(() => { });
        };
        check();
        timer = setInterval(check, 3000);
        return () => {
          if (timer) clearInterval(timer);
        };
      }
    })
    let timer: any = null;
    const check = () => {
      getHotFixInfo().then((res: any) => {
        const status = Number(res?.hotfixStatus);
        if (status === 1) {
          setIsMaintain(true);
          setHotfixEndText(res?.hotfixEndTime);
        } else {
          setIsMaintain(false);
          setHotfixEndText('');
        }
      }).catch(() => { });
    };
    check();
    timer = setInterval(check, 3000);
    return () => {
      if (timer) clearInterval(timer);
    };
  }, []);
  // 监听隐私政策显示状态