eureka
tanghc 4 years ago
parent a577df49c1
commit a9a3dcdd0a
  1. 1
      changelog.md
  2. 7
      sop-common/sop-service-common/src/main/java/com/gitee/sop/servercommon/param/ApiArgumentResolver.java
  3. 4
      sop-example/sop-story/src/main/java/com/gitee/sop/storyweb/controller/Example1001_BaseController.java
  4. 6
      sop-sdk/sdk-python/common/OpenClient.py
  5. 2
      sop-sdk/sdk-python/test/test.py

@ -3,6 +3,7 @@
## 4.2.7 ## 4.2.7
- 修复两个微服务相同path问题 - 修复两个微服务相同path问题
- 修复Python-SDK下参数传递问题
## 4.2.6 ## 4.2.6

@ -143,7 +143,6 @@ public class ApiArgumentResolver implements SopHandlerMethodArgumentResolver {
Object paramObj = this.getParamObject(methodParameter, nativeWebRequest); Object paramObj = this.getParamObject(methodParameter, nativeWebRequest);
if (paramObj != null) { if (paramObj != null) {
// JSR-303验证 // JSR-303验证
if (paramObj instanceof SingleParameterWrapper) { if (paramObj instanceof SingleParameterWrapper) {
SingleParameterWrapper parameterWrapper = (SingleParameterWrapper) paramObj; SingleParameterWrapper parameterWrapper = (SingleParameterWrapper) paramObj;
paramValidator.validateBizParam(parameterWrapper.getWrapperObject()); paramValidator.validateBizParam(parameterWrapper.getWrapperObject());
@ -203,10 +202,10 @@ public class ApiArgumentResolver implements SopHandlerMethodArgumentResolver {
return singleParameterWrapper; return singleParameterWrapper;
} }
Object param; Object param;
// 如果是json字符串 try {
if (JSONValidator.from(bizContent).validate()) {
param = JSON.parseObject(bizContent, parameterType); param = JSON.parseObject(bizContent, parameterType);
} else { } catch (Exception e) {
log.error("非json参数,biz_content:{}, requestParams:{}", bizContent, requestParams);
// 否则认为是 aa=1&bb=33 形式 // 否则认为是 aa=1&bb=33 形式
Map<String, Object> query = OpenUtil.parseQueryToMap(bizContent); Map<String, Object> query = OpenUtil.parseQueryToMap(bizContent);
param = new JSONObject(query).toJavaObject(parameterType); param = new JSONObject(query).toJavaObject(parameterType);

@ -269,12 +269,12 @@ public class Example1001_BaseController {
@Open(value = "member.info.get") @Open(value = "member.info.get")
@RequestMapping("/member/info/get") @RequestMapping("/member/info/get")
public MemberInfoGetResult bigData(MemberInfoGetParam param) { public MemberInfoGetResult memberInfoGet(MemberInfoGetParam param) {
MemberInfoGetResult result = new MemberInfoGetResult(); MemberInfoGetResult result = new MemberInfoGetResult();
MemberInfoGetResultMemberInfo memberInfo = new MemberInfoGetResultMemberInfo(); MemberInfoGetResultMemberInfo memberInfo = new MemberInfoGetResultMemberInfo();
memberInfo.setIsVip((byte)1); memberInfo.setIsVip((byte)1);
memberInfo.setVipEndtime(new Date()); memberInfo.setVipEndtime(new Date());
result.setName(param.getName()); result.setName(JSON.toJSONString(param));
result.setId(11); result.setId(11);
result.setMemberInfo(memberInfo); result.setMemberInfo(memberInfo);
return result; return result;

@ -103,15 +103,13 @@ class OpenClient:
'charset': 'UTF-8', 'charset': 'UTF-8',
'sign_type': 'RSA2', 'sign_type': 'RSA2',
'timestamp': time.strftime("%Y-%m-%d %H:%M:%S", time.localtime()), 'timestamp': time.strftime("%Y-%m-%d %H:%M:%S", time.localtime()),
'version': request.get_version() 'version': request.get_version(),
'biz_content': json.dumps(params)
} }
if token is not None: if token is not None:
all_params['access_token'] = token all_params['access_token'] = token
# 添加业务参数
all_params.update(params)
# 构建sign # 构建sign
sign = SignUtil.create_sign(all_params, self.__private_key, 'RSA2') sign = SignUtil.create_sign(all_params, self.__private_key, 'RSA2')
all_params['sign'] = sign all_params['sign'] = sign

@ -48,7 +48,7 @@ class MyTestCase(unittest.TestCase):
# for f in files.values(): # for f in files.values():
# f.close() # f.close()
if response.is_success(): if response.get('code') == '10000':
print 'response: ', response print 'response: ', response
print 'is_vip:', response.get('member_info').get('is_vip', 0) print 'is_vip:', response.get('member_info').get('is_vip', 0)
else: else:

Loading…
Cancel
Save