respgetmf2sysparam.cpp 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. #include "respgetmf2sysparam.h"
  2. #include <QScriptValue>
  3. #include <QScriptEngine>
  4. #include <QScriptValueIterator>
  5. RespGetMf2SysParam::RespGetMf2SysParam(QString json)
  6. {
  7. this->json = json;
  8. QScriptEngine engine;
  9. QScriptValue sv = engine.evaluate("value = " + this->json);
  10. QScriptValueIterator it(sv);
  11. this->rsCount = 0;
  12. if(json.isEmpty())
  13. {
  14. rtnCode = RTNCODE_NETWORK_NOTAVAILABLE;
  15. rtnMemo = RTNMEMO_NETWORK_NOTAVAILABLE;
  16. }
  17. else if(json=="ABORT")
  18. {
  19. rtnCode = RTNCODE_NETWORK_ABORT;
  20. rtnMemo = RTNMEMO_NETWORK_ABORT;
  21. }
  22. else
  23. {
  24. rtnCode = RTNCODE_INVALID_FORMAT;
  25. rtnMemo = RTNMEMO_INVALID_FORMAT;
  26. while (it.hasNext())
  27. {
  28. it.next();
  29. if(it.name()=="rtnCode")
  30. {
  31. this->rtnCode = it.value().toInt32();
  32. }
  33. else if(it.name()=="rtnMemo")
  34. {
  35. this->rtnMemo = it.value().toString();
  36. }
  37. else if(it.name()=="ShkjPnumMinSize")
  38. {
  39. this->map.insert("ShkjPnumMinSize",it.value().toString());
  40. }
  41. else if(it.name()=="ShkjPnumMaxSize")
  42. {
  43. this->map.insert("ShkjPnumMaxSize",it.value().toString());
  44. }
  45. else if(it.name()=="ZxshPnumMaxSize")
  46. {
  47. this->map.insert("ZxshPnumMaxSize",it.value().toString());
  48. }
  49. else if(it.name()=="srvStatus")
  50. {
  51. this->map.insert("srvStatus",it.value().toString());
  52. }
  53. }
  54. }
  55. }
  56. int RespGetMf2SysParam::getRtnCode()
  57. {
  58. return this->rtnCode;
  59. }
  60. QString RespGetMf2SysParam::getRtnMemo()
  61. {
  62. return this->rtnMemo;
  63. }
  64. int RespGetMf2SysParam::getRsCount()
  65. {
  66. return this->rsCount;
  67. }
  68. QMap<QString,QString> RespGetMf2SysParam::getRs()
  69. {
  70. return this->map;
  71. }