正在显示
2 个修改的文件
包含
13 行增加
和
1 行删除
@@ -5,5 +5,6 @@ type OrderModel struct { | @@ -5,5 +5,6 @@ type OrderModel struct { | ||
5 | Sign string `json:"sign"` | 5 | Sign string `json:"sign"` |
6 | PtCode string `json:"ptcode"` | 6 | PtCode string `json:"ptcode"` |
7 | BusinessCode string `json:"bussiness_code"` | 7 | BusinessCode string `json:"bussiness_code"` |
8 | + | ||
8 | } | 9 | } |
9 | 10 |
@@ -3,6 +3,7 @@ package socialwork_sdk | @@ -3,6 +3,7 @@ package socialwork_sdk | ||
3 | import ( | 3 | import ( |
4 | "encoding/base64" | 4 | "encoding/base64" |
5 | "encoding/json" | 5 | "encoding/json" |
6 | + "fmt" | ||
6 | "gitlab.workai.com.cn/chenang/socialwork-sdk/model" | 7 | "gitlab.workai.com.cn/chenang/socialwork-sdk/model" |
7 | "log" | 8 | "log" |
8 | ) | 9 | ) |
@@ -16,6 +17,10 @@ type OrderClient struct { | @@ -16,6 +17,10 @@ type OrderClient struct { | ||
16 | IP string `json:"ip"` | 17 | IP string `json:"ip"` |
17 | } | 18 | } |
18 | 19 | ||
20 | +func HelloWorld() { | ||
21 | + fmt.Println("欢迎使用小爱,socialwork-sdk") | ||
22 | +} | ||
23 | + | ||
19 | func NewOrderClient(key, iv, customerPrivateKey, publicKey, ip string) *OrderClient { | 24 | func NewOrderClient(key, iv, customerPrivateKey, publicKey, ip string) *OrderClient { |
20 | return &OrderClient{ | 25 | return &OrderClient{ |
21 | Key: key, | 26 | Key: key, |
@@ -84,7 +89,13 @@ func (o *OrderClient) SendRequest(businessCode, reqBody string) (string, error) | @@ -84,7 +89,13 @@ func (o *OrderClient) SendRequest(businessCode, reqBody string) (string, error) | ||
84 | return "", err | 89 | return "", err |
85 | } | 90 | } |
86 | 91 | ||
87 | - return respBody, nil | 92 | + orderRes := model.OrderModel{} |
93 | + json.Unmarshal([]byte(respBody), &orderRes) | ||
94 | + _respBody, err := o.DecryptAndVerySign(orderRes.Data, orderRes.Sign) | ||
95 | + if err != nil { | ||
96 | + return "", err | ||
97 | + } | ||
98 | + return string(_respBody), nil | ||
88 | } | 99 | } |
89 | 100 | ||
90 | func (o *OrderClient) checkParams(businessCode, reqBody string) error { | 101 | func (o *OrderClient) checkParams(businessCode, reqBody string) error { |
请
注册
或
登录
后发表评论