Browse Source

小程序码路径&字符被转义问题

master v0.3.6
lijianbin 1 year ago
parent
commit
535afb769b
1 changed files with 10 additions and 3 deletions
  1. +10
    -3
      qrcode.go

+ 10
- 3
qrcode.go View File

@ -1,6 +1,7 @@
package wechat
import (
"bytes"
"encoding/base64"
"errors"
"fmt"
@ -49,13 +50,19 @@ func GetMiniappQrcode(access_token string, qrcodeParamsMap map[string]interface{
"auto_color": autoColor,
"is_hyaline": isHyaline,
}
requestDataJson, err := json.Marshal(requestData)
// json.marshal 会转义&字符
/*requestDataJson, err := json.Marshal(requestData)
if err != nil {
return "", err
}
}*/
bf := bytes.NewBuffer([]byte{})
jsonEncoder := json.NewEncoder(bf)
jsonEncoder.SetEscapeHTML(false)
jsonEncoder.Encode(requestData)
response, err := PostJson(getCodeUrl, requestDataJson)
response, err := PostJson(getCodeUrl, bf.Bytes())
if err != nil {
return "", err


Loading…
Cancel
Save