respgetuserinfo.cpp 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148
  1. #include "respgetuserinfo.h"
  2. #include <QScriptValue>
  3. #include <QScriptEngine>
  4. #include <QScriptValueIterator>
  5. RespGetUserInfo::RespGetUserInfo(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()=="userInfo")
  37. {
  38. QScriptValue sv1 = it.value();
  39. this->userid = sv1.property("userid").toString();
  40. this->usercode =sv1.property("usercode").toString();
  41. this->username =sv1.property("username").toString();
  42. this->qq =sv1.property("qq").toString();
  43. this->wangwang =sv1.property("wangwang").toString();
  44. this->email =sv1.property("email").toString();
  45. this->phone =sv1.property("phone").toString();
  46. this->paytype =sv1.property("paytype").toString();
  47. this->remainmoney =sv1.property("remainmoney").toString();
  48. this->summoney =sv1.property("summoney").toString();
  49. this->regdate =sv1.property("regdate").toString();
  50. this->lastlogintime =sv1.property("lastlogintime").toString();
  51. this->lastloginip =sv1.property("lastloginip").toString();
  52. this->lastloginstatus =sv1.property("lastloginstatus").toString();
  53. this->memo =sv1.property("memo").toString();
  54. this->giftMoney = it.value().property("giftmoney").toString();
  55. this->sumGiftMoney = it.value().property("sumgiftmoney").toString();
  56. this->toPayMoney = it.value().property("topaymoney").toString();
  57. this->validNum = it.value().property("validnum").toString();
  58. }
  59. }
  60. }
  61. }
  62. int RespGetUserInfo::getRtnCode()
  63. {
  64. return this->rtnCode;
  65. }
  66. QString RespGetUserInfo::getRtnMemo()
  67. {
  68. return this->rtnMemo;
  69. }
  70. QString RespGetUserInfo::getUserID()
  71. {
  72. return this->userid;
  73. }
  74. QString RespGetUserInfo::getUserCode()
  75. {
  76. return this->usercode;
  77. }
  78. QString RespGetUserInfo::getUserName()
  79. {
  80. return this->username;
  81. }
  82. QString RespGetUserInfo::getUserQQ()
  83. {
  84. return this->qq;
  85. }
  86. QString RespGetUserInfo::getUserWW()
  87. {
  88. return this->wangwang;
  89. }
  90. QString RespGetUserInfo::getUserEmail()
  91. {
  92. return this->email;
  93. }
  94. QString RespGetUserInfo::getUserPhone()
  95. {
  96. return this->phone;
  97. }
  98. QString RespGetUserInfo::getUserPayType()
  99. {
  100. return this->paytype;
  101. }
  102. QString RespGetUserInfo::getUserRemainMoney()
  103. {
  104. return this->remainmoney;
  105. }
  106. QString RespGetUserInfo::getUserSumMoney()
  107. {
  108. return this->summoney;
  109. }
  110. QString RespGetUserInfo::getUserRegDate()
  111. {
  112. return this->regdate;
  113. }
  114. QString RespGetUserInfo::getUserLastLoginTime()
  115. {
  116. return this->lastlogintime;
  117. }
  118. QString RespGetUserInfo::getUserLastLoginIP()
  119. {
  120. return this->lastloginip;
  121. }
  122. QString RespGetUserInfo::getUserLoginStatus()
  123. {
  124. return this->lastloginstatus;
  125. }
  126. QString RespGetUserInfo::getUserMemo()
  127. {
  128. return this->memo;
  129. }
  130. QString RespGetUserInfo::getUserSumGiftMoney()
  131. {
  132. return this->sumGiftMoney;
  133. }
  134. QString RespGetUserInfo::getUserToPayMoney()
  135. {
  136. return this->toPayMoney;
  137. }
  138. QString RespGetUserInfo::getValidNum()
  139. {
  140. return this->validNum;
  141. }
  142. QString RespGetUserInfo::getUserGiftMoney()
  143. {
  144. return this->giftMoney;
  145. }