fix:给msg进行url编码,解决青云客接口返回错误 (#73)

This commit is contained in:
himawari 2021-11-06 18:55:34 +08:00 committed by GitHub
parent 835df33e11
commit 7a0ce4b5d6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -7,6 +7,7 @@ import (
"io/ioutil"
"math/rand"
"net/http"
"net/url"
"regexp"
"strconv"
"strings"
@ -98,13 +99,13 @@ type dataQYK struct {
// 青云客取消息
func getMessage(msg string) (string, error) {
url := "http://api.qingyunke.com/api.php"
qykUrl := "http://api.qingyunke.com/api.php"
key := "free"
appid := "0"
url = fmt.Sprintf(url+"?key=%s&appid=%s&msg=%s", key, appid, msg)
qykUrl = fmt.Sprintf(qykUrl+"?key=%s&appid=%s&msg=%s", key, appid, url.QueryEscape(msg))
client := &http.Client{}
req, err := http.NewRequest("GET", url, nil)
req, err := http.NewRequest("GET", qykUrl, nil)
if err != nil {
return "", err
}