Merge branch 'master' into eureka

eureka
tanghc 4 years ago
commit 7423812b3c
  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
- 修复两个微服务相同path问题
- 修复Python-SDK下参数传递问题
## 4.2.6

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

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

@ -103,15 +103,13 @@ class OpenClient:
'charset': 'UTF-8',
'sign_type': 'RSA2',
'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:
all_params['access_token'] = token
# 添加业务参数
all_params.update(params)
# 构建sign
sign = SignUtil.create_sign(all_params, self.__private_key, 'RSA2')
all_params['sign'] = sign

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

Loading…
Cancel
Save