1
0
mirror of https://github.com/Mrs4s/go-cqhttp.git synced 2025-05-07 04:23:49 +08:00

fix exist

This commit is contained in:
wdvxdr 2021-02-28 16:43:15 +08:00
parent 8ef877777d
commit a0d4dfd0eb
No known key found for this signature in database
GPG Key ID: 55FF1414A69CEBA6

View File

@ -23,7 +23,7 @@ type httpServer struct {
engine *gin.Engine engine *gin.Engine
bot *coolq.CQBot bot *coolq.CQBot
HTTP *http.Server HTTP *http.Server
api *apiCaller api apiCaller
} }
type httpClient struct { type httpClient struct {
@ -46,7 +46,7 @@ func (s *httpServer) Run(addr, authToken string, bot *coolq.CQBot) {
gin.SetMode(gin.ReleaseMode) gin.SetMode(gin.ReleaseMode)
s.engine = gin.New() s.engine = gin.New()
s.bot = bot s.bot = bot
s.api = &apiCaller{s.bot} s.api = apiCaller{s.bot}
s.engine.Use(func(c *gin.Context) { s.engine.Use(func(c *gin.Context) {
if c.Request.Method != "GET" && c.Request.Method != "POST" { if c.Request.Method != "GET" && c.Request.Method != "POST" {
log.Warnf("已拒绝客户端 %v 的请求: 方法错误", c.Request.RemoteAddr) log.Warnf("已拒绝客户端 %v 的请求: 方法错误", c.Request.RemoteAddr)
@ -182,7 +182,7 @@ func (h httpContext) Get(k string) gjson.Result {
} }
} }
} }
return gjson.Result{Type: gjson.String, Str: ""} return gjson.Result{Type: gjson.Null, Str: ""}
} }
func (s *httpServer) ShutDown() { func (s *httpServer) ShutDown() {