/** 获取验证码 */
  private void getVerifyCode(String phone) {
    // String phone = AppContext.mUserInfo.phone;
    if (TextUtils.isEmpty(phone)) {
      UIHelper.showToast(R.string.phone_is_null);
      return;
    } else if (!StringUtils.isPhoneNumber(phone)) {
      UIHelper.showToast(R.string.phone_disenable);
      return;
    }

    RequstClient.getRegeditCode(
        phone,
        "0",
        new CustomResponseHandler(FragmentModifyPhone.this.getActivity()) {
          @Override
          public void onFailure(Throwable error, String content) {
            super.onFailure(error, content);
          }

          @Override
          public void onSuccess(int statusCode, Header[] headers, String content) {
            super.onSuccess(statusCode, headers, content);
            Log.d("phone", "checkIdentity msg:" + content);
            int type = JSONParseUtils.getInt(content, "type");
            String msg = JSONParseUtils.getString(content, "msg");
            if (1 == type) {
              showResendTip();
              UIHelper.showToast(msg);
            } else {
              UIHelper.showToast(msg);
            }
          }
        });
  }
 /**
  * 将字符串转位日期类型
  *
  * @param sdate
  * @return
  */
 public static Date toDate(String sdate) {
   if (StringUtils.isBlank(sdate)) return null;
   try {
     return dateFormater.get().parse(sdate);
   } catch (ParseException e) {
     return null;
   }
 }
  /** * 修改手机号码 */
  private void amendPhone(final String phone, String messageVerifyCode) {

    // 判断手机
    if (TextUtils.isEmpty(phone)) {
      UIHelper.showToast(R.string.phone_is_null);
      return;
    } else if (!StringUtils.isPhoneNumber(phone)) {
      UIHelper.showToast(R.string.phone_disenable);
      return;
    }

    // 验证码
    if (TextUtils.isEmpty(messageVerifyCode)) {
      UIHelper.showToast(R.string.ver_code_is_null);
      return;
    }

    String userId = AppContext.mUserInfo.userId;
    RequstClient.amendPhone(
        userId,
        phone,
        messageVerifyCode,
        new CustomResponseHandler(FragmentModifyPhone.this.getActivity()) {
          @Override
          public void onFailure(Throwable error, String content) {
            super.onFailure(error, content);
          }

          @Override
          public void onSuccess(int statusCode, Header[] headers, String content) {
            super.onSuccess(statusCode, headers, content);
            try {
              LogUtil.i("phone", "postValidateCode:" + content);
              JSONObject result = new JSONObject(content);
              if (!result.getString("type").equals("1")) {
                String errorMsg = result.getString("msg");
                Toast.makeText(mContext, errorMsg, Toast.LENGTH_SHORT).show();
                return;
              }

              // 手机号码修改成功
              AppContext.mUserInfo.phone = phone;
              UIHelper.showToast("手机修改成功");

              // 杀掉timer线程
              if (mListener != null) {
                mTimer.cancel();
                mListener.stepToModifyFinish();
              }

            } catch (JSONException e) {
              e.printStackTrace();
            }
          }
        });
  }
  /**
   * 日期什么的最烦人了
   *
   * @param sdata
   * @return
   */
  public static String toHour(String starttime, String endtime, String curtime) {

    Date start = StringUtils.toDate(starttime);
    Date end = StringUtils.toDate(endtime);
    Date nowTime = StringUtils.toDate(curtime);

    long daymin = 1000 * 60 * 60 * 24;
    long startSecond = start.getTime();
    long endSecond = end.getTime();
    long nowSecond = nowTime.getTime();

    if (nowSecond < startSecond) {
      long sec = startSecond - nowSecond;
      if (sec > 0 && sec < daymin) {
        return HourFormater.get().format(start);
      }
      if (sec > 0 && sec < daymin * 2) {
        return "明天" + HourFormater.get().format(start);
      }
      if (sec > 0 && sec < daymin * 3) {
        return "后天" + HourFormater.get().format(start);
      }
      if (sec > 0) {
        return "即将开始";
      }
    } else if (nowSecond < endSecond) {
      long sec = nowSecond - startSecond;
      if (sec > 0 && sec < daymin) {
        return HourFormater.get().format(start);
      }
      if (sec > 0 && sec < daymin * 2) {
        return "昨天" + HourFormater.get().format(start);
      }
      if (sec > 0 && sec < daymin * 3) {
        return "前天" + HourFormater.get().format(start);
      }
      if (sec > 0) {
        return "正在进行";
      }
    } else if (nowSecond > endSecond) {
      return "已经结束";
    }

    //		Date startTime = toDate(starttime);
    //		Date today = new Date();
    //		Date endTime = toDate(endtime);
    //		long sec = startTime.getTime() - today.getTime();
    //		if (sec > 0 && sec < 1000 * 60 * 60 * 24) {
    //			return HourFormater.get().format(startTime);
    //		}
    //		if (sec > 0 && sec < 1000 * 60 * 60 * 24 * 2) {
    //			return "明天" + HourFormater.get().format(startTime);
    //		}
    //		if (sec > 0 && sec < 1000 * 60 * 60 * 24 * 3) {
    //			return "后天" + HourFormater.get().format(startTime);
    //		}
    //		if (sec > 0) {
    //			return "即将开始";
    //		}
    //		if (sec < 0 && sec > -1000 * 60 * 60 * 24) {
    //			return "昨天" + HourFormater.get().format(startTime);
    //		}
    //		if (sec < 0 && sec > -1000 * 60 * 60 * 24 * 2) {
    //			return "前天" + HourFormater.get().format(startTime);
    //		}
    //		if (sec < 0) {
    //			return "已经结束";
    //		}
    return "Unknown";
  }