respgetmfpayinfo.cpp 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. #include "respgetmfpayinfo.h"
  2. #include <QScriptValue>
  3. #include <QScriptEngine>
  4. #include <QScriptValueIterator>
  5. RespGetMfPayInfo::RespGetMfPayInfo(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("payid",sv1.property("payid").toString());
  45. map.insert("usercode",sv1.property("usercode").toString());
  46. map.insert("paymoney",sv1.property("paymoney").toString());
  47. map.insert("starttime",sv1.property("starttime").toString());
  48. map.insert("endtime",sv1.property("endtime").toString());
  49. map.insert("paytime",sv1.property("paytime").toString());
  50. map.insert("payfunc",sv1.property("payfunc").toString());
  51. map.insert("memo",sv1.property("memo").toString());
  52. }
  53. }
  54. }
  55. }
  56. int RespGetMfPayInfo::getRtnCode()
  57. {
  58. return this->rtnCode;
  59. }
  60. QString RespGetMfPayInfo::getRtnMemo()
  61. {
  62. return this->rtnMemo;
  63. }
  64. int RespGetMfPayInfo::getRsCount()
  65. {
  66. return this->rsCount;
  67. }
  68. QMultiMap<QString,QString> RespGetMfPayInfo::getRs()
  69. {
  70. return this->map;
  71. }