Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
C
cloud-backend
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
framework
cloud-backend
Commits
f7cd1142
Commit
f7cd1142
authored
May 28, 2021
by
袁伟铭
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1.0.0
parent
e3b3c416
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
10 deletions
+16
-10
api-server/src/main/java/com/zq/api/controller/ApiController.java
+1
-5
api-server/src/main/java/com/zq/api/form/ApiForm.java
+15
-5
No files found.
api-server/src/main/java/com/zq/api/controller/ApiController.java
View file @
f7cd1142
...
...
@@ -4,7 +4,6 @@ import cn.hutool.core.exceptions.ExceptionUtil;
import
cn.hutool.core.util.StrUtil
;
import
cn.hutool.extra.servlet.ServletUtil
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSONObject
;
import
com.zq.api.constant.ApiCodeEnum
;
import
com.zq.api.form.ApiForm
;
import
com.zq.api.form.ApiResp
;
...
...
@@ -44,10 +43,7 @@ public class ApiController {
long
start
=
System
.
currentTimeMillis
();
ApiForm
form
=
ServletUtil
.
toBean
(
request
,
ApiForm
.
class
,
true
);
try
{
JSONObject
jsonObject
=
JSON
.
parseObject
(
form
.
getBizContent
());
form
.
setBizContentJson
(
jsonObject
);
}
catch
(
Exception
e
)
{
if
(!
form
.
parseBizContent
())
{
return
ApiUtils
.
getParamError
(
form
);
}
...
...
api-server/src/main/java/com/zq/api/form/ApiForm.java
View file @
f7cd1142
...
...
@@ -41,16 +41,26 @@ public class ApiForm {
private
JSONObject
bizContentJson
;
// 请求业务的json对象
private
ApiTokenVo
apiTokenVo
;
public
boolean
parseBizContent
()
{
try
{
bizContentJson
=
JSON
.
parseObject
(
bizContent
);
if
(
bizContentJson
==
null
)
{
bizContentJson
=
new
JSONObject
();
}
return
true
;
}
catch
(
Exception
e
)
{
log
.
error
(
"bizContent解析失败:{}"
,
e
.
getMessage
());
return
false
;
}
}
public
JSONObject
getContentJson
()
{
if
(
bizContentJson
!=
null
)
{
return
bizContentJson
;
}
JSONObject
object
=
JSON
.
parseObject
(
bizContent
);
if
(
object
==
null
)
{
return
new
JSONObject
();
}
return
object
;
parseBizContent
();
return
bizContentJson
;
}
/**
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment