|
@@ -3,7 +3,9 @@ package gopay
|
|
|
import (
|
|
import (
|
|
|
"encoding/json"
|
|
"encoding/json"
|
|
|
"errors"
|
|
"errors"
|
|
|
|
|
+ "fmt"
|
|
|
"github.com/parnurzeal/gorequest"
|
|
"github.com/parnurzeal/gorequest"
|
|
|
|
|
+ "golang.org/x/text/encoding/simplifiedchinese"
|
|
|
"log"
|
|
"log"
|
|
|
"time"
|
|
"time"
|
|
|
)
|
|
)
|
|
@@ -76,12 +78,17 @@ func (this *aliPayClient) AliPayTradePay(body BodyMap) (aliRsp *AliPayTradePayRe
|
|
|
return nil, err
|
|
return nil, err
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- //log.Println("string::::", string(bytes))
|
|
|
|
|
|
|
+ convertBytes, _ := simplifiedchinese.GBK.NewDecoder().Bytes(bytes)
|
|
|
|
|
+ //log.Println("convertBytes::::", string(convertBytes))
|
|
|
aliRsp = new(AliPayTradePayResponse)
|
|
aliRsp = new(AliPayTradePayResponse)
|
|
|
- err = json.Unmarshal(bytes, aliRsp)
|
|
|
|
|
|
|
+ err = json.Unmarshal(convertBytes, aliRsp)
|
|
|
if err != nil {
|
|
if err != nil {
|
|
|
return nil, err
|
|
return nil, err
|
|
|
}
|
|
}
|
|
|
|
|
+ if aliRsp.AlipayTradePayResponse.Code != "10000" {
|
|
|
|
|
+ info := aliRsp.AlipayTradePayResponse
|
|
|
|
|
+ return nil, fmt.Errorf("code:%v,msg:%v,sub_code:%v,sub_msg:%v.", info.Code, info.Msg, info.SubCode, info.SubMsg)
|
|
|
|
|
+ }
|
|
|
return aliRsp, nil
|
|
return aliRsp, nil
|
|
|
}
|
|
}
|
|
|
|
|
|