mirror of
https://github.com/FloatTech/ZeroBot-Plugin.git
synced 2025-12-19 13:59:39 +08:00
fix:给msg进行url编码,解决青云客接口返回错误 (#73)
This commit is contained in:
parent
835df33e11
commit
7a0ce4b5d6
@ -7,6 +7,7 @@ import (
|
|||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"math/rand"
|
"math/rand"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
"net/url"
|
||||||
"regexp"
|
"regexp"
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
@ -98,13 +99,13 @@ type dataQYK struct {
|
|||||||
|
|
||||||
// 青云客取消息
|
// 青云客取消息
|
||||||
func getMessage(msg string) (string, error) {
|
func getMessage(msg string) (string, error) {
|
||||||
url := "http://api.qingyunke.com/api.php"
|
qykUrl := "http://api.qingyunke.com/api.php"
|
||||||
key := "free"
|
key := "free"
|
||||||
appid := "0"
|
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{}
|
client := &http.Client{}
|
||||||
req, err := http.NewRequest("GET", url, nil)
|
req, err := http.NewRequest("GET", qykUrl, nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return "", err
|
return "", err
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user