예제 #1
0
 protected void onfailure(final AsyncTaskPayload payload, String errString) {
   if (!(payload.getResponse() instanceof ErrorResponse)) {
     if (errString == null) {
       er = new ErrorResponse("数据加载出错,请稍后再试..");
     } else {
       er = new ErrorResponse(errString);
       if (!errString.contains("html")) {
         Toast.makeText(mContext.getApplicationContext(), errString, Toast.LENGTH_LONG).show();
       }
     }
     payload.setResponse(er);
   }
   if (mListener != null) mListener.onFailed(payload.getTaskType(), payload.getResponse());
   dismisDialog();
 }
예제 #2
0
 protected boolean checkErrorResponse(final AsyncTaskPayload payload, BaseResponse response) {
   if (Config.DEBUG && !Config.GATEWAY_URL.contains("i.api.zhubajie.com")) {
     BaseRequest request = (BaseRequest) payload.getData()[0];
     String jsonStr = JSONHelper.objToJson(request);
     LogManager.getInstance().insertLog(jsonStr);
     if (LogManager.getInstance().isDoWeb()) {
       onfailure(payload, "网络请求执行成功");
       return true;
     }
   }
   return checkErrorResponse(payload, response, true);
 }
예제 #3
0
  protected boolean checkErrorResponse(
      final AsyncTaskPayload payload, BaseResponse response, boolean isShow) {
    if (response instanceof ErrorResponse) {
      if (StringUtils.isEmpty(response.getVerification())) {
        if (response.getResult() != 10047 && response.getResult() != 10) {
          if (isShow && !StringUtils.isEmpty(response.getMsg())) {
            Toast.makeText(mContext.getApplicationContext(), response.getMsg(), Toast.LENGTH_LONG)
                .show();
          }
        }
      }
      payload.setResponse(response);
      Log.e("error:" + response.getResult(), response.getMsg() + "");
      onfailure(payload, response.getMsg());
      return true;
    }
    if (response.getStatus() == 0) {
      onfailure(payload, response.getMsg());
      return true;
    }

    return false;
  }