respgetdealinfo.cpp 2.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. #include "respgetdealinfo.h"
  2. #include <QScriptValue>
  3. #include <QScriptEngine>
  4. #include <QScriptValueIterator>
  5. RespGetDealInfo::RespGetDealInfo(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
  41. {
  42. QScriptValue sv1 = it.value();
  43. map.insert("serialnum",sv1.property("serialnum").toString());
  44. map.insert("batchid",sv1.property("batchid").toString());
  45. map.insert("batchtype",sv1.property("batchtype").toString());
  46. map.insert("detail",sv1.property("detail").toString());
  47. map.insert("resulttj",sv1.property("resulttj").toString());
  48. map.insert("usercode",sv1.property("usercode").toString());
  49. map.insert("submittime",sv1.property("submittime").toString());
  50. map.insert("tftime",sv1.property("tftime").toString());
  51. map.insert("vftime",sv1.property("vftime").toString());
  52. map.insert("isverify",sv1.property("isverify").toString());
  53. if(sv1.property("settlefee").toString()=="null")
  54. map.insert("settlefee","");
  55. else
  56. map.insert("settlefee",sv1.property("settlefee").toString());
  57. map.insert("giftfee",sv1.property("giftfee").toString());
  58. map.insert("numcount",sv1.property("numcount").toString());
  59. map.insert("dlcount",sv1.property("dlcount").toString());
  60. map.insert("finishcount",sv1.property("finishcount").toString());
  61. map.insert("optstatus",sv1.property("optstatus").toString());
  62. }
  63. }
  64. }
  65. }
  66. int RespGetDealInfo::getRtnCode()
  67. {
  68. return this->rtnCode;
  69. }
  70. QString RespGetDealInfo::getRtnMemo()
  71. {
  72. return this->rtnMemo;
  73. }
  74. int RespGetDealInfo::getRsCount()
  75. {
  76. return this->rsCount;
  77. }
  78. QMultiMap<QString,QString> RespGetDealInfo::getRs()
  79. {
  80. return this->map;
  81. }