SPAServer.cpp 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. #include "SPAServer.h"
  2. #include "spdlog/spdlog.h"
  3. #include "CurlHttp.h"
  4. #include <filesystem>
  5. #include "CurlFtp.h"
  6. SPAServer::SPAServer()
  7. {
  8. m_logger = spdlog::get("SPAServer");
  9. if(m_logger == nullptr)
  10. {
  11. SPDLOG_ERROR("APAServer logger is nullptr");
  12. return;
  13. }
  14. // m_fromSuperBrain.getToken();
  15. // // m_fromSuperBrain.getTaskTypeList();
  16. // m_fromRedis.setRedisIPAndPort("172.16.36.80", 32222);
  17. // m_fromRedis.setRedisPassword("Ff1z@TOFr^iwd%Ra");
  18. // m_fromRedis.connectRedis();
  19. // std::string value;
  20. // m_fromRedis.getRedisString("113:P100104000", value);
  21. // SPDLOG_LOGGER_INFO(m_logger, "{}", value);
  22. // m_fromRedis.disConnectRedis();
  23. //|FTP|192.1.2.178:32021|lh|DWw7V9u0|
  24. CurlFtp ftp;
  25. ftp.setFtpIPAndPort("192.1.2.178", 32021);
  26. ftp.setFtpUsernameAndPassword("lh", "DWw7V9u0");
  27. std::string ftpPath = "lh";
  28. std::vector<std::string> vecFile;
  29. std::vector<std::string> vecDir;
  30. ftp.getFileList(ftpPath, vecFile);
  31. ftp.getDirList(ftpPath, vecDir);
  32. for(auto& file : vecFile)
  33. {
  34. SPDLOG_LOGGER_INFO(m_logger, "{}", file);
  35. }
  36. for(auto& dir : vecDir)
  37. {
  38. SPDLOG_LOGGER_INFO(m_logger, "{}", dir);
  39. }
  40. if(ftp.isDirExist(ftpPath))
  41. {
  42. SPDLOG_LOGGER_INFO(m_logger, "文件夹存在");
  43. }
  44. else
  45. {
  46. SPDLOG_LOGGER_INFO(m_logger, "文件夹不存在");
  47. }
  48. }
  49. SPAServer::~SPAServer()
  50. {
  51. }