respgettransferinfo.cpp 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. #include "respgettransferinfo.h"
  2. #include <QScriptValue>
  3. #include <QScriptEngine>
  4. #include <QScriptValueIterator>
  5. RespGetTransferInfo::RespGetTransferInfo(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()=="sum_trsfmoney")
  41. {
  42. this->sumTransferMoney = it.value().toString();
  43. }
  44. else
  45. {
  46. QScriptValue sv1 = it.value();
  47. map.insert("serialnum",sv1.property("serialnum").toString());
  48. map.insert("trsfid",sv1.property("trsfid").toString());
  49. map.insert("sndsysname",sv1.property("sndsysname").toString());
  50. map.insert("rcvsysname",sv1.property("rcvsysname").toString());
  51. map.insert("trsfmoney",sv1.property("trsfmoney").toString());
  52. map.insert("trsftime",sv1.property("trsftime").toString());
  53. map.insert("trsftype",sv1.property("trsftype").toString());
  54. map.insert("trsfmemo",sv1.property("trsfmemo").toString());
  55. }
  56. }
  57. }
  58. }
  59. int RespGetTransferInfo::getRtnCode()
  60. {
  61. return this->rtnCode;
  62. }
  63. QString RespGetTransferInfo::getRtnMemo()
  64. {
  65. return this->rtnMemo;
  66. }
  67. QString RespGetTransferInfo::getSumTransferMoney()
  68. {
  69. return this->sumTransferMoney;
  70. }
  71. int RespGetTransferInfo::getRsCount()
  72. {
  73. return this->rsCount;
  74. }
  75. QMultiMap<QString,QString> RespGetTransferInfo::getRs()
  76. {
  77. return this->map;
  78. }