|
@@ -40,8 +40,8 @@ func init() {
|
|
|
}
|
|
|
|
|
|
const (
|
|
|
- LIMIT_TIME = 300000 //签名超时时间
|
|
|
- LIMIT_COUNT = 3000 //每天接口限制
|
|
|
+ LIMIT_TIME = 300 //签名超时时间
|
|
|
+ LIMIT_COUNT = 3000 //每天接口限制
|
|
|
REDISDB = "jyOpenAPI"
|
|
|
CODE_E1 = 40000
|
|
|
MSG_E1 = "签名错误"
|
|
@@ -120,7 +120,7 @@ func OpenAction(w http.ResponseWriter, r *http.Request) {
|
|
|
[]string{"keyword", keyword},
|
|
|
[]string{"appid", appid},
|
|
|
[]string{"timestamp", strconv.Itoa(timestamp)},
|
|
|
- []string{"pagenum", strconv.Itoa(pagenum)},
|
|
|
+ //[]string{"pagenum", strconv.Itoa(pagenum)},
|
|
|
})
|
|
|
log.Println(action, "--", keyword, "---", appid, "--", timestamp, "--", pagenum)
|
|
|
log.Println(signature, "签名串:", sign)
|
|
@@ -211,7 +211,7 @@ func GetAPIIP(req *http.Request) string {
|
|
|
//GET请求
|
|
|
func GET(action string, param [][]string) (signedStr string) {
|
|
|
ps := ¶mSorter{[]string{}, []string{}}
|
|
|
- ps.Keys = append(ps.Keys, "Action")
|
|
|
+ ps.Keys = append(ps.Keys, "action")
|
|
|
ps.Vals = append(ps.Vals, action)
|
|
|
if len(param) > 0 {
|
|
|
for _, v := range param {
|
|
@@ -221,9 +221,7 @@ func GET(action string, param [][]string) (signedStr string) {
|
|
|
}
|
|
|
ps.Sort()
|
|
|
reqStr := ps.String()
|
|
|
- str := "GET&" +
|
|
|
- percentEncode("/") + "&" +
|
|
|
- percentEncode(reqStr)
|
|
|
+ str := percentEncode(reqStr)
|
|
|
str = SP(str, "%3A", "%253A", -1)
|
|
|
h := hmac.New(func() hash.Hash { return sha1.New() }, []byte(SECRET+"&"))
|
|
|
io.WriteString(h, str)
|