refactor lib

This commit is contained in:
2022-06-30 01:58:26 +08:00
parent 2357fa3d7e
commit af95a54aa1
6 changed files with 25 additions and 20 deletions
+2 -1
View File
@@ -3,6 +3,7 @@
package.path = package.path .. ';<SCRIPT_PATH>/?.lua';
local http = require "resty.http"
local cjson = require "cjson"
local pl = require "pl.pretty"
local uuid = require "resty.jit-uuid"
local upyun_upload = require("lib.upyun_upload")
local get_wx_media = require("lib.wx_download")
@@ -20,7 +21,7 @@ local function run()
local req_body = cjson.decode(ngx.req.get_body_data())
ngx.log(ngx.INFO, 'REQ_BODY -> ', ngx.req.get_body_data())
local downloaded_file = get_wx_media(httpc, req_body["media_id"]);
local downloaded_file = get_wx_media(httpc, req_body["media_id"], cjson, pl);
upyun_upload.upload(downloaded_file, uuid.generate_v4() .. ".jpg")
end