mirror of
https://gitee.com/binary/weixin-java-tools.git
synced 2025-06-28 13:16:19 +08:00
开放low-level方法,当本项目跟不上微信api的更新速度的时候,开发人员还可以使用
This commit is contained in:
parent
294ad07259
commit
d659e5b621
@ -7,6 +7,7 @@ import java.util.List;
|
|||||||
|
|
||||||
import me.chanjar.weixin.common.bean.WxMenu;
|
import me.chanjar.weixin.common.bean.WxMenu;
|
||||||
import me.chanjar.weixin.common.bean.result.WxMediaUploadResult;
|
import me.chanjar.weixin.common.bean.result.WxMediaUploadResult;
|
||||||
|
import me.chanjar.weixin.common.util.http.RequestExecutor;
|
||||||
import me.chanjar.weixin.cp.bean.*;
|
import me.chanjar.weixin.cp.bean.*;
|
||||||
import me.chanjar.weixin.cp.bean.WxCpDepart;
|
import me.chanjar.weixin.cp.bean.WxCpDepart;
|
||||||
import me.chanjar.weixin.cp.bean.WxCpUser;
|
import me.chanjar.weixin.cp.bean.WxCpUser;
|
||||||
@ -65,8 +66,8 @@ public interface WxCpService {
|
|||||||
* 详情请见: http://mp.weixin.qq.com/wiki/index.php?title=上传下载多媒体文件
|
* 详情请见: http://mp.weixin.qq.com/wiki/index.php?title=上传下载多媒体文件
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
* @param mediaType 媒体类型, 请看{@link WxConsts}
|
* @param mediaType 媒体类型, 请看{@link me.chanjar.weixin.common.api.WxConsts}
|
||||||
* @param fileType 文件类型,请看{@link WxConsts}
|
* @param fileType 文件类型,请看{@link me.chanjar.weixin.common.api.WxConsts}
|
||||||
* @param inputStream 输入流
|
* @param inputStream 输入流
|
||||||
* @throws WxErrorException
|
* @throws WxErrorException
|
||||||
*/
|
*/
|
||||||
@ -281,6 +282,40 @@ public interface WxCpService {
|
|||||||
*/
|
*/
|
||||||
public void tagRemoveUsers(String tagId, List<String> userIds) throws WxErrorException;
|
public void tagRemoveUsers(String tagId, List<String> userIds) throws WxErrorException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 当本Service没有实现某个API的时候,可以用这个,针对所有微信API中的GET请求
|
||||||
|
* @param url
|
||||||
|
* @param queryParam
|
||||||
|
* @return
|
||||||
|
* @throws WxErrorException
|
||||||
|
*/
|
||||||
|
String get(String url, String queryParam) throws WxErrorException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 当本Service没有实现某个API的时候,可以用这个,针对所有微信API中的POST请求
|
||||||
|
* @param url
|
||||||
|
* @param postData
|
||||||
|
* @return
|
||||||
|
* @throws WxErrorException
|
||||||
|
*/
|
||||||
|
String post(String url, String postData) throws WxErrorException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <pre>
|
||||||
|
* Service没有实现某个API的时候,可以用这个,
|
||||||
|
* 比{@link #get}和{@link #post}方法更灵活,可以自己构造RequestExecutor用来处理不同的参数和不同的返回类型。
|
||||||
|
* 可以参考,{@link me.chanjar.weixin.common.util.http.MediaUploadRequestExecutor}的实现方法
|
||||||
|
* </pre>
|
||||||
|
* @param executor
|
||||||
|
* @param uri
|
||||||
|
* @param data
|
||||||
|
* @param <T>
|
||||||
|
* @param <E>
|
||||||
|
* @return
|
||||||
|
* @throws WxErrorException
|
||||||
|
*/
|
||||||
|
public <T, E> T execute(RequestExecutor<T, E> executor, String uri, E data) throws WxErrorException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 注入 {@link WxCpConfigStorage} 的实现
|
* 注入 {@link WxCpConfigStorage} 的实现
|
||||||
*
|
*
|
||||||
|
@ -308,6 +308,14 @@ public class WxCpServiceImpl implements WxCpService {
|
|||||||
execute(new SimplePostRequestExecutor(), url, jsonObject.toString());
|
execute(new SimplePostRequestExecutor(), url, jsonObject.toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String get(String url, String queryParam) throws WxErrorException {
|
||||||
|
return execute(new SimpleGetRequestExecutor(), url, queryParam);
|
||||||
|
}
|
||||||
|
|
||||||
|
public String post(String url, String postData) throws WxErrorException {
|
||||||
|
return execute(new SimplePostRequestExecutor(), url, postData);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 向微信端发送请求,在这里执行的策略是当发生access_token过期时才去刷新,然后重新执行请求,而不是全局定时请求
|
* 向微信端发送请求,在这里执行的策略是当发生access_token过期时才去刷新,然后重新执行请求,而不是全局定时请求
|
||||||
*
|
*
|
||||||
|
@ -2,6 +2,7 @@ package me.chanjar.weixin.mp.api;
|
|||||||
|
|
||||||
import me.chanjar.weixin.common.bean.WxMenu;
|
import me.chanjar.weixin.common.bean.WxMenu;
|
||||||
import me.chanjar.weixin.common.bean.result.WxMediaUploadResult;
|
import me.chanjar.weixin.common.bean.result.WxMediaUploadResult;
|
||||||
|
import me.chanjar.weixin.common.util.http.RequestExecutor;
|
||||||
import me.chanjar.weixin.mp.bean.*;
|
import me.chanjar.weixin.mp.bean.*;
|
||||||
import me.chanjar.weixin.mp.bean.result.*;
|
import me.chanjar.weixin.mp.bean.result.*;
|
||||||
import me.chanjar.weixin.common.exception.WxErrorException;
|
import me.chanjar.weixin.common.exception.WxErrorException;
|
||||||
@ -318,8 +319,42 @@ public interface WxMpService {
|
|||||||
public void templateSend(WxMpTemplateMessage templateMessage) throws WxErrorException;
|
public void templateSend(WxMpTemplateMessage templateMessage) throws WxErrorException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 注入 {@link WxMpConfigStorage} 的实现
|
* 当本Service没有实现某个API的时候,可以用这个,针对所有微信API中的GET请求
|
||||||
* @param wxConfigProvider
|
* @param url
|
||||||
|
* @param queryParam
|
||||||
|
* @return
|
||||||
|
* @throws WxErrorException
|
||||||
*/
|
*/
|
||||||
|
String get(String url, String queryParam) throws WxErrorException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 当本Service没有实现某个API的时候,可以用这个,针对所有微信API中的POST请求
|
||||||
|
* @param url
|
||||||
|
* @param postData
|
||||||
|
* @return
|
||||||
|
* @throws WxErrorException
|
||||||
|
*/
|
||||||
|
String post(String url, String postData) throws WxErrorException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <pre>
|
||||||
|
* Service没有实现某个API的时候,可以用这个,
|
||||||
|
* 比{@link #get}和{@link #post}方法更灵活,可以自己构造RequestExecutor用来处理不同的参数和不同的返回类型。
|
||||||
|
* 可以参考,{@link me.chanjar.weixin.common.util.http.MediaUploadRequestExecutor}的实现方法
|
||||||
|
* </pre>
|
||||||
|
* @param executor
|
||||||
|
* @param uri
|
||||||
|
* @param data
|
||||||
|
* @param <T>
|
||||||
|
* @param <E>
|
||||||
|
* @return
|
||||||
|
* @throws WxErrorException
|
||||||
|
*/
|
||||||
|
public <T, E> T execute(RequestExecutor<T, E> executor, String uri, E data) throws WxErrorException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 注入 {@link WxMpConfigStorage} 的实现
|
||||||
|
* @param wxConfigProvider
|
||||||
|
*/
|
||||||
public void setWxMpConfigStorage(WxMpConfigStorage wxConfigProvider);
|
public void setWxMpConfigStorage(WxMpConfigStorage wxConfigProvider);
|
||||||
}
|
}
|
||||||
|
@ -279,7 +279,15 @@ public class WxMpServiceImpl implements WxMpService {
|
|||||||
execute(new SimplePostRequestExecutor(), url, templateMessage.toJson());
|
execute(new SimplePostRequestExecutor(), url, templateMessage.toJson());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
public String get(String url, String queryParam) throws WxErrorException {
|
||||||
|
return execute(new SimpleGetRequestExecutor(), url, queryParam);
|
||||||
|
}
|
||||||
|
|
||||||
|
public String post(String url, String postData) throws WxErrorException {
|
||||||
|
return execute(new SimplePostRequestExecutor(), url, postData);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
* 向微信端发送请求,在这里执行的策略是当发生access_token过期时才去刷新,然后重新执行请求,而不是全局定时请求
|
* 向微信端发送请求,在这里执行的策略是当发生access_token过期时才去刷新,然后重新执行请求,而不是全局定时请求
|
||||||
* @param executor
|
* @param executor
|
||||||
* @param uri
|
* @param uri
|
||||||
|
Loading…
Reference in New Issue
Block a user