| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182 |
- #include "respgetuserblance.h"
- #include <QScriptValue>
- #include <QScriptEngine>
- #include <QScriptValueIterator>
- RespGetUserBlance::RespGetUserBlance(QString json)
- {
- this->json = json;
- QScriptEngine engine;
- QScriptValue sv = engine.evaluate("value = " + this->json);
- QScriptValueIterator it(sv);
- if(json.isEmpty())
- {
- rtnCode = RTNCODE_NETWORK_NOTAVAILABLE;
- rtnMemo = RTNMEMO_NETWORK_NOTAVAILABLE;
- }
- else if(json=="ABORT")
- {
- rtnCode = RTNCODE_NETWORK_ABORT;
- rtnMemo = RTNMEMO_NETWORK_ABORT;
- }
- else
- {
- rtnCode = RTNCODE_INVALID_FORMAT;
- rtnMemo = RTNMEMO_INVALID_FORMAT;
- while (it.hasNext())
- {
- it.next();
- if(it.name()=="rtnCode")
- {
- this->rtnCode = it.value().toInt32();
- }
- else if(it.name()=="rtnMemo")
- {
- this->rtnMemo = it.value().toString();
- }
- else if(it.name()=="remainmoney")
- {
- this->blance = it.value().toString();
- }
- else if(it.name()=="giftmoney")
- {
- this->giftMoney = it.value().toString();
- }
- else if(it.name()=="topaymoney")
- {
- this->toPayMoney = it.value().toString();
- }
- else if(it.name()=="validnum")
- {
- this->validNum = it.value().toString();
- }
- }
- }
- }
- int RespGetUserBlance::getRtnCode()
- {
- return this->rtnCode;
- }
- QString RespGetUserBlance::getRtnMemo()
- {
- return this->rtnMemo;
- }
- QString RespGetUserBlance::getBlance()
- {
- return this->blance;
- }
- QString RespGetUserBlance::getGiftMoney()
- {
- return this->giftMoney;
- }
- QString RespGetUserBlance::getToPayMoney()
- {
- return this->toPayMoney;
- }
- QString RespGetUserBlance::getValidNum()
- {
- return this->validNum;
- }
|