From 3a6c0374347d4db3516d9943148782b250d655f9 Mon Sep 17 00:00:00 2001 From: Vincent Young Date: Thu, 10 Nov 2022 02:23:14 +0800 Subject: [PATCH] Fixed bug --- main.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/main.go b/main.go index 28869da..2974332 100644 --- a/main.go +++ b/main.go @@ -85,6 +85,8 @@ type ResData struct { } func main() { + // create a random id + id := getRandomNumber() r := gin.Default() // r.SetTrustedProxies([]string{"192.168.36.153"}) r.GET("/", func(c *gin.Context) { @@ -95,6 +97,7 @@ func main() { }) }) + r.POST("/translate", func(c *gin.Context) { reqj := ResData{} c.BindJSON(&reqj) @@ -113,7 +116,8 @@ func main() { if translate_text != "" { url := "https://www2.deepl.com/jsonrpc" - id := getRandomNumber() + + id = id + 1 post_data := init_data(source_lang, target_lang)