fix logic
This commit is contained in:
@@ -22,15 +22,14 @@ local function get_access_token()
|
|||||||
local htyuc = ngx.var.htyuc
|
local htyuc = ngx.var.htyuc
|
||||||
local host = ngx.var.host
|
local host = ngx.var.host
|
||||||
|
|
||||||
|
ngx.log(ngx.INFO, "Request URL -> ", ngx.var.uri)
|
||||||
ngx.log(ngx.INFO, "HTYUC -> ", htyuc)
|
ngx.log(ngx.INFO, "HTYUC -> ", htyuc)
|
||||||
ngx.log(ngx.INFO, "HOST -> ", host)
|
ngx.log(ngx.INFO, "Host -> ", host)
|
||||||
ngx.log(ngx.INFO, "URL -> ", ngx.var.uri)
|
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)
|
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)
|
||||||
ngx.log(ngx.INFO, 'HtyHostHeader -> ', htyhostHeader)
|
|
||||||
ngx.log(ngx.INFO, 'HtySudoerToken -> ', sudoerToken)
|
|
||||||
|
|
||||||
local res, err = httpc:request_uri(
|
local res, err = httpc:request_uri(
|
||||||
remote_url,
|
remote_url,
|
||||||
@@ -43,6 +42,7 @@ local function get_access_token()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
if res == nil then
|
if res == nil then
|
||||||
ngx.log(ngx.ERR, "FAILED TO CONNECT TO *HTYUC*", err)
|
ngx.log(ngx.ERR, "FAILED TO CONNECT TO *HTYUC*", err)
|
||||||
end
|
end
|
||||||
@@ -51,10 +51,11 @@ local function get_access_token()
|
|||||||
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(res.status)
|
||||||
end
|
else
|
||||||
ngx.log(ngx.ERR, res.body)
|
ngx.log(ngx.ERR, res.body)
|
||||||
return cjson.decode(res.body).d
|
return cjson.decode(res.body).d
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
local function get_wx_media(media_id)
|
local function get_wx_media(media_id)
|
||||||
local access_token = get_access_token()
|
local access_token = get_access_token()
|
||||||
|
|||||||
Reference in New Issue
Block a user