unify httpc usage
This commit is contained in:
@@ -3,10 +3,13 @@
|
||||
package.path = package.path .. ';<SCRIPT_PATH>/?.lua';
|
||||
|
||||
local cjson = require "cjson"
|
||||
local http = require 'resty.http'
|
||||
local uuid = require "resty.jit-uuid"
|
||||
local upyun_upload = require("upyun_upload")
|
||||
local get_wx_media = require("wx_download")
|
||||
|
||||
local httpc = http:new()
|
||||
|
||||
local function convert()
|
||||
|
||||
local file_dir = ngx.var.tmp_file_dir
|
||||
@@ -14,7 +17,7 @@ local function convert()
|
||||
local req_body = cjson.decode(ngx.req.get_body_data())
|
||||
ngx.log(ngx.INFO, 'REQ_BODY -> ', ngx.req.get_body_data())
|
||||
|
||||
local input_audio_file = get_wx_media(req_body["payload"]["media_id"]);
|
||||
local input_audio_file = get_wx_media(httpc, req_body["payload"]["media_id"]);
|
||||
local converted_audio_file = file_dir .. "/" .. uuid.generate_v4() .. ".mp3";
|
||||
|
||||
ngx.log(ngx.INFO, "Input audio file -> ", input_audio_file);
|
||||
|
||||
Reference in New Issue
Block a user