80 lines
2.1 KiB
Java
80 lines
2.1 KiB
Java
package chanjarster.weixin.api;
|
||
|
||
import chanjarster.weixin.bean.WxCustomMessage;
|
||
import chanjarster.weixin.bean.WxMenu;
|
||
import chanjarster.weixin.exception.WxErrorException;
|
||
|
||
/**
|
||
* 微信API的Service
|
||
*/
|
||
public interface WxService {
|
||
|
||
/**
|
||
* <pre>
|
||
* 验证推送过来的消息的正确性
|
||
* 详情请见: http://mp.weixin.qq.com/wiki/index.php?title=接入指南
|
||
* </pre>
|
||
* @param timestamp
|
||
* @param nonce
|
||
* @param signature
|
||
* @return
|
||
*/
|
||
public boolean checkSignature(String timestamp, String nonce, String signature);
|
||
|
||
/**
|
||
* <pre>
|
||
* 获取access_token,本方法线程安全
|
||
* 且在多线程同时刷新时只刷新一次,避免超出1200次的调用次数上限
|
||
*
|
||
* 另:本service的所有方法都会在access_token过期是调用此方法
|
||
*
|
||
* 程序员在非必要情况下尽量不要主动调用此方法
|
||
|
||
* 详情请见: http://mp.weixin.qq.com/wiki/index.php?title=获取access_token
|
||
* </pre>
|
||
* @throws WxErrorException
|
||
*/
|
||
public void refreshAccessToken() throws WxErrorException;
|
||
|
||
/**
|
||
* <pre>
|
||
* 发送客服消息
|
||
* 详情请见: http://mp.weixin.qq.com/wiki/index.php?title=发送客服消息
|
||
* </pre>
|
||
* @param message
|
||
* @throws WxErrorException
|
||
*/
|
||
public String sendCustomMessage(WxCustomMessage message) throws WxErrorException;
|
||
|
||
/**
|
||
* <pre>
|
||
* 自定义菜单创建接口
|
||
* 详情请见: http://mp.weixin.qq.com/wiki/index.php?title=自定义菜单创建接口
|
||
* </pre>
|
||
* @param menu
|
||
* @throws WxErrorException
|
||
*/
|
||
public String createMenu(WxMenu menu) throws WxErrorException;
|
||
|
||
/**
|
||
* <pre>
|
||
* 自定义菜单删除接口
|
||
* 详情请见: http://mp.weixin.qq.com/wiki/index.php?title=自定义菜单删除接口
|
||
* </pre>
|
||
* @throws WxErrorException
|
||
*/
|
||
public String deleteMenu() throws WxErrorException;
|
||
|
||
/**
|
||
* <pre>
|
||
* 自定义菜单查询接口
|
||
* 详情请见: http://mp.weixin.qq.com/wiki/index.php?title=自定义菜单查询接口
|
||
* </pre>
|
||
* @return
|
||
* @throws WxErrorException
|
||
*/
|
||
public WxMenu getMenu() throws WxErrorException;
|
||
|
||
public void setWxConfigStorage(WxConfigStorage wxConfigProvider);
|
||
}
|