eureka
tanghc 4 years ago
parent 306742b72f
commit a577df49c1
  1. 16
      sop-example/sop-story/src/main/java/com/gitee/sop/storyweb/controller/Example1001_BaseController.java
  2. 34
      sop-example/sop-story/src/main/java/com/gitee/sop/storyweb/controller/param/MemberInfoGetParam.java
  3. 39
      sop-example/sop-story/src/main/java/com/gitee/sop/storyweb/controller/result/MemberInfoGetResult.java
  4. 29
      sop-example/sop-story/src/main/java/com/gitee/sop/storyweb/controller/result/MemberInfoGetResultMemberInfo.java
  5. 6
      sop-sdk/sdk-go/common/OpenClient.go

@ -9,9 +9,12 @@ import com.gitee.sop.servercommon.bean.ServiceContext;
import com.gitee.sop.servercommon.exception.ServiceException; import com.gitee.sop.servercommon.exception.ServiceException;
import com.gitee.sop.storyweb.controller.param.CategoryParam; import com.gitee.sop.storyweb.controller.param.CategoryParam;
import com.gitee.sop.storyweb.controller.param.LargeTextParam; import com.gitee.sop.storyweb.controller.param.LargeTextParam;
import com.gitee.sop.storyweb.controller.param.MemberInfoGetParam;
import com.gitee.sop.storyweb.controller.param.StoryParam; import com.gitee.sop.storyweb.controller.param.StoryParam;
import com.gitee.sop.storyweb.controller.param.TypeEnum; import com.gitee.sop.storyweb.controller.param.TypeEnum;
import com.gitee.sop.storyweb.controller.result.CategoryResult; import com.gitee.sop.storyweb.controller.result.CategoryResult;
import com.gitee.sop.storyweb.controller.result.MemberInfoGetResult;
import com.gitee.sop.storyweb.controller.result.MemberInfoGetResultMemberInfo;
import com.gitee.sop.storyweb.controller.result.StoryResult; import com.gitee.sop.storyweb.controller.result.StoryResult;
import com.gitee.sop.storyweb.controller.result.TestResult; import com.gitee.sop.storyweb.controller.result.TestResult;
import com.gitee.sop.storyweb.controller.result.TreeResult; import com.gitee.sop.storyweb.controller.result.TreeResult;
@ -264,4 +267,17 @@ public class Example1001_BaseController {
return map; return map;
} }
@Open(value = "member.info.get")
@RequestMapping("/member/info/get")
public MemberInfoGetResult bigData(MemberInfoGetParam param) {
MemberInfoGetResult result = new MemberInfoGetResult();
MemberInfoGetResultMemberInfo memberInfo = new MemberInfoGetResultMemberInfo();
memberInfo.setIsVip((byte)1);
memberInfo.setVipEndtime(new Date());
result.setName(param.getName());
result.setId(11);
result.setMemberInfo(memberInfo);
return result;
}
} }

@ -0,0 +1,34 @@
package com.gitee.sop.storyweb.controller.param;
/**
* 请求参数
*/
public class MemberInfoGetParam {
private String name;
private Integer age;
private String address;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public Integer getAge() {
return age;
}
public void setAge(Integer age) {
this.age = age;
}
public String getAddress() {
return address;
}
public void setAddress(String address) {
this.address = address;
}
}

@ -0,0 +1,39 @@
package com.gitee.sop.storyweb.controller.result;
import com.fasterxml.jackson.annotation.JsonProperty;
/**
* 接口返回结果
*/
public class MemberInfoGetResult {
private Integer id;
private String name;
@JsonProperty("member_info")
private MemberInfoGetResultMemberInfo memberInfo;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public MemberInfoGetResultMemberInfo getMemberInfo() {
return memberInfo;
}
public void setMemberInfo(MemberInfoGetResultMemberInfo memberInfo) {
this.memberInfo = memberInfo;
}
}

@ -0,0 +1,29 @@
package com.gitee.sop.storyweb.controller.result;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.Date;
public class MemberInfoGetResultMemberInfo {
@JsonProperty("is_vip")
private Byte isVip;
@JsonProperty("vip_endtime")
private Date vipEndtime;
public Byte getIsVip() {
return isVip;
}
public void setIsVip(Byte isVip) {
this.isVip = isVip;
}
public Date getVipEndtime() {
return vipEndtime;
}
public void setVipEndtime(Date vipEndtime) {
this.vipEndtime = vipEndtime;
}
}

@ -66,13 +66,11 @@ func parseResponseResult(iRequest IRequest, response string) []byte {
if err != nil { if err != nil {
panic(err) panic(err)
} }
requestId := responseRoot["request_id"].(string)
var responseDataMap = responseRoot["error_response"] var responseDataMap = responseRoot["error_response"]
if responseDataMap == nil { if responseDataMap == nil {
dataName := strings.ReplaceAll(iRequest.GetMethod(), ".", "_") + "_response" dataName := strings.ReplaceAll(iRequest.GetMethod(), ".", "_") + "_response"
responseDataMap = responseRoot[dataName] responseDataMap = responseRoot[dataName]
} }
responseDataMap.(map[string]interface{})["request_id"] = requestId
// json数据 // json数据
dataJsonBytes, _ := json.Marshal(responseDataMap) dataJsonBytes, _ := json.Marshal(responseDataMap)
return dataJsonBytes return dataJsonBytes
@ -92,10 +90,12 @@ func (client OpenClient) buildParams(iRequest IRequest, params map[string]interf
allParams["access_token"] = token allParams["access_token"] = token
} }
bizParams := map[string]interface{}{}
// 添加业务参数 // 添加业务参数
for k, v := range params { for k, v := range params {
allParams[k] = ToString(v) bizParams[k] = v
} }
allParams["biz_content"] = ToString(bizParams)
// 构建sign // 构建sign
sign := CreateSign(allParams, client.PrivateKey, "RSA2") sign := CreateSign(allParams, client.PrivateKey, "RSA2")

Loading…
Cancel
Save