🎨 重构代码,抽取公共方法到接口

This commit is contained in:
Binary Wang
2020-04-25 21:53:05 +08:00
parent 6da4b4fca1
commit ebe46822ef
6 changed files with 89 additions and 69 deletions

View File

@@ -0,0 +1,41 @@
package me.chanjar.weixin.common.service;
import me.chanjar.weixin.common.error.WxErrorException;
/**
* 微信服务接口.
*
* @author <a href="https://github.com/binarywang">Binary Wang</a>
* @date 2020-04-25
*/
public interface WxService {
/**
* 当本Service没有实现某个API的时候可以用这个针对所有微信API中的GET请求.
*
* @param queryParam 参数
* @param url 请求接口地址
* @return 接口响应字符串
* @throws WxErrorException 异常
*/
String get(String url, String queryParam) throws WxErrorException;
/**
* 当本Service没有实现某个API的时候可以用这个针对所有微信API中的POST请求.
*
* @param postData 请求参数json值
* @param url 请求接口地址
* @return 接口响应字符串
* @throws WxErrorException 异常
*/
String post(String url, String postData) throws WxErrorException;
/**
* 当本Service没有实现某个API的时候可以用这个针对所有微信API中的POST请求.
*
* @param url 请求接口地址
* @param obj 请求对象
* @return 接口响应字符串
* @throws WxErrorException 异常
*/
String post(String url, Object obj) throws WxErrorException;
}