コード例 #1
0
  private void phoneSpw(String phoneVerify, String phone) {

    String url = Constans.Phone_PwRetrieve;
    PhoneBean bean = new PhoneBean();
    bean.setPhone(phone);
    bean.setCode(phoneVerify);
    String jsonstr = JsonHelper.toJsonString(bean);
    String encodesstr = "";
    try {
      encodesstr = AesUtils.Encrypt(jsonstr, CommonConstants.AES_KEY);
      // System.out.println(encodesstr);
      Logger.d("encodesstr", encodesstr);
    } catch (Exception e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    }
    AjaxParams params = new AjaxParams();
    params.put("cont", encodesstr);
    params.put("sid", sid);

    showDialogFragment(false);
    HttpRespose http = new HttpRespose(url, params);
    http.request(
        new HttpCallback() {
          @Override
          public void onCallback(Object obj) {
            if (isFinishing()) return;
            removeDialogFragment();
            if (obj == null || TextUtils.isEmpty((String) obj)) {
              Toast.makeText(getActivity(), "操作失败", Toast.LENGTH_SHORT).show();
              return;
            }

            CommonBack back =
                (CommonBack) ReqJsonUtil.changeToObject((String) obj, CommonBack.class);
            if (back.getCode() == 00000) {
              // Toast.makeText(getActivity(), back.getMessage(), Toast.LENGTH_SHORT).show();
              Intent intent = new Intent();
              intent.putExtra(ShellResetPasswordActivity.EXTRA_SID, sid);
              ShellUtil.execute(getActivity(), ShellResetPasswordActivity.class, intent);
            } else {
              Toast.makeText(getActivity(), back.getMessage(), Toast.LENGTH_SHORT).show();
            }
          }
        });
  }
コード例 #2
0
  private void getPhoneCord(String imgCode, String phone) {
    phoneCordBean bean = new phoneCordBean();
    bean.setPhone(phone);
    bean.setCode(imgCode);
    bean.setType("0");

    String jsonEnc = null;
    String json = JsonHelper.toJsonString(bean);
    try {
      jsonEnc = AesUtils.Encrypt(json, CommonConstants.AES_KEY);
    } catch (Exception e) {
      e.printStackTrace();
    }
    AjaxParams params = new AjaxParams();
    params.put("cont", jsonEnc);
    params.put("sid", sid);

    String url = Constans.get_PhoneCode;
    showDialogFragment(false);
    HttpRespose http = new HttpRespose(url, params);
    http.request(
        new HttpCallback() {
          @Override
          public void onCallback(Object obj) {
            if (isFinishing()) return;
            removeDialogFragment();
            if (obj == null || TextUtils.isEmpty((String) obj)) {
              Toast.makeText(getActivity(), "获取手机验证码失败", Toast.LENGTH_SHORT).show();
              return;
            }

            CommonBack back =
                (CommonBack) ReqJsonUtil.changeToObject((String) obj, CommonBack.class);
            if (back.getCode() == 00000) {
              Toast.makeText(getActivity(), "验证码已发送", Toast.LENGTH_SHORT).show();
            } else {
              Toast.makeText(getActivity(), back.getMessage(), Toast.LENGTH_SHORT).show();
            }
          }
        });
  }