From d3f11759e6b32d7e9e63e0f7b0cc4b6874aea020 Mon Sep 17 00:00:00 2001
From: whycq <10027870+whycq@user.noreply.gitee.com>
Date: 星期一, 28 八月 2023 11:14:42 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/bfasrs6' into bfasrs6
---
src/main/java/com/zy/common/web/BaseController.java | 21 ++++++++++++++++-----
1 files changed, 16 insertions(+), 5 deletions(-)
diff --git a/src/main/java/com/zy/common/web/BaseController.java b/src/main/java/com/zy/common/web/BaseController.java
index ca2925d..8f1fade 100644
--- a/src/main/java/com/zy/common/web/BaseController.java
+++ b/src/main/java/com/zy/common/web/BaseController.java
@@ -1,6 +1,5 @@
package com.zy.common.web;
-import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.annotations.TableField;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.plugins.Page;
@@ -144,16 +143,28 @@
}
}
- protected static boolean isJSON(String str) {
+ public static boolean isJSON(String str) {
if (Cools.isEmpty(str)) {
return false;
} else {
- try {
- JSON.parse(str);
+ str = str.trim();
+ if (str.startsWith("{") && str.endsWith("}")) {
return true;
- } catch (Exception e) {
+ } else if (str.startsWith("[") && str.endsWith("]")) {
+ return true;
+ } else {
return false;
}
}
}
+
+ 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