classify不阻塞请求

This commit is contained in:
fumiama 2021-06-19 15:22:51 +08:00
parent 48632e25b8
commit 3fc165d636

View File

@ -14,7 +14,6 @@ import (
) )
var ( var (
BLOCK_REQUEST_CLASS = false
CACHE_IMG_FILE = "/tmp/setugt" CACHE_IMG_FILE = "/tmp/setugt"
CACHE_URI = "file:///" + CACHE_IMG_FILE CACHE_URI = "file:///" + CACHE_IMG_FILE
VOTE_API_URL = "http://saki.fumiama.top/vote?uuid=零号&img=%s&class=%d" VOTE_API_URL = "http://saki.fumiama.top/vote?uuid=零号&img=%s&class=%d"
@ -24,10 +23,7 @@ var (
) )
func Classify(ctx *zero.Ctx, targeturl string, noimg bool) { func Classify(ctx *zero.Ctx, targeturl string, noimg bool) {
if BLOCK_REQUEST_CLASS {
ctx.Send("请稍后再试哦")
} else {
BLOCK_REQUEST_CLASS = true
get_url := CLASSIFY_HEAD + url.QueryEscape(targeturl) get_url := CLASSIFY_HEAD + url.QueryEscape(targeturl)
if noimg { if noimg {
get_url += "&noimg=true" get_url += "&noimg=true"
@ -60,8 +56,6 @@ func Classify(ctx *zero.Ctx, targeturl string, noimg bool) {
replyClass(ctx, dhash, class, noimg) replyClass(ctx, dhash, class, noimg)
} }
} }
BLOCK_REQUEST_CLASS = false
}
} }
func Vote(ctx *zero.Ctx, class int) { func Vote(ctx *zero.Ctx, class int) {