packagecom.duben.supertheateru.mvp.model;importandroid.text.TextUtils;importjava.io.Serializable;importjava.util.Map;publicclassAuthResultimplementsSerializable{privateStringresultStatus;privateStringresult;privateStringmemo;privateStringresultCode;privateStringauthCode;privateStringalipayOpenId;publicAuthResult(Map<String,String>rawResult,booleanremoveBrackets){if(rawResult==null){return;}for(Stringkey:rawResult.keySet()){if(TextUtils.equals(key,"resultStatus")){resultStatus=rawResult.get(key);}elseif(TextUtils.equals(key,"result")){result=rawResult.get(key);}elseif(TextUtils.equals(key,"memo")){memo=rawResult.get(key);}}String[]resultValue=result.split("&");for(Stringvalue:resultValue){if(value.startsWith("alipay_open_id")){alipayOpenId=removeBrackets(getValue("alipay_open_id=",value),removeBrackets);continue;}if(value.startsWith("auth_code")){authCode=removeBrackets(getValue("auth_code=",value),removeBrackets);continue;}if(value.startsWith("result_code")){resultCode=removeBrackets(getValue("result_code=",value),removeBrackets);continue;}}}privateStringremoveBrackets(Stringstr,booleanremove){if(remove){if(!TextUtils.isEmpty(str)){if(str.startsWith("\"")){str=str.replaceFirst("\"","");}if(str.endsWith("\"")){str=str.substring(0,str.length()-1);}}}returnstr;}@OverridepublicStringtoString(){return"authCode={"+authCode+"}; resultStatus={"+resultStatus+"}; memo={"+memo+"}; result={"+result+"}";}privateStringgetValue(Stringheader,Stringdata){returndata.substring(header.length(),data.length());}/**
* @return the resultStatus
*/publicStringgetResultStatus(){returnresultStatus;}/**
* @return the memo
*/publicStringgetMemo(){returnmemo;}/**
* @return the result
*/publicStringgetResult(){returnresult;}/**
* @return the resultCode
*/publicStringgetResultCode(){returnresultCode;}/**
* @return the authCode
*/publicStringgetAuthCode(){returnauthCode;}/**
* @return the alipayOpenId
*/publicStringgetAlipayOpenId(){returnalipayOpenId;}}