From 1d5a603ca76511a3929f35242e8e9558bac3f184 Mon Sep 17 00:00:00 2001 From: luoliangyi <87842688@qq.com> Date: Thu, 23 Jun 2022 15:22:29 +0800 Subject: [PATCH] =?UTF-8?q?websdk=E8=A7=A3=E5=86=B3=E7=BA=A0=E5=81=8F?= =?UTF-8?q?=E5=A4=B1=E8=B4=A5=E7=9A=84bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sdk/webservice/ManagerV2.cpp | 28 ++++++++++++++-------------- sdk/webservice/ManagerV2.h | 18 ------------------ test/webservice/demo.html | 8 +++++--- 3 files changed, 19 insertions(+), 35 deletions(-) diff --git a/sdk/webservice/ManagerV2.cpp b/sdk/webservice/ManagerV2.cpp index b60de786..ba285168 100644 --- a/sdk/webservice/ManagerV2.cpp +++ b/sdk/webservice/ManagerV2.cpp @@ -805,7 +805,7 @@ namespace ver_2 outImagePath.clear(); errInfo = "错误"; - if (imagePath.empty() || width <= 0 || height <= 0) + if (imagePath.empty() || width < 0 || height < 0) return -1; int ret = -1; @@ -2870,21 +2870,21 @@ namespace ver_2 CURL* curl = curl_easy_init(); if (NULL != curl) { - char tmpName[256]; - HGBase_GetUuid(tmpName, 256); + //char tmpName[256]; + //HGBase_GetUuid(tmpName, 256); char remotePath[256]; HGBase_GetFilePath(remoteFilePath.c_str(), remotePath, 256); char remoteName[256]; HGBase_GetFileName(remoteFilePath.c_str(), remoteName, 256); - char ftp_rnfr[512]; - sprintf(ftp_rnfr, "RNFR %s", tmpName); - char ftp_rnto[512]; - sprintf(ftp_rnto, "RNTO %s", remoteName); + //char ftp_rnfr[512]; + //sprintf(ftp_rnfr, "RNFR %s", tmpName); + //char ftp_rnto[512]; + //sprintf(ftp_rnto, "RNTO %s", remoteName); - struct curl_slist* headerlist = NULL; - headerlist = curl_slist_append(headerlist, ftp_rnfr); - headerlist = curl_slist_append(headerlist, ftp_rnto); + //struct curl_slist* headerlist = NULL; + //headerlist = curl_slist_append(headerlist, ftp_rnfr); + //headerlist = curl_slist_append(headerlist, ftp_rnto); /* we want to use our own read function */ curl_easy_setopt(curl, CURLOPT_READFUNCTION, read_callback); @@ -2895,18 +2895,18 @@ namespace ver_2 if (!user.empty() && !password.empty()) { sprintf(url, "ftp://%s:%s@%s:%d%s%s", user.c_str(), password.c_str(), - host.c_str(), port, remotePath, tmpName); + host.c_str(), port, remotePath, remoteName); } else { - sprintf(url, "ftp://%s:%d%s%s", host.c_str(), port, remotePath, tmpName); + sprintf(url, "ftp://%s:%d%s%s", host.c_str(), port, remotePath, remoteName); } curl_easy_setopt(curl, CURLOPT_URL, url); curl_easy_setopt(curl, CURLOPT_FTP_CREATE_MISSING_DIRS, 1); /* pass in that last of FTP commands to run after the transfer */ - curl_easy_setopt(curl, CURLOPT_POSTQUOTE, headerlist); + //curl_easy_setopt(curl, CURLOPT_POSTQUOTE, headerlist); /* now specify which file to upload */ curl_easy_setopt(curl, CURLOPT_READDATA, file); @@ -2926,7 +2926,7 @@ namespace ver_2 ret = 0; /* clean up the FTP commands list */ - curl_slist_free_all(headerlist); + //curl_slist_free_all(headerlist); /* always cleanup */ curl_easy_cleanup(curl); diff --git a/sdk/webservice/ManagerV2.h b/sdk/webservice/ManagerV2.h index 02bf2745..efb3f9fe 100644 --- a/sdk/webservice/ManagerV2.h +++ b/sdk/webservice/ManagerV2.h @@ -176,24 +176,6 @@ namespace ver_2 int x, int y, int width, int height, bool temp, std::string& outImagePath, std::string& errInfo); // 图像方向校正 int LocalImageDirectionCorrect(const std::string& imagePath, bool temp, std::string& outImagePath, std::string& errInfo); - // 二值化 - //int LocalImageBinarization(const std::string& imagePath, const std::string& type, int threshold, bool temp, std::string& outImagePath, std::string& errInfo); - // 通道提取 - //int LocalImageExtractChannel(const std::string& imagePath, const std::string& type, bool temp, std::string& outImagePath, std::string& errInfo); - // 颜色识别 - //int LocalImageColorRecognition(const std::string& imagePath, bool temp, std::string& outImagePath, std::string& errInfo); - // 除色散 - //int LocalImageDispersion(const std::string& imagePath, bool temp, std::string& outImagePath, std::string& errInfo); - // 去底色 - //int LocalImageFadeBkColor(const std::string& imagePath, bool temp, std::string& outImagePath, std::string& errInfo); - // 图像滤镜 - //int LocalImageFilter(const std::string& imagePath, const std::string& type, bool temp, std::string& outImagePath, std::string& errInfo); - // 除穿孔 - //int LocalImageOutHole(const std::string& imagePath1, const std::string& imagePath2, double borderSize, - // bool temp, std::string& outImagePath1, std::string& outImagePath2, std::string& errInfo); - // 色彩校正 - //int ImageHSVCorrect(const std::string& imagePath, const std::string& option, bool cvtGray, const std::string& color, - // bool temp, std::string& outImagePath, std::string& errInfo); // 设备初始化 int InitDevice(std::string& errInfo); diff --git a/test/webservice/demo.html b/test/webservice/demo.html index 86f974d7..267b416b 100644 --- a/test/webservice/demo.html +++ b/test/webservice/demo.html @@ -348,13 +348,15 @@ })); } - function UploadLocalFile() + function FtpUpload() { socket.send(JSON.stringify({ 'func':'upload_local_file', 'file_path':'D:\\1.jpg', + 'remote_file_path':'/savedir/123.jpg', 'upload_mode':'ftp', - 'remote_file_path':'/savedir/123.jpg' + 'ftp_host':'192.168.100.148', + 'ftp_port':21 })); } @@ -832,7 +834,7 @@ - +