websdk压缩本地文件,增加文件名称设置功能

This commit is contained in:
luoliangyi 2023-10-23 16:22:47 +08:00
parent 7ac69fea99
commit 386b5d9e5c
5 changed files with 9 additions and 4 deletions

View File

@ -746,7 +746,7 @@ namespace ver_2
} }
int ManagerV2::LocalMakeZipFile(const std::vector<std::string>& filePathList, const std::vector<std::string>& nameList, int ManagerV2::LocalMakeZipFile(const std::vector<std::string>& filePathList, const std::vector<std::string>& nameList,
bool temp, std::string& outZipPath, std::string& errInfo) const std::string &zipPath, bool temp, std::string& outZipPath, std::string& errInfo)
{ {
outZipPath.clear(); outZipPath.clear();
errInfo = "错误"; errInfo = "错误";
@ -766,6 +766,8 @@ namespace ver_2
} }
std::string outZipPath2 = GetFilePath(temp, "zip"); std::string outZipPath2 = GetFilePath(temp, "zip");
if (!zipPath.empty())
outZipPath2 = zipPath;
int error = 0; int error = 0;
zip* z = zip_open(StdStringToUtf8(outZipPath2).c_str(), ZIP_CREATE | ZIP_TRUNCATE, &error); zip* z = zip_open(StdStringToUtf8(outZipPath2).c_str(), ZIP_CREATE | ZIP_TRUNCATE, &error);

View File

@ -160,7 +160,7 @@ namespace ver_2
std::vector<std::string>& outImagePathList, std::string& errInfo); std::vector<std::string>& outImagePathList, std::string& errInfo);
// 本地生成压缩文件 // 本地生成压缩文件
int LocalMakeZipFile(const std::vector<std::string>& filePathList, const std::vector<std::string>& nameList, int LocalMakeZipFile(const std::vector<std::string>& filePathList, const std::vector<std::string>& nameList,
bool temp, std::string& outZipPath, std::string& errInfo); const std::string &zipPath, bool temp, std::string& outZipPath, std::string& errInfo);
// 本地图像纠偏 // 本地图像纠偏
int LocalImageDeskew(const std::string& imagePath, bool autoCrop, bool deskew, bool fillBlank, int width, int height, int LocalImageDeskew(const std::string& imagePath, bool autoCrop, bool deskew, bool fillBlank, int width, int height,
bool temp, std::string& outImagePath, std::string& errInfo); bool temp, std::string& outImagePath, std::string& errInfo);

View File

@ -1732,9 +1732,11 @@ namespace ver_2
} }
} }
std::string zipPath = GetJsonStringValue(json, "zip_path");
std::string outZipPath; std::string outZipPath;
std::string errInfo; std::string errInfo;
int ret = GetManager()->LocalMakeZipFile(filePathList, nameList, !localSave, outZipPath, errInfo); int ret = GetManager()->LocalMakeZipFile(filePathList, nameList, zipPath, !localSave, outZipPath, errInfo);
if ("make_zip_file" == func || "base64_make_zip_file" == func) if ("make_zip_file" == func || "base64_make_zip_file" == func)
{ {

View File

@ -444,7 +444,8 @@
socket.send(JSON.stringify({ socket.send(JSON.stringify({
'func':'local_make_zip_file', 'func':'local_make_zip_file',
'file_path_list':['D:\\1.jpg','D:\\2.jpg'], 'file_path_list':['D:\\1.jpg','D:\\2.jpg'],
'local_save':false, 'local_save':true,
'zip_path':'D:\\1.zip',
'get_base64':true 'get_base64':true
})); }));
} }