respdljsjcresultfile.cpp 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. #include "respdljsjcresultfile.h"
  2. #include <QScriptValue>
  3. #include <QScriptEngine>
  4. #include <QScriptValueIterator>
  5. RespDlJSJCresultFile::RespDlJSJCresultFile(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()=="fileName")
  37. {
  38. this->fileName = it.value().toString();
  39. }
  40. else if(it.name()=="fileContent")
  41. {
  42. this->fileContent = it.value().toString();
  43. }
  44. else if(it.name()=="fcEncodeType")
  45. {
  46. this->fcEncodeType = it.value().toString();
  47. }
  48. }
  49. }
  50. }
  51. int RespDlJSJCresultFile::getRtnCode()
  52. {
  53. return this->rtnCode;
  54. }
  55. QString RespDlJSJCresultFile::getRtnMemo()
  56. {
  57. return this->rtnMemo;
  58. }
  59. QString RespDlJSJCresultFile::getFileName()
  60. {
  61. return this->fileName;
  62. }
  63. QString RespDlJSJCresultFile::getFileContent()
  64. {
  65. return this->fileContent;
  66. }
  67. QString RespDlJSJCresultFile::getFcEncodeType()
  68. {
  69. return this->fcEncodeType;
  70. }