diff --git a/conf/local_macos/admin.conf b/conf/local_macos/admin.conf index bd2129f..a882830 100644 --- a/conf/local_macos/admin.conf +++ b/conf/local_macos/admin.conf @@ -7,7 +7,8 @@ server { set $tmp_file_dir "/usr/local/file_upload"; # 文件存储路径 set $task_server "http://127.0.0.1:8080"; # task server host - set $htyuc "http://127.0.0.1:3000"; #htyuc host +# set $htyuc "http://127.0.0.1:3000"; #htyuc host + set $htyuc "https://admin.alchemy-studio.cn"; #htyuc host set $resty_loc "/usr/local/opt/openresty"; set $convert "/usr/local/bin/convert"; set $upyun_operator "moicen"; @@ -60,6 +61,10 @@ server { location /api/ngx/image/form_upload_to_combine { content_by_lua_file $resty_loc/nginx/scripts/form_upload_to_combine.lua; } + #compress image file by form + location /api/ngx/image/form_upload_to_compress { + content_by_lua_file $resty_loc/nginx/scripts/form_upload_to_compress.lua; + } #Upload image files to combine by wx location /api/ngx/image/wx_upload_to_combine { content_by_lua_file $resty_loc/nginx/scripts/wx_upload_to_combine.lua; diff --git a/scripts/form_upload_to_compress.lua b/scripts/form_upload_to_compress.lua index f1106ba..c3c9fc4 100644 --- a/scripts/form_upload_to_compress.lua +++ b/scripts/form_upload_to_compress.lua @@ -109,6 +109,11 @@ local function read_form_file() handle:close() -- Upload compressed file to upyun + local upyun_upload = require("lib.upyun_upload") + + ngx.log(ngx.INFO, 'UPLOAD COMPRESSED IMAGE -> fullpath -> ', output_file[i]) + + upyun_upload.upload(output_file[i], nil) end diff --git a/scripts/lib/upyun_upload.lua b/scripts/lib/upyun_upload.lua index 2c93b33..1cb4f35 100644 --- a/scripts/lib/upyun_upload.lua +++ b/scripts/lib/upyun_upload.lua @@ -26,7 +26,11 @@ function upyun_upload.upload(filepath, filename) filename = strip_path.strip_path(filepath) end + ngx.log(ngx.INFO, 'bucket -> ', bucket) + ngx.log(ngx.INFO, 'directory -> ', directory) + local savePath = bucket .. "/" .. directory .. "/" .. filename + ngx.log(ngx.INFO, " savePath " , savePath) local info, err = upyun:upload_file(savePath, nil, nil) if not info then