From c27c983cd6994e523a908c398027de37ab2e0181 Mon Sep 17 00:00:00 2001 From: RycCheen Date: Tue, 26 May 2020 20:43:53 +0800 Subject: [PATCH] fix bug about timestamp, desc:invalid timestamp, more: [https://ding-doc.dingtalk.com/doc#/serverapi2/qf2nxq --- security/security.go | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/security/security.go b/security/security.go index 3a09662..64c3c6a 100644 --- a/security/security.go +++ b/security/security.go @@ -20,8 +20,6 @@ var dingTalkURL url.URL = url.URL{ Path: "robot/send", } -var timestamp = strconv.FormatInt(time.Now().Unix()*1000, 10) - // GetDingTalkURL get DingTalk URL with accessToken & secret // If no signature is set, the secret is set to "" // 如果没有加签,secret 设置为 "" 即可 @@ -35,6 +33,7 @@ func GetDingTalkURL(accessToken string, secret string) (string, error) { return dtu.String(), nil } + timestamp := strconv.FormatInt(time.Now().Unix()*1000, 10) sign, err := sign(timestamp, secret) if err != nil { dtu.RawQuery = value.Encode()