respgetfhymtask.cpp 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  1. #include "respgetfhymtask.h"
  2. #include <QScriptValue>
  3. #include <QScriptEngine>
  4. #include <QScriptValueIterator>
  5. RespGetFhymTask::RespGetFhymTask(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("feecount",sv1.property("fee_count").toString());
  56. map.insert("createtime",sv1.property("create_time").toString());
  57. map.insert("finishtime",sv1.property("finish_time").toString());
  58. map.insert("state",sv1.property("state").toString());
  59. map.insert("statestr",sv1.property("statestr").toString());
  60. map.insert("price",sv1.property("price").toString());
  61. map.insert("duefee",sv1.property("duefee").toString());
  62. if(sv1.property("settlefee").toString()=="null")
  63. map.insert("settlefee","");
  64. else
  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. }
  69. }
  70. }
  71. else
  72. {
  73. /*
  74. QScriptValue sv1 = it.value();
  75. if (sv1.property("taskid").toInt32() > 0)
  76. {
  77. map.insert("serialnum",sv1.property("serialnum").toString());
  78. map.insert("taskid",sv1.property("taskid").toString());
  79. map.insert("usercode",sv1.property("usercode").toString());
  80. map.insert("pnumfiletype",sv1.property("pnumfiletype").toString());
  81. map.insert("origfilename",sv1.property("origfilename").toString());
  82. map.insert("hmzs",sv1.property("hmzs").toString());
  83. map.insert("feecount",sv1.property("fee_count").toString());
  84. map.insert("createtime",sv1.property("create_time").toString());
  85. map.insert("finishtime",sv1.property("finish_time").toString());
  86. map.insert("state",sv1.property("state").toString());
  87. map.insert("statestr",sv1.property("statestr").toString());
  88. map.insert("price",sv1.property("price").toString());
  89. map.insert("duefee",sv1.property("duefee").toString());
  90. if(sv1.property("settlefee").toString()=="null")
  91. map.insert("settlefee","");
  92. else
  93. map.insert("settlefee",sv1.property("settlefee").toString());
  94. map.insert("giftfee",sv1.property("giftfee").toString());
  95. map.insert("memo",sv1.property("memo").toString());
  96. }
  97. */
  98. }
  99. }
  100. }
  101. }
  102. int RespGetFhymTask::getRtnCode()
  103. {
  104. return this->rtnCode;
  105. }
  106. QString RespGetFhymTask::getRtnMemo()
  107. {
  108. return this->rtnMemo;
  109. }
  110. int RespGetFhymTask::getRsCount()
  111. {
  112. return this->rsCount;
  113. }
  114. QMultiMap<QString,QString> RespGetFhymTask::getRs()
  115. {
  116. return this->map;
  117. }