🐛 can not cast to JSONObject 问题修复
This commit is contained in:
parent
cc23959133
commit
b281703bac
@ -75,11 +75,21 @@ public class AuthorshipAspect {
|
||||
isArticle = false;
|
||||
}
|
||||
HttpServletRequest request = ((ServletRequestAttributes) Objects.requireNonNull(RequestContextHolder.getRequestAttributes())).getRequest();
|
||||
String idArticle = "";
|
||||
String idArticle;
|
||||
Integer idAuthor = 0;
|
||||
if (isAjax(request)) {
|
||||
Object[] objects = joinPoint.getArgs();
|
||||
JSONObject jsonObject = JSONObject.parseObject(JSON.toJSONString(objects[0]));
|
||||
JSONObject jsonObject;
|
||||
if (objects[0] instanceof Integer) {
|
||||
jsonObject = new JSONObject();
|
||||
if (isArticle) {
|
||||
jsonObject.put("idArticle", objects[0].toString());
|
||||
} else {
|
||||
jsonObject.put("idPortfolio", objects[0].toString());
|
||||
}
|
||||
} else {
|
||||
jsonObject = JSONObject.parseObject(JSON.toJSONString(objects[0]));
|
||||
}
|
||||
if (Objects.nonNull(jsonObject)) {
|
||||
if (isArticle) {
|
||||
idArticle = jsonObject.getString("idArticle");
|
||||
|
@ -54,10 +54,15 @@ public class SecurityAspect {
|
||||
String idUser = "";
|
||||
if (isAjax(request)) {
|
||||
Object[] objects = joinPoint.getArgs();
|
||||
JSONObject jsonObject = JSONObject.parseObject(JSON.toJSONString(objects[0]));
|
||||
JSONObject jsonObject;
|
||||
if (objects[0] instanceof Integer) {
|
||||
idUser = objects[0].toString();
|
||||
} else {
|
||||
jsonObject = JSONObject.parseObject(JSON.toJSONString(objects[0]));
|
||||
if (Objects.nonNull(jsonObject)) {
|
||||
idUser = jsonObject.getString("idUser");
|
||||
}
|
||||
}
|
||||
} else {
|
||||
Map params = getParams(request);
|
||||
if (params.isEmpty()) {
|
||||
|
Loading…
Reference in New Issue
Block a user