From c46f9c28f8d40d2a4efcc7ef6e528661d97a4be0 Mon Sep 17 00:00:00 2001
From: LSH
Date: 星期二, 14 二月 2023 13:48:18 +0800
Subject: [PATCH] #

---
 src/main/java/com/zy/common/web/BaseController.java |   18 ++++++++++++++++--
 1 files changed, 16 insertions(+), 2 deletions(-)

diff --git a/src/main/java/com/zy/common/web/BaseController.java b/src/main/java/com/zy/common/web/BaseController.java
index c0455b4..8f1fade 100644
--- a/src/main/java/com/zy/common/web/BaseController.java
+++ b/src/main/java/com/zy/common/web/BaseController.java
@@ -145,12 +145,26 @@
 
     public static boolean isJSON(String str) {
         if (Cools.isEmpty(str)) {
-            return true;
+            return false;
         } else {
             str = str.trim();
             if (str.startsWith("{") && str.endsWith("}")) {
+                return true;
+            } else if (str.startsWith("[") && str.endsWith("]")) {
+                return true;
+            } else {
                 return false;
-            } else return !str.startsWith("[") || !str.endsWith("]");
+            }
         }
     }
+
+    public static boolean isNumber(String str){
+        for (int i = str.length();--i>=0;){
+            if (!Character.isDigit(str.charAt(i))){
+                return false;
+            }
+        }
+        return true;
+    }
+
 }

--
Gitblit v1.9.1