mirror of
https://gitee.com/binary/weixin-java-tools.git
synced 2025-09-20 02:29:44 +08:00
开放low-level方法,当本项目跟不上微信api的更新速度的时候,开发人员还可以使用
This commit is contained in:
@@ -2,6 +2,7 @@ package me.chanjar.weixin.mp.api;
|
||||
|
||||
import me.chanjar.weixin.common.bean.WxMenu;
|
||||
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.result.*;
|
||||
import me.chanjar.weixin.common.exception.WxErrorException;
|
||||
@@ -318,8 +319,42 @@ public interface WxMpService {
|
||||
public void templateSend(WxMpTemplateMessage templateMessage) throws WxErrorException;
|
||||
|
||||
/**
|
||||
* 注入 {@link WxMpConfigStorage} 的实现
|
||||
* @param wxConfigProvider
|
||||
* 当本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 WxMpConfigStorage} 的实现
|
||||
* @param wxConfigProvider
|
||||
*/
|
||||
public void setWxMpConfigStorage(WxMpConfigStorage wxConfigProvider);
|
||||
}
|
||||
|
@@ -279,7 +279,15 @@ public class WxMpServiceImpl implements WxMpService {
|
||||
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过期时才去刷新,然后重新执行请求,而不是全局定时请求
|
||||
* @param executor
|
||||
* @param uri
|
||||
|
Reference in New Issue
Block a user