respssologin.cpp 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  1. #include "respssologin.h"
  2. #include <QScriptValue>
  3. #include <QScriptEngine>
  4. #include <QScriptValueIterator>
  5. RespSSOLogin::RespSSOLogin(QString json)
  6. {
  7. this->json = json;
  8. QScriptEngine engine;
  9. QScriptValue sv = engine.evaluate("value = " + this->json);
  10. QScriptValueIterator it(sv);
  11. this->userHash = "";
  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()=="userHash")
  34. {
  35. this->userHash = it.value().toString();
  36. }
  37. else if(it.name()=="rtnMemo")
  38. {
  39. this->rtnMemo = it.value().toString();
  40. }
  41. else
  42. {
  43. this->userID = it.value().property("userid").toString();
  44. this->userCode = it.value().property("usercode").toString();
  45. this->userName = it.value().property("username").toString();
  46. this->lastLoginTime = it.value().property("lastlogintime").toString();
  47. this->lastlLoginIp = it.value().property("lastloginip").toString();
  48. this->startTime = it.value().property("starttime").toString();
  49. this->endTime = it.value().property("endtime").toString();
  50. this->remainMoney = it.value().property("remainmoney").toString();
  51. this->sumMoney = it.value().property("summoney").toString();
  52. this->giftMoney = it.value().property("giftmoney").toString();
  53. this->sumGiftMoney = it.value().property("sumgiftmoney").toString();
  54. this->regType = it.value().property("regtype").toString();
  55. }
  56. }
  57. }
  58. }
  59. int RespSSOLogin::getRtnCode()
  60. {
  61. return this->rtnCode;
  62. }
  63. QString RespSSOLogin::getRtnMemo()
  64. {
  65. return this->rtnMemo;
  66. }
  67. QString RespSSOLogin::getUserHash()
  68. {
  69. return this->userHash;
  70. }
  71. QString RespSSOLogin::getUserID()
  72. {
  73. return this->userID;
  74. }
  75. QString RespSSOLogin::getUserCode()
  76. {
  77. return this->userCode;
  78. }
  79. QString RespSSOLogin::getUserName()
  80. {
  81. return this->userName;
  82. }
  83. QString RespSSOLogin::getUserStartTime()
  84. {
  85. return this->startTime;
  86. }
  87. QString RespSSOLogin::getUserEndTime()
  88. {
  89. return this->endTime;
  90. }
  91. QString RespSSOLogin::getUserLastLoginTime()
  92. {
  93. return this->lastLoginTime;
  94. }
  95. QString RespSSOLogin::getUserLastLoginIP()
  96. {
  97. return this->lastlLoginIp;
  98. }
  99. QString RespSSOLogin::getUserRemainMoney()
  100. {
  101. return this->remainMoney;
  102. }
  103. QString RespSSOLogin::getUserSumMoney()
  104. {
  105. return this->sumMoney;
  106. }
  107. QString RespSSOLogin::getUserSumGiftMoney()
  108. {
  109. return this->sumGiftMoney;
  110. }
  111. QString RespSSOLogin::getUserGiftMoney()
  112. {
  113. return this->giftMoney;
  114. }
  115. QString RespSSOLogin::getUserRegType()
  116. {
  117. return this->regType;
  118. }