diff --git a/scripts/lib/upt.lua b/scripts/lib/upt.lua new file mode 100644 index 0000000..e9d71e5 --- /dev/null +++ b/scripts/lib/upt.lua @@ -0,0 +1,20 @@ +-- 指定模块引用目录,否则无法加载同目录下的其他文件 +--package.path = package.path .. ';/usr/local/opt/openresty/nginx/scripts/?.lua'; +package.path = package.path .. ';/?.lua'; + +local _M = {} + +--local strip_path = require("strip_path") +--local Upyun = require('upyun') + +function _M.upt(uri) { + local secret = ngx.var.upt_secret + local duration = ngx.var.upt_duration + local etime = os.time() + duration + local sign = ngx.md5(secret .. '&' .. etime .. '&' .. uri) + ngx.log(ngx.ERR, 'sign...' .. sign .. ' etime..' .. etime) + local upt = string.sub(sign, 13, 13 + 7) .. etime + ngx.say(upt) +} + +return _M \ No newline at end of file