1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465 |
- #include "SPAServer.h"
- #include "spdlog/spdlog.h"
- #include "CurlHttp.h"
- #include <filesystem>
- #include "CurlFtp.h"
- SPAServer::SPAServer()
- {
- m_logger = spdlog::get("SPAServer");
- if(m_logger == nullptr)
- {
- SPDLOG_ERROR("APAServer logger is nullptr");
- return;
- }
- // m_fromSuperBrain.getToken();
- // // m_fromSuperBrain.getTaskTypeList();
- // m_fromRedis.setRedisIPAndPort("172.16.36.80", 32222);
- // m_fromRedis.setRedisPassword("Ff1z@TOFr^iwd%Ra");
- // m_fromRedis.connectRedis();
- // std::string value;
- // m_fromRedis.getRedisString("113:P100104000", value);
- // SPDLOG_LOGGER_INFO(m_logger, "{}", value);
- // m_fromRedis.disConnectRedis();
- //|FTP|192.1.2.178:32021|lh|DWw7V9u0|
- CurlFtp ftp;
- ftp.setFtpIPAndPort("192.1.2.178", 32021);
- ftp.setFtpUsernameAndPassword("lh", "DWw7V9u0");
- std::string ftpPath = "lh";
- std::vector<std::string> vecFile;
- std::vector<std::string> vecDir;
- ftp.getFileList(ftpPath, vecFile);
- ftp.getDirList(ftpPath, vecDir);
- for(auto& file : vecFile)
- {
- SPDLOG_LOGGER_INFO(m_logger, "{}", file);
- }
- for(auto& dir : vecDir)
- {
- SPDLOG_LOGGER_INFO(m_logger, "{}", dir);
- }
- if(ftp.isDirExist(ftpPath))
- {
- SPDLOG_LOGGER_INFO(m_logger, "文件夹存在");
- }
- else
- {
- SPDLOG_LOGGER_INFO(m_logger, "文件夹不存在");
- }
- }
- SPAServer::~SPAServer()
- {
- }
|