#include "respgetchargeinfo.h" #include #include #include RespGetChargeInfo::RespGetChargeInfo(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()=="rsCount") { this->rsCount = it.value().toInt32(); } else if(it.name()=="sum_chargemoney") { this->totalMoney = it.value().toInt32(); } else { QScriptValue sv1 = it.value(); map.insert("serialnum",sv1.property("serialnum").toString()); map.insert("chargeid",sv1.property("chargeid").toString()); // map.insert("batchtype",sv1.property("batchtype").toString()); map.insert("usercode",sv1.property("usercode").toString()); map.insert("premoney",sv1.property("premoney").toString()); map.insert("chargemoney",sv1.property("chargemoney").toString()); map.insert("aftermoney",sv1.property("aftermoney").toString()); map.insert("chargetime",sv1.property("chargetime").toString()); map.insert("memo",sv1.property("memo").toString()); map.insert("discountset",sv1.property("discountset").toString()); map.insert("pregiftmoney",sv1.property("pregiftmoney").toString()); map.insert("aftergiftmoney",sv1.property("aftergiftmoney").toString()); map.insert("giftmoney",sv1.property("giftmoney").toString()); } } } } int RespGetChargeInfo::getRtnCode() { return this->rtnCode; } QString RespGetChargeInfo::getRtnMemo() { return this->rtnMemo; } int RespGetChargeInfo::getRsCount() { return this->rsCount; } QMultiMap RespGetChargeInfo::getRs() { return this->map; }