respchkuserfeestatus.cpp 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. #include "respchkuserfeestatus.h"
  2. #include <QScriptValue>
  3. #include <QScriptEngine>
  4. #include <QScriptValueIterator>
  5. RespChkUserFeeStatus::RespChkUserFeeStatus(QString json)
  6. {
  7. this->json = json;
  8. QScriptEngine engine;
  9. QScriptValue sv = engine.evaluate("value = " + this->json);
  10. QScriptValueIterator it(sv);
  11. this->rtnMemo = "";
  12. if(json.isEmpty())
  13. {
  14. rtnCode = RTNCODE_NETWORK_NOTAVAILABLE;
  15. rtnMemo = RTNMEMO_NETWORK_NOTAVAILABLE;
  16. }
  17. else if(json=="ABORT")
  18. {
  19. rtnCode = RTNCODE_NETWORK_ABORT;
  20. rtnMemo = RTNMEMO_NETWORK_ABORT;
  21. }
  22. else
  23. {
  24. rtnCode = RTNCODE_INVALID_FORMAT;
  25. rtnMemo = RTNMEMO_INVALID_FORMAT;
  26. while (it.hasNext())
  27. {
  28. it.next();
  29. if(it.name()=="rtnCode")
  30. {
  31. this->rtnCode = it.value().toInt32();
  32. }
  33. else if(it.name()=="rtnMemo")
  34. {
  35. this->rtnMemo = it.value().toString();
  36. }
  37. }
  38. }
  39. }
  40. int RespChkUserFeeStatus::getRtnCode()
  41. {
  42. return this->rtnCode;
  43. }
  44. QString RespChkUserFeeStatus::getRtnMemo()
  45. {
  46. return this->rtnMemo;
  47. }