fix: 富友验签错误 — 签名原文必须包含空值字段(与富友文档签名实例一致)
All checks were successful
构建并部署到测试环境(无 SSH) / build-and-deploy (push) Successful in 7m9s
All checks were successful
构建并部署到测试环境(无 SSH) / build-and-deploy (push) Successful in 7m9s
This commit is contained in:
@@ -68,6 +68,8 @@ func NewClient(insCd, mchntCd, termId, apiURL, notifyURL, privateKeyBase64, publ
|
|||||||
func (c *Client) Sign(data interface{}) (string, error) {
|
func (c *Client) Sign(data interface{}) (string, error) {
|
||||||
signStr := buildSignString(data)
|
signStr := buildSignString(data)
|
||||||
|
|
||||||
|
c.logger.Debug("富友签名原文", zap.String("sign_str", signStr))
|
||||||
|
|
||||||
// UTF-8 → GBK
|
// UTF-8 → GBK
|
||||||
gbkBytes, err := utf8ToGBK([]byte(signStr))
|
gbkBytes, err := utf8ToGBK([]byte(signStr))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -227,11 +229,6 @@ func structToMap(data interface{}) map[string]string {
|
|||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
// 排除空值
|
|
||||||
if value == "" {
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
|
|
||||||
result[tag] = value
|
result[tag] = value
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user