Commit 39ca0245 by 袁伟铭

修改API form参数验证方式

parent 765e78e0
......@@ -51,6 +51,7 @@ public class ApiController {
return ApiUtils.getSuccessResp(form);
}
form.setType(2);
String method = form.getMethod();
if (StrUtil.isBlank(method)) {
method = request.getParameter("method");
......
......@@ -42,6 +42,7 @@ public class AppController {
return ApiUtils.getSuccessResp(form);
}
form.setType(1);
//解析业务参数
if (!form.parseBizContent()) {
return ApiUtils.getParamError(form);
......
......@@ -36,15 +36,28 @@ public class ApiForm {
private String nonce; // 随机字串(建议使用UUID)
private String version; // 接口版本
private String apiNo; // 接口码
private Integer type; // 1-app;2-api,内部定
private String clientType; // 客户端类型 xcx-小程序,H5
private String bizContent; // 请求业务参数
private JSONObject bizContentJson; // 请求业务的json对象
private ApiTokenVo apiTokenVo;
public boolean parseBizContent() {
try {
boolean flag = ConfigCache.getValueToBoolean("API.PARAM.ENCRYPT"); // API参数是否加密
if (StrUtil.isNotBlank(bizContent) && flag && StrUtil.isNotBlank(sign)) {
bizContent = ApiUtils.decode(bizContent, "BASE64");
if (type == 1) {
// API参数是否加密
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);
if (bizContentJson == null) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment