瀏覽代碼

fix: 优化请求头中 nonce 的设置逻辑

zqbao 4 月之前
父節點
當前提交
39a52ba74d
共有 1 個文件被更改,包括 1 次插入1 次删除
  1. 1 1
      services/knowledge/knowledge.go

+ 1 - 1
services/knowledge/knowledge.go

@@ -73,7 +73,7 @@ func ForwardRequest(c *gin.Context, targetURL string) (responseBody []byte, err
 	nonce := utils.GetRandStringNoSpecialChar(32)
 	nonce := utils.GetRandStringNoSpecialChar(32)
 	timeStamp := time.Now().UnixMilli() / 1000
 	timeStamp := time.Now().UnixMilli() / 1000
 	signature := utils.GetSign(global.CONFIG.EtaReport.AppId, global.CONFIG.EtaReport.Secret, nonce, strconv.Itoa(int(timeStamp)))
 	signature := utils.GetSign(global.CONFIG.EtaReport.AppId, global.CONFIG.EtaReport.Secret, nonce, strconv.Itoa(int(timeStamp)))
-	req.Header.Set("nonce", utils.GetRandStringNoSpecialChar(32))
+	req.Header.Set("nonce", nonce)
 	req.Header.Set("timestamp", strconv.Itoa(int(timeStamp)))
 	req.Header.Set("timestamp", strconv.Itoa(int(timeStamp)))
 	req.Header.Set("appid", global.CONFIG.EtaReport.AppId)
 	req.Header.Set("appid", global.CONFIG.EtaReport.AppId)
 	req.Header.Set("signature", signature)
 	req.Header.Set("signature", signature)