Commit d46f29a4 authored by 33's avatar 33

Api版权接口

parent 9616bd89
...@@ -13,10 +13,11 @@ import java.util.TreeMap; ...@@ -13,10 +13,11 @@ import java.util.TreeMap;
*/ */
public class OpenSignUtils { public class OpenSignUtils {
public static void verify(String appKey, String appKeySecret, String bizJson, String signature) { public static void verify(String appKey, String appKeySecret, String bizId, String bizJson, String signature) {
Map<String, String> param = new TreeMap<>(); Map<String, String> param = new TreeMap<>();
param.put("appKey", appKey); param.put("appKey", appKey);
param.put("appKeySecret", appKeySecret); param.put("appKeySecret", appKeySecret);
param.put("bizId", bizId);
param.put("bizJson", bizJson); param.put("bizJson", bizJson);
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();
......
...@@ -53,10 +53,14 @@ public class CopyrightApiController { ...@@ -53,10 +53,14 @@ public class CopyrightApiController {
throw GlobalException.newException(ResultCode.signature_wrong); throw GlobalException.newException(ResultCode.signature_wrong);
} }
String bizId = baseOO.getBizId();
if (StringUtils.isBlank(bizId)) {
throw GlobalException.newException(ResultCode.VALIDATE_FAILED);
}
CopyrightOO copyrightOO = baseOO.getData(); CopyrightOO copyrightOO = baseOO.getData();
OpenSignUtils.verify(appKey, openKeyDO.getAppKeySecret(), JSONUtil.toJsonStr(copyrightOO), signature); OpenSignUtils.verify(appKey, openKeyDO.getAppKeySecret(), bizId, JSONUtil.toJsonStr(copyrightOO), signature);
String bizId = baseOO.getBizId();
CopyrightApiDO apiDO = copyrightApiService.getByAppKeyAndBizId(appKey, bizId); CopyrightApiDO apiDO = copyrightApiService.getByAppKeyAndBizId(appKey, bizId);
if (apiDO != null) { if (apiDO != null) {
return ResponseModel.success(apiDO.getId()); return ResponseModel.success(apiDO.getId());
......
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