@Override public void doGetUserMedicalDetail(String id) { String userCounselUrl = APIURL.GET_USER_MEDICAL_DETAIL_URL; PostItem postItem = new PostItem(); postItem.userId = mActivity.getLoginSuccessItem().id; postItem.id = id; String mingPostBody = GsonUtils.toJson(postItem); System.out.println("mingPostBody = " + mingPostBody); String postBody = RSAUtil.clientEncrypt(mingPostBody); System.out.println("postBody = " + postBody); RequestUtils.getDataFromUrlByPostWithLoginInfo( mActivity, userCounselUrl, postBody, mActivity.getLoginSuccessItem(), mDataView, mRequestTag); }
@Override public void doAutoLogin() { /** * 参考查看 {@link LoginActivity#onGetDataSuccess(ResultItem, String)} */ String encryptUsernamePwd = mActivity.getPreferences().getString(Constants.PREF_RSA_USERNAME_PWD, null); if (TextUtils.isEmpty(encryptUsernamePwd)) { mActivity.showToast("自动登录失败,请重新点击登录按钮登录"); if (!(mActivity instanceof LoginActivity)) { LoginActivity.actionLogin(mActivity); } return; } String loginUrl = APIURL.LOGIN_URL; DataView dataView = new DataView() { @Override public void onGetDataSuccess(ResultItem resultItem, String requestTag) { if (null != resultItem && resultItem.success()) { LoginSuccessItem loginSuccessItem = GsonUtils.jsonToClass( resultItem.properties.getAsJsonObject().toString(), LoginSuccessItem.class); if (null != loginSuccessItem) { mActivity.saveLoginSuccessItem(loginSuccessItem); if (mActivity instanceof LoginActivity) { mActivity.showToast("自动登录成功"); MainActivity.actioMain(mActivity); } else { mActivity.showToast("session过期,自动登录成功"); } } } } @Override public void onGetDataFailured(String msg, String requestTag) { mActivity.showToast("自动登录失败,请重新点击登录按钮登录"); if (!(mActivity instanceof LoginActivity)) { LoginActivity.actionLogin(mActivity); } } }; RequestUtils.getDataFromUrlByPost(mActivity, loginUrl, encryptUsernamePwd, dataView); }