mirror of
https://gitee.com/binary/weixin-java-tools.git
synced 2025-08-24 07:23:01 +08:00
#367 增加对api调用次数清零的接口
This commit is contained in:
parent
81ebe1a085
commit
20825922ce
@ -5,8 +5,11 @@ import me.chanjar.weixin.common.exception.WxErrorException;
|
||||
import me.chanjar.weixin.common.util.http.MediaUploadRequestExecutor;
|
||||
import me.chanjar.weixin.common.util.http.RequestExecutor;
|
||||
import me.chanjar.weixin.common.util.http.RequestHttp;
|
||||
import me.chanjar.weixin.mp.bean.*;
|
||||
import me.chanjar.weixin.mp.bean.result.*;
|
||||
import me.chanjar.weixin.mp.bean.WxMpSemanticQuery;
|
||||
import me.chanjar.weixin.mp.bean.result.WxMpCurrentAutoReplyInfo;
|
||||
import me.chanjar.weixin.mp.bean.result.WxMpOAuth2AccessToken;
|
||||
import me.chanjar.weixin.mp.bean.result.WxMpSemanticQueryResult;
|
||||
import me.chanjar.weixin.mp.bean.result.WxMpUser;
|
||||
|
||||
/**
|
||||
* 微信API的Service
|
||||
@ -62,6 +65,11 @@ public interface WxMpService {
|
||||
*/
|
||||
String GET_CURRENT_AUTOREPLY_INFO_URL = "https://api.weixin.qq.com/cgi-bin/get_current_autoreply_info";
|
||||
|
||||
/**
|
||||
* 公众号调用或第三方平台帮公众号调用对公众号的所有api调用(包括第三方帮其调用)次数进行清零
|
||||
*/
|
||||
String CLEAR_QUOTA_URL = "https://api.weixin.qq.com/cgi-bin/clear_quota";
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* 验证消息的确来自微信服务器
|
||||
@ -219,6 +227,18 @@ public interface WxMpService {
|
||||
*/
|
||||
WxMpCurrentAutoReplyInfo getCurrentAutoReplyInfo() throws WxErrorException;
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* 公众号调用或第三方平台帮公众号调用对公众号的所有api调用(包括第三方帮其调用)次数进行清零:
|
||||
* HTTP调用:https://api.weixin.qq.com/cgi-bin/clear_quota?access_token=ACCESS_TOKEN
|
||||
* 接口文档地址:https://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1433744592
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @param appid 公众号的APPID
|
||||
*/
|
||||
void clearQuota(String appid) throws WxErrorException;
|
||||
|
||||
/**
|
||||
* 当本Service没有实现某个API的时候,可以用这个,针对所有微信API中的GET请求
|
||||
*/
|
||||
@ -376,6 +396,7 @@ public interface WxMpService {
|
||||
|
||||
/**
|
||||
* 返回群发消息相关接口方法的实现类对象,以方便调用其各个接口
|
||||
*
|
||||
* @return WxMpMassMessageService
|
||||
*/
|
||||
WxMpMassMessageService getMassMessageService();
|
||||
|
@ -207,6 +207,13 @@ public abstract class WxMpServiceAbstractImpl<H, P> implements WxMpService, Requ
|
||||
return WxMpCurrentAutoReplyInfo.fromJson(this.get(GET_CURRENT_AUTOREPLY_INFO_URL, null));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clearQuota(String appid) throws WxErrorException {
|
||||
JsonObject o = new JsonObject();
|
||||
o.addProperty("appid", appid);
|
||||
this.post(CLEAR_QUOTA_URL, o.toString());
|
||||
}
|
||||
|
||||
@Override
|
||||
public String get(String url, String queryParam) throws WxErrorException {
|
||||
return execute(SimpleGetRequestExecutor.create(this), url, queryParam);
|
||||
|
@ -15,7 +15,6 @@ import static org.testng.Assert.*;
|
||||
@Test
|
||||
@Guice(modules = ApiTestModule.class)
|
||||
public class WxMpServiceImplTest {
|
||||
|
||||
@Inject
|
||||
private WxMpService wxService;
|
||||
|
||||
@ -28,88 +27,8 @@ public class WxMpServiceImplTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testCheckSignature() {
|
||||
Assert.fail("Not yet implemented");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetAccessToken() {
|
||||
Assert.fail("Not yet implemented");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetAccessTokenBoolean() {
|
||||
Assert.fail("Not yet implemented");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetJsapiTicket() {
|
||||
Assert.fail("Not yet implemented");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetJsapiTicketBoolean() {
|
||||
Assert.fail("Not yet implemented");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testCreateJsapiSignature() {
|
||||
Assert.fail("Not yet implemented");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testCustomMessageSend() {
|
||||
Assert.fail("Not yet implemented");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testMassNewsUpload() {
|
||||
Assert.fail("Not yet implemented");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testMassVideoUpload() {
|
||||
Assert.fail("Not yet implemented");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testMassGroupMessageSend() {
|
||||
Assert.fail("Not yet implemented");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testMassOpenIdsMessageSend() {
|
||||
Assert.fail("Not yet implemented");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testMassMessagePreview() {
|
||||
Assert.fail("Not yet implemented");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testShortUrl() {
|
||||
Assert.fail("Not yet implemented");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSetIndustry() {
|
||||
Assert.fail("Not yet implemented");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetIndustry() {
|
||||
Assert.fail("Not yet implemented");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSemanticQuery() {
|
||||
Assert.fail("Not yet implemented");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testOauth2buildAuthorizationUrl() {
|
||||
Assert.fail("Not yet implemented");
|
||||
public void testClearQuota() throws WxErrorException {
|
||||
this.wxService.clearQuota(wxService.getWxMpConfigStorage().getAppId());
|
||||
}
|
||||
|
||||
@Test
|
||||
@ -121,44 +40,4 @@ public class WxMpServiceImplTest {
|
||||
System.out.println(qrConnectUrl);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testOauth2getAccessToken() {
|
||||
Assert.fail("Not yet implemented");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testOauth2refreshAccessToken() {
|
||||
Assert.fail("Not yet implemented");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testOauth2getUserInfo() {
|
||||
Assert.fail("Not yet implemented");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testOauth2validateAccessToken() {
|
||||
Assert.fail("Not yet implemented");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetCallbackIP() {
|
||||
Assert.fail("Not yet implemented");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGet() {
|
||||
Assert.fail("Not yet implemented");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testPost() {
|
||||
Assert.fail("Not yet implemented");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testExecute() {
|
||||
Assert.fail("Not yet implemented");
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user