Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
C
civil-bigdata
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
civil
civil-bigdata
Commits
39ca0245
Commit
39ca0245
authored
Jan 24, 2022
by
袁伟铭
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改API form参数验证方式
parent
765e78e0
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
18 additions
and
3 deletions
+18
-3
api-server/src/main/java/com/zq/api/controller/ApiController.java
+1
-0
api-server/src/main/java/com/zq/api/controller/AppController.java
+1
-0
api-server/src/main/java/com/zq/api/form/ApiForm.java
+16
-3
No files found.
api-server/src/main/java/com/zq/api/controller/ApiController.java
View file @
39ca0245
...
@@ -51,6 +51,7 @@ public class ApiController {
...
@@ -51,6 +51,7 @@ public class ApiController {
return
ApiUtils
.
getSuccessResp
(
form
);
return
ApiUtils
.
getSuccessResp
(
form
);
}
}
form
.
setType
(
2
);
String
method
=
form
.
getMethod
();
String
method
=
form
.
getMethod
();
if
(
StrUtil
.
isBlank
(
method
))
{
if
(
StrUtil
.
isBlank
(
method
))
{
method
=
request
.
getParameter
(
"method"
);
method
=
request
.
getParameter
(
"method"
);
...
...
api-server/src/main/java/com/zq/api/controller/AppController.java
View file @
39ca0245
...
@@ -42,6 +42,7 @@ public class AppController {
...
@@ -42,6 +42,7 @@ public class AppController {
return
ApiUtils
.
getSuccessResp
(
form
);
return
ApiUtils
.
getSuccessResp
(
form
);
}
}
form
.
setType
(
1
);
//解析业务参数
//解析业务参数
if
(!
form
.
parseBizContent
())
{
if
(!
form
.
parseBizContent
())
{
return
ApiUtils
.
getParamError
(
form
);
return
ApiUtils
.
getParamError
(
form
);
...
...
api-server/src/main/java/com/zq/api/form/ApiForm.java
View file @
39ca0245
...
@@ -36,15 +36,28 @@ public class ApiForm {
...
@@ -36,15 +36,28 @@ public class ApiForm {
private
String
nonce
;
// 随机字串(建议使用UUID)
private
String
nonce
;
// 随机字串(建议使用UUID)
private
String
version
;
// 接口版本
private
String
version
;
// 接口版本
private
String
apiNo
;
// 接口码
private
String
apiNo
;
// 接口码
private
Integer
type
;
// 1-app;2-api,内部定
private
String
clientType
;
// 客户端类型 xcx-小程序,H5
private
String
bizContent
;
// 请求业务参数
private
String
bizContent
;
// 请求业务参数
private
JSONObject
bizContentJson
;
// 请求业务的json对象
private
JSONObject
bizContentJson
;
// 请求业务的json对象
private
ApiTokenVo
apiTokenVo
;
private
ApiTokenVo
apiTokenVo
;
public
boolean
parseBizContent
()
{
public
boolean
parseBizContent
()
{
try
{
try
{
boolean
flag
=
ConfigCache
.
getValueToBoolean
(
"API.PARAM.ENCRYPT"
);
// API参数是否加密
if
(
type
==
1
)
{
if
(
StrUtil
.
isNotBlank
(
bizContent
)
&&
flag
&&
StrUtil
.
isNotBlank
(
sign
))
{
// API参数是否加密
bizContent
=
ApiUtils
.
decode
(
bizContent
,
"BASE64"
);
boolean
flag
=
ConfigCache
.
getValueToBoolean
(
"API.PARAM.ENCRYPT"
);
if
(
StrUtil
.
isNotBlank
(
bizContent
)
&&
flag
)
{
bizContent
=
ApiUtils
.
decode
(
bizContent
,
""
);
}
}
else
{
if
(
StrUtil
.
isNotBlank
(
bizContent
))
{
bizContent
=
ApiUtils
.
decode
(
bizContent
,
"BASE64"
);
}
}
if
(
bizContent
==
null
)
{
bizContent
=
""
;
}
}
bizContentJson
=
JSON
.
parseObject
(
bizContent
);
bizContentJson
=
JSON
.
parseObject
(
bizContent
);
if
(
bizContentJson
==
null
)
{
if
(
bizContentJson
==
null
)
{
...
...
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