You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 
SOP/sop-sdk/sdk-go
tanghc a577df49c1 4.2.7 4 years ago
..
common 4.2.7 4 years ago
model 3.2.0 5 years ago
request 3.2.0 5 years ago
response 3.2.0 5 years ago
test 3.2.0 5 years ago
readme.md 3.2.0 5 years ago

readme.md

sdk-go


// 应用ID
const appId string = "xx"
// 应用私钥
const privateKey string = "xx"
// 请求地址
const url string = "http://localhost:7071/prod/gw68uy85"

// 请求客户端
var openClient = common.OpenClient{AppId: appId, PrivateKey: privateKey, Url: url}

func main() {
	// 创建请求
	memberInfoGetRequest := request.MemberInfoGetRequest{}
	// 请求参数
	memberInfoGetRequest.BizModel = model.MemberInfoGetModel{Name: "jim", Age: 22, Address: "xx"}
	
    // 添加上传文件
	//path, _ := os.Getwd()
	//files := []common.UploadFile{
	//	{Name:"file1", Filepath:path + "/test/aa.txt"},
	//	{Name:"file2", Filepath:path + "/test/bb.txt"},
	//}
	//memberInfoGetRequest.Files = files
    
    // 发送请求,返回json bytes
	var jsonBytes = openClient.Execute(memberInfoGetRequest)
	fmt.Printf("data:%s\n", string(jsonBytes))
	// 转换结果
	var memberInfoGetResponse response.MemberInfoGetResponse
	response.ConvertResponse(jsonBytes, &memberInfoGetResponse)

	if memberInfoGetResponse.IsSuccess() {
		fmt.Printf("is_vip:%d, vip_endtime:%s\n", memberInfoGetResponse.MemberInfo.IsVip, memberInfoGetResponse.MemberInfo.VipEndtime)
	} else {
		fmt.Printf("code:%s, msg:%s, subCode:%s, subMsg:%s\n",
			memberInfoGetResponse.Code, memberInfoGetResponse.Msg, memberInfoGetResponse.SubCode, memberInfoGetResponse.SubMsg)
	}
}