respgetfhymht.cpp 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  1. #include "respgetfhymht.h"
  2. #include <QScriptValue>
  3. #include <QScriptEngine>
  4. #include <QScriptValueIterator>
  5. RespGetFhymHt::RespGetFhymHt(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()=="rs")
  41. {
  42. QScriptValueIterator it2(it.value());
  43. while(it2.hasNext()) {
  44. it2.next();
  45. if (it2.flags() & QScriptValue::SkipInEnumeration)
  46. continue;
  47. QScriptValue sv1 = it2.value();
  48. if (sv1.property("taskid").toInt32() > 0) {
  49. map.insert("serialnum",sv1.property("serialnum").toString());
  50. map.insert("taskid",sv1.property("taskid").toString());
  51. map.insert("usercode",sv1.property("usercode").toString());
  52. map.insert("pnumfiletype",sv1.property("pnumfiletype").toString());
  53. map.insert("origfilename",sv1.property("origfilename").toString());
  54. map.insert("hmzs",sv1.property("hmzs").toString());
  55. map.insert("zcsl",sv1.property("zcsl").toString());
  56. map.insert("ycsl",sv1.property("ycsl").toString());
  57. map.insert("wzsl",sv1.property("wzsl").toString());
  58. map.insert("feecount",sv1.property("fee_count").toString());
  59. map.insert("createtime",sv1.property("create_time").toString());
  60. map.insert("finishtime",sv1.property("finish_time").toString());
  61. map.insert("state",sv1.property("state").toString());
  62. map.insert("statestr",sv1.property("statestr").toString());
  63. map.insert("price",sv1.property("price").toString());
  64. map.insert("duefee",sv1.property("duefee").toString());
  65. map.insert("settlefee",sv1.property("settlefee").toString());
  66. map.insert("giftfee",sv1.property("giftfee").toString());
  67. map.insert("memo",sv1.property("memo").toString());
  68. map.insert("isdeliver",sv1.property("isdeliver").toString());
  69. map.insert("delivertime",sv1.property("delivertime").toString());
  70. }
  71. }
  72. }
  73. else
  74. {
  75. /*
  76. QScriptValue sv1 = it.value();
  77. if (sv1.property("taskid").toInt32() > 0)
  78. {
  79. map.insert("serialnum",sv1.property("serialnum").toString());
  80. map.insert("taskid",sv1.property("taskid").toString());
  81. map.insert("usercode",sv1.property("usercode").toString());
  82. map.insert("pnumfiletype",sv1.property("pnumfiletype").toString());
  83. map.insert("origfilename",sv1.property("origfilename").toString());
  84. map.insert("hmzs",sv1.property("hmzs").toString());
  85. map.insert("zcsl",sv1.property("zcsl").toString());
  86. map.insert("ycsl",sv1.property("ycsl").toString());
  87. map.insert("wzsl",sv1.property("wzsl").toString());
  88. map.insert("feecount",sv1.property("fee_count").toString());
  89. map.insert("createtime",sv1.property("create_time").toString());
  90. map.insert("finishtime",sv1.property("finish_time").toString());
  91. map.insert("state",sv1.property("state").toString());
  92. map.insert("statestr",sv1.property("statestr").toString());
  93. map.insert("price",sv1.property("price").toString());
  94. map.insert("duefee",sv1.property("duefee").toString());
  95. map.insert("settlefee",sv1.property("settlefee").toString());
  96. map.insert("giftfee",sv1.property("giftfee").toString());
  97. map.insert("memo",sv1.property("memo").toString());
  98. map.insert("isdeliver",sv1.property("isdeliver").toString());
  99. map.insert("delivertime",sv1.property("delivertime").toString());
  100. }*/
  101. }
  102. }
  103. }
  104. }
  105. int RespGetFhymHt::getRtnCode()
  106. {
  107. return this->rtnCode;
  108. }
  109. QString RespGetFhymHt::getRtnMemo()
  110. {
  111. return this->rtnMemo;
  112. }
  113. int RespGetFhymHt::getRsCount()
  114. {
  115. return this->rsCount;
  116. }
  117. QMultiMap<QString,QString> RespGetFhymHt::getRs()
  118. {
  119. return this->map;
  120. }