Parcourir la source

fix: 接口联调

jcq il y a 2 semaines
Parent
commit
54b6f17046
1 fichiers modifiés avec 15 ajouts et 0 suppressions
  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 };