From d09a6833e6b853c9523f0dc82bb08efc45ea2469 Mon Sep 17 00:00:00 2001 From: liangzy Date: Thu, 6 Aug 2020 18:35:41 +0800 Subject: [PATCH] delete sign value --- README.md | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/README.md b/README.md index ed3b44f..1392988 100644 --- a/README.md +++ b/README.md @@ -64,6 +64,18 @@ func init() { }) } ``` +服务端处理响应体为以下结构的json字符流, `code`,`status`,`msg` 这三个字段*最好*要包含且数字类型要一致 , `data` 部分为业务内容,自行定义 + +```json +{ + "code": 1001, + "msg": "不能为空", + "status": false, + "data": { + ... + } +} +``` ### 4.sdk编写 @@ -72,6 +84,12 @@ func init() { ```go import "golib.gaore.com/GaoreGo/gaore-common-sdk-go/sdk" +const ( + HOST = "jedi" // 如果非全域名会自动补全.gaore.com , 如jedi 会自动补全jedi.goare.com, 也可以打全域名 test.uu89.com + VERSION = "2020-08-04" +) + + type Client struct { sdk.Client } @@ -119,6 +137,7 @@ import ( "golib.gaore.com/GaoreGo/gaore-common-sdk-go/sdk/responses" ) +// 定义请求体 type DemoTestRequest struct { *requests.RpcRequest Param1 string `position:"Query" field:"param_1" default:"" ` @@ -128,11 +147,15 @@ type DemoTestRequest struct { func CreateDemoTestRequest() (req *DemoTestRequest) { req = &DemoTestRequest{RpcRequest: &requests.RpcRequest{}} + // InitWithApiInfo 初始化请求,有三个参数,域名,版本,和路径 + // 域名参数如果非全域名会自动补全.gaore.com , 如jedi 会自动补全jedi.goare.com, 也可以打全域名 test.uu89.com req.InitWithApiInfo(HOST, VERSION, "/api/sms/Index") + // 定义 请求方法 POST 或 GET req.Method = requests.GET return } +// 定义响应体 type DemoTestResponse struct { *responses.BaseResponse Data DemoTestResponseData `json:"data"`