classify不阻塞请求

This commit is contained in:
fumiama 2021-06-19 15:22:51 +08:00
parent 754057f3c2
commit 018c37018f

View File

@ -14,7 +14,6 @@ import (
)
var (
BLOCK_REQUEST_CLASS = false
CACHE_IMG_FILE = "/tmp/setugt"
CACHE_URI = "file:///" + CACHE_IMG_FILE
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) {
if BLOCK_REQUEST_CLASS {
ctx.Send("请稍后再试哦")
} else {
BLOCK_REQUEST_CLASS = true
get_url := CLASSIFY_HEAD + url.QueryEscape(targeturl)
if noimg {
get_url += "&noimg=true"
@ -60,8 +56,6 @@ func Classify(ctx *zero.Ctx, targeturl string, noimg bool) {
replyClass(ctx, dhash, class, noimg)
}
}
BLOCK_REQUEST_CLASS = false
}
}
func Vote(ctx *zero.Ctx, class int) {