com.github.sd4324530.fastweixin.api
类 BaseAPI

java.lang.Object
  继承者 com.github.sd4324530.fastweixin.api.BaseAPI
直接已知子类:
CustomAPI, DataCubeAPI, JsAPI, MaterialAPI, MediaAPI, MenuAPI, MessageAPI, OauthAPI, QrcodeAPI, SystemAPI, TagAPI, TemplateMsgAPI, UserAPI

public abstract class BaseAPI
extends Object

API基类,提供一些通用方法 包含自动刷新token、通用get post请求等

从以下版本开始:
1.2
作者:
peiyu

字段摘要
protected static String BASE_API_URL
           
protected  ApiConfig config
           
 
构造方法摘要
protected BaseAPI(ApiConfig config)
          构造方法,设置apiConfig
 
方法摘要
protected  BaseResponse executeGet(String url)
          通用get请求
protected  BaseResponse executePost(String url, String json)
          通用post请求
protected  BaseResponse executePost(String url, String json, File file)
          通用post请求
protected  boolean isSuccess(String errCode)
          判断本次请求是否成功
 
从类 java.lang.Object 继承的方法
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

字段详细信息

BASE_API_URL

protected static final String BASE_API_URL
另请参见:
常量字段值

config

protected final ApiConfig config
构造方法详细信息

BaseAPI

protected BaseAPI(ApiConfig config)
构造方法,设置apiConfig

参数:
config - 微信API配置对象
方法详细信息

executePost

protected BaseResponse executePost(String url,
                                   String json)
通用post请求

参数:
url - 地址,其中token用#代替
json - 参数,json格式
返回:
请求结果

executePost

protected BaseResponse executePost(String url,
                                   String json,
                                   File file)
通用post请求

参数:
url - 地址,其中token用#代替
json - 参数,json格式
file - 上传的文件
返回:
请求结果

executeGet

protected BaseResponse executeGet(String url)
通用get请求

参数:
url - 地址,其中token用#代替
返回:
请求结果

isSuccess

protected boolean isSuccess(String errCode)
判断本次请求是否成功

参数:
errCode - 错误码
返回:
是否成功


Copyright © 2017. All rights reserved.