提交 f129d0d15aa74914a8859c239c949932aafb0b03

作者 yuyang
2 个父辈 fb4929fa b62d8fcf

merge

@@ -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 {
注册登录 后发表评论