diff --git a/github/repo_searcher.go b/github/repo_searcher.go index aa61bb59..d67f5d7f 100644 --- a/github/repo_searcher.go +++ b/github/repo_searcher.go @@ -4,6 +4,7 @@ import ( "fmt" "io/ioutil" "net/http" + "net/url" "strings" "github.com/tidwall/gjson" @@ -13,7 +14,12 @@ import ( func init() { // 插件主体 zero.OnRegex(`>G\s(.*)`).SetBlock(true).SetPriority(0). Handle(func(ctx *zero.Ctx) { - link := "https://api.github.com/search/repositories?q=" + ctx.State["regex_matched"].([]string)[1] + api, _ := url.Parse("https://api.github.com/search/repositories") + params := url.Values{} + params.Set("q", ctx.State["regex_matched"].([]string)[1]) + api.RawQuery = params.Encode() + link := api.String() + client := &http.Client{} req, err := http.NewRequest("GET", link, nil) diff --git a/setutime/utils/utils.go b/setutime/utils/utils.go index 51c63055..24d75f74 100644 --- a/setutime/utils/utils.go +++ b/setutime/utils/utils.go @@ -8,8 +8,8 @@ import ( // Str2Int string --> int64 func Str2Int(str string) int64 { - val, _ := strconv.ParseInt(str, 10, 64) - return val + val, _ := strconv.Atoi(str) + return int64(val) } // Int2Str int64 --> string