add log
This commit is contained in:
+12
-7
@@ -19,9 +19,11 @@ local function get_access_token()
|
|||||||
ngx.log(ngx.INFO, 'HtySudoerToken -> ', sudoerToken)
|
ngx.log(ngx.INFO, 'HtySudoerToken -> ', sudoerToken)
|
||||||
|
|
||||||
local remote_url = string.format("%s/api/v1/uc/wx_get_access_token", htyuc)
|
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, 'REMOTE URL -> ', remote_url)
|
||||||
|
|
||||||
local res, err = httpc:request_uri(
|
ngx.log(ngx.INFO, "START REQUEST TO GET ACCESS TOKEN")
|
||||||
|
|
||||||
|
local resp, err = httpc:request_uri(
|
||||||
remote_url,
|
remote_url,
|
||||||
{
|
{
|
||||||
ssl_verify = false, -- 设置参数 ssl_verify 为false 不校验ssl证书
|
ssl_verify = false, -- 设置参数 ssl_verify 为false 不校验ssl证书
|
||||||
@@ -33,17 +35,20 @@ local function get_access_token()
|
|||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
if res == nil then
|
ngx.log(ngx.INFO, "RESP -> ", resp)
|
||||||
|
ngx.log(ngx.ERR, "ERR -> ", err)
|
||||||
|
|
||||||
|
if resp == nil then
|
||||||
ngx.log(ngx.ERR, "FAILED TO CONNECT TO *HTYUC*", err)
|
ngx.log(ngx.ERR, "FAILED TO CONNECT TO *HTYUC*", err)
|
||||||
end
|
end
|
||||||
|
|
||||||
if 200 ~= res.status then
|
if 200 ~= resp.status then
|
||||||
ngx.log(ngx.ERR, "GET ACCESS TOKEN *FAILED*", err)
|
ngx.log(ngx.ERR, "GET ACCESS TOKEN *FAILED*", err)
|
||||||
ngx.say(err)
|
ngx.say(err)
|
||||||
ngx.exit(res.status)
|
ngx.exit(resp.status)
|
||||||
else
|
else
|
||||||
ngx.log(ngx.ERR, res.body)
|
ngx.log(ngx.ERR, "RESP IS OK -> ", resp.body)
|
||||||
return cjson.decode(res.body).d
|
return cjson.decode(resp.body).d
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user