From 3989e356b6b8bcd31e2d2981ac78e41f8ebbdfa5 Mon Sep 17 00:00:00 2001
From: luxiaotao1123 <t1341870251@63.com>
Date: 星期三, 19 十月 2022 10:02:31 +0800
Subject: [PATCH] #
---
src/main/java/com/zy/common/web/BaseController.java | 13 +++++--------
1 files changed, 5 insertions(+), 8 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..c0455b4 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,14 @@
}
}
- protected static boolean isJSON(String str) {
+ public static boolean isJSON(String str) {
if (Cools.isEmpty(str)) {
- return false;
+ return true;
} else {
- try {
- JSON.parse(str);
- return true;
- } catch (Exception e) {
+ str = str.trim();
+ if (str.startsWith("{") && str.endsWith("}")) {
return false;
- }
+ } else return !str.startsWith("[") || !str.endsWith("]");
}
}
}
--
Gitblit v1.9.1