api_comm.h 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. #ifndef MICROSERVICES_API_COMM_HEADER_
  2. #define MICROSERVICES_API_COMM_HEADER_
  3. #define HEADOFFICE_MICROSERVICES_URL_DEV "https://rvcgateway.paas.cmbchina.cn"
  4. #define HEADOFFICE_MICROSERVICES_URL_ST "https://rvcgateway.paasst.cmbchina.cn"
  5. #define HEADOFFICE_MICROSERVICES_URL_UAT "https://rvcgateway.paasuat.cmbchina.cn"
  6. #define HEADOFFICE_MICROSERVICES_URL_PRD "https://rvcgateway.paas.cmbchina.cn"
  7. #define HEADOFFICE_MICROSERVICES_CENTERCONFIG_URL_ST "http://centerconfig.paasst.cmbchina.cn"
  8. #define HEADOFFICE_MICROSERVICES_GRAYLAUNCH_URL_ST "https://rvcgray.paasst.cmbchina.cn"
  9. #define URLPATH_TERMINAL_REGISTER_INFO "/terminal/api/manage/regist/"
  10. #define URLPATH_GRAY_CHECK "/api/gray/way/"
  11. #define URLPATH_CENTERSETTING_UPDATE_CONFIG "/api/terminal/center/config"
  12. #define URLPATH_DEVICECONTROL_LOGIN "/api/login/sign/"
  13. #define URLPATH_REGISTER_FULL_LIST "/terminal/api/manage/regist/full/list"
  14. #define URLPATH_MANUFACTURE_GET_ALL "/terminal/api/v1/manufacture/getAll"
  15. namespace MicroServices
  16. {
  17. namespace API
  18. {
  19. struct CommResponse
  20. {
  21. bool success;
  22. std::string errorCode;
  23. std::string returnCode;
  24. std::string errorMsg;
  25. std::string message;
  26. virtual bool IsOperatedOK() const
  27. {
  28. return (returnCode == "SUC0000" || errorCode == "0"/*ACS_SUCCESS*/);
  29. }
  30. virtual bool IsNotEmpty() const
  31. {
  32. return (!errorCode.empty() || !returnCode.empty() || !errorMsg.empty() || !message.empty());
  33. }
  34. virtual std::string WhatError() const
  35. {
  36. std::string result("");
  37. if (!returnCode.empty()) {
  38. result += "[";
  39. result += returnCode;
  40. result += "]";
  41. }
  42. if (!errorCode.empty()) {
  43. result += "[";
  44. result += errorCode;
  45. result += "]";
  46. }
  47. if (!message.empty()) {
  48. result += " ";
  49. result += message;
  50. }
  51. if (!errorMsg.empty()) {
  52. result += " ";
  53. result += errorMsg;
  54. }
  55. return result;
  56. }
  57. };
  58. struct GrayResponseJson : public CommResponse
  59. {
  60. bool graySwitch;
  61. virtual bool IsOperatedOK() const
  62. {
  63. return (errorCode == "10000");
  64. }
  65. };
  66. }
  67. }
  68. #endif //MICROSERVICES_API_COMM_HEADER_