浏览代码

fix: 接口联调

jcq 2 周之前
父节点
当前提交
54b6f17046
共有 1 个文件被更改,包括 15 次插入0 次删除
  1. 15 0
      src/utils/ipUpdate.ts

+ 15 - 0
src/utils/ipUpdate.ts

@@ -0,0 +1,15 @@
+// src/utils/ipUpdate.ts
+
+const ipSplicing = (startIp: string, endIp: string | null | undefined): string => {
+  if (!endIp || endIp.trim() === '') {
+    return startIp;
+  }
+
+  const startParts = startIp.split('.');
+  const endParts = endIp.split('.');
+  const lastPartOfEndIp = endParts[endParts.length - 1];
+
+  return `${startIp}/${lastPartOfEndIp}`;
+};
+
+export { ipSplicing };