/** * 解析响应体 * * @param params */ private void parserResoponse(List<ProtocolData> params) { ResponseData response = new ResponseData(); LoginUtil.mLoginStatus.mResponseData = response; bankRecordDatas.clear(); for (ProtocolData data : params) { if (data.mKey.equals(ProtocolUtil.msgheader)) { ProtocolUtil.parserResponse(response, data); } else if (data.mKey.equals(ProtocolUtil.msgbody)) { List<ProtocolData> result1 = data.find("/result"); if (result1 != null) { LoginUtil.mLoginStatus.result = result1.get(0).mValue; } List<ProtocolData> message = data.find("/message"); if (message != null) { LoginUtil.mLoginStatus.message = message.get(0).mValue; } List<ProtocolData> aupic = data.find("/msgchild"); if (aupic != null) for (ProtocolData child : aupic) { BankRecordData picData = new BankRecordData(); if (child.mChildren != null && child.mChildren.size() > 0) { Set<String> keys = child.mChildren.keySet(); for (String key : keys) { List<ProtocolData> rs = child.mChildren.get(key); for (ProtocolData item : rs) { if (item.mKey.equals("shoucardid")) { picData.shoucardid = item.mValue; } else if (item.mKey.equals("shoucardno")) { picData.shoucardno = item.mValue; } else if (item.mKey.equals("shoucardbank")) { picData.shoucardbank = item.mValue; } else if (item.mKey.equals("shoucardman")) { picData.shoucardman = item.mValue; } else if (item.mKey.equals("shoucardmobile")) { picData.shoucardmobile = item.mValue; } else if (item.mKey.equals("paytype")) { picData.paytype = item.mValue; } else if (item.mKey.equals("bankid")) { picData.bankid = item.mValue; } } } } bankRecordDatas.add(picData); } } } }
/** * 请求修改身份信息 * * @return */ private List<ProtocolData> getRequestDatas() { CommonData data = new CommonData(); // data.putValue("authorid", LoginUtil.mLoginStatus.authorid); data.putValue("paytype", mType); List<ProtocolData> mDatas = ProtocolUtil.getRequestDatas("ApiPayinfo", "readshoucardList", data); return mDatas; }
private void parserResponse(List<ProtocolData> mDatas) { ResponseData response = new ResponseData(); LoginUtil.mLoginStatus.mResponseData = response; for (ProtocolData data : mDatas) { if (data.mKey.equals(ProtocolUtil.msgheader)) { ProtocolUtil.parserResponse(response, data); } else if (data.mKey.equals(ProtocolUtil.msgbody)) { List<ProtocolData> result = data.find("/result"); if (result != null) { LoginUtil.mLoginStatus.result = result.get(0).getmValue(); } List<ProtocolData> message = data.find("/message"); if (result != null) { LoginUtil.mLoginStatus.message = message.get(0).getmValue(); } List<ProtocolData> authorid = data.find("/authorid"); if (authorid != null) { LoginUtil.mLoginStatus.authorid = authorid.get(0).mValue; } List<ProtocolData> aupic = data.find("/msgchild"); if (aupic != null) for (ProtocolData child : aupic) { PwdSafetyValidateUserData picData = new PwdSafetyValidateUserData(); if (child.mChildren != null && child.mChildren.size() > 0) { Set<String> keys = child.mChildren.keySet(); for (String key : keys) { List<ProtocolData> rs = child.mChildren.get(key); for (ProtocolData item : rs) { if (item.mKey.equals("que")) { picData.que = item.mValue; } else if (item.mKey.equals("answer")) { picData.answer = item.mValue; } } } } mList.add(picData); } } } }
@Override protected Boolean doInBackground(String... params) { // TODO Auto-generated method stub try { // String phonenumber=PreferenceConfig.instance(activity).getString(Constants.USER_NAME, // ""); CommonData mData = new CommonData(); mData.putValue("phonenumber", phonenumber); List<ProtocolData> mDatas = ProtocolUtil.getRequestDatas("ApiSafeGuard", "validateUser", mData); PwdSafetyValidateUserParser pwdSafetyValidateUserParser = new PwdSafetyValidateUserParser(); mRsp = HttpUtil.doRequest(pwdSafetyValidateUserParser, mDatas); } catch (Exception e) { // TODO: handle exception e.printStackTrace(); mRsp = null; } return null; }