Browse Source

V0.6.3
1、修改了CurlFtp

Apple 3 months ago
parent
commit
c814a91297
2 changed files with 9 additions and 12 deletions
  1. 4 0
      common/CurlFtp/CurlFtp.cpp
  2. 5 12
      common/CurlFtp/CurlFtp.h

+ 4 - 0
common/CurlFtp/CurlFtp.cpp

@@ -8,6 +8,10 @@
 // #include "fmtlog.h"
 #include "spdlog/spdlog.h"
 
+#ifndef SPDLOG_ACTIVE_LEVEL
+#define SPDLOG_ACTIVE_LEVEL SPDLOG_LEVEL_DEBUG
+#endif
+
 #if defined(_WIN32)
 
 #endif /* _WIN32 */

+ 5 - 12
common/CurlFtp/CurlFtp.h

@@ -10,13 +10,12 @@
 
 
 /**
- * 使用CURL进行FTP操作,这个类有两种方式,一种是直接使用静态方法,另一种是创建实例
- * 使用静态函数可以进行一些简单的操作,但是如果需要进行多次操作,最好创建实例
+ * 使用CURL进行FTP操作,这里是单线程的,需要多线程同时操作,就创建多个实例
  *
- *     1.默认超时时间是10s
+ *     1.默认超时时间是30s
  *     2.默认端口是21
  *     3.设置好IP和端口号后,后续输入的文件路径都是想对你路径,无需添加IP和端口号
- * 
+ *     4.使用ftp,用setFtpIPAndPort()设置IP和端口,使用sftp,用setSftpIPAndPort()设置IP和端口
  */
 
 
@@ -25,20 +24,14 @@ class CurlFtp
 public:
     CurlFtp();
     ~CurlFtp();
-    // /* 列出FTP文件夹 */
-    // static std::string listDir(const std::string &ftpUrl, const std::string &username, const std::string &password);
-    // /* 列出文件夹中的所有文件 */
-    // static bool listFiles(const std::string &ftpUrl, const std::string &username, const std::string &password, std::vector<std::string>& fileList);
-    // /* 创建文件夹 */
-    // static bool createDir(const std::string &ftpUrl, const std::string &username, const std::string &password, const std::string &dirName);
 
     /*********************** 成员函数 *********************/
     /* 设置用户名和密码 */
     bool setUsernameAndPassword(const std::string& username, const std::string& password);
     /* 设置IP和端口 */
-    bool setFtpIPAndPort(const std::string& IP, const int port);
+    bool setFtpIPAndPort(const std::string& IP, const int port = 21);
     /* 设置SFTP的IP和端口 */
-    bool setSftpIPAndPort(const std::string& IP, const int port);
+    bool setSftpIPAndPort(const std::string& IP, const int port = 22);
     /* 设置是否忽略SSL证书,使用SFTP不建议忽略 */
     void setIgnoreSSLCert(bool isIgnore);
     /* 设置CA证书文件 */