respgetsysparam.cpp 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. #include "respgetsysparam.h"
  2. #include <QScriptValue>
  3. #include <QScriptEngine>
  4. #include <QScriptValueIterator>
  5. RespGetSysParam::RespGetSysParam(QString json)
  6. {
  7. this->json = json;
  8. QScriptEngine engine;
  9. QScriptValue sv = engine.evaluate("value = " + this->json);
  10. QScriptValueIterator it(sv);
  11. if(json.isEmpty())
  12. {
  13. rtnCode = RTNCODE_NETWORK_NOTAVAILABLE;
  14. rtnMemo = RTNMEMO_NETWORK_NOTAVAILABLE;
  15. }
  16. else if(json=="ABORT")
  17. {
  18. rtnCode = RTNCODE_NETWORK_ABORT;
  19. rtnMemo = RTNMEMO_NETWORK_ABORT;
  20. }
  21. else
  22. {
  23. rtnCode = RTNCODE_INVALID_FORMAT;
  24. rtnMemo = RTNMEMO_INVALID_FORMAT;
  25. while (it.hasNext())
  26. {
  27. it.next();
  28. if(it.name()=="rtnCode")
  29. {
  30. this->rtnCode = it.value().toInt32();
  31. }
  32. else if(it.name()=="rtnMemo")
  33. {
  34. this->rtnMemo = it.value().toString();
  35. }
  36. else if(it.name()=="rsCount")
  37. {
  38. this->rsCount = it.value().toInt32();
  39. }
  40. else if(it.name()=="srvStatus")
  41. {
  42. this->map.insert("srvStatus",it.value().toString());
  43. }
  44. else if(it.name()=="srvPushStartInfo")
  45. {
  46. this->map.insert("srvPushStartInfo",it.value().toString());
  47. }
  48. else if(it.name()=="srvPushPayInfo")
  49. {
  50. this->map.insert("srvPushPayInfo",it.value().toString());
  51. }
  52. else if(it.name()=="srvPushTrsfInfo")
  53. {
  54. this->map.insert("srvPushTrsfInfo",it.value().toString());
  55. }
  56. else if(it.name()=="forceLogOn")
  57. {
  58. this->map.insert("forceLogOn",it.value().toString());
  59. }
  60. else if(it.name()=="minClientVer")
  61. {
  62. this->map.insert("minClientVer",it.value().toString());
  63. }
  64. else if(it.name()=="heartBeatTime")
  65. {
  66. this->map.insert("heartBeatTime",it.value().toString());
  67. }
  68. else if(it.name()=="usrPayCtrl")
  69. {
  70. this->map.insert("usrPayCtrl",it.value().toString());
  71. }
  72. else if(it.name()=="usrPayUrl")
  73. {
  74. this->map.insert("usrPayUrl",it.value().toString());
  75. }
  76. else if(it.name()=="usrtrsfCtrl")
  77. {
  78. this->map.insert("usrtrsfCtrl",it.value().toString());
  79. }
  80. }
  81. }
  82. }
  83. int RespGetSysParam::getRtnCode()
  84. {
  85. return this->rtnCode;
  86. }
  87. QString RespGetSysParam::getRtnMemo()
  88. {
  89. return this->rtnMemo;
  90. }
  91. int RespGetSysParam::getRsCount()
  92. {
  93. return this->rsCount;
  94. }
  95. QMap<QString,QString> RespGetSysParam::getRs()
  96. {
  97. return this->map;
  98. }