fix logic

This commit is contained in:
2022-03-09 12:56:28 +08:00
parent eedf2f93aa
commit ec724f1677
+8 -7
View File
@@ -22,15 +22,14 @@ local function get_access_token()
local htyuc = ngx.var.htyuc
local host = ngx.var.host
ngx.log(ngx.INFO, "Request URL -> ", ngx.var.uri)
ngx.log(ngx.INFO, "HTYUC -> ", htyuc)
ngx.log(ngx.INFO, "HOST -> ", host)
ngx.log(ngx.INFO, "URL -> ", ngx.var.uri)
ngx.log(ngx.INFO, "Host -> ", host)
ngx.log(ngx.INFO, 'HtyHostHeader -> ', htyhostHeader)
ngx.log(ngx.INFO, 'HtySudoerToken -> ', sudoerToken)
local remote_url = string.format("%s/api/v1/uc/wx/get_access_token", htyuc)
ngx.log(ngx.INFO, 'remote_url -> ', remote_url)
ngx.log(ngx.INFO, 'HtyHostHeader -> ', htyhostHeader)
ngx.log(ngx.INFO, 'HtySudoerToken -> ', sudoerToken)
local res, err = httpc:request_uri(
remote_url,
@@ -43,6 +42,7 @@ local function get_access_token()
}
}
)
if res == nil then
ngx.log(ngx.ERR, "FAILED TO CONNECT TO *HTYUC*", err)
end
@@ -51,9 +51,10 @@ local function get_access_token()
ngx.log(ngx.ERR, "GET ACCESS TOKEN *FAILED*", err)
ngx.say(err)
ngx.exit(res.status)
else
ngx.log(ngx.ERR, res.body)
return cjson.decode(res.body).d
end
ngx.log(ngx.ERR, res.body)
return cjson.decode(res.body).d
end
local function get_wx_media(media_id)