mirror of
https://gitee.com/binary/weixin-java-tools.git
synced 2026-03-10 00:13:40 +08:00
🎨 #3194 【小程序】优化openApi部分接口(getApiQuota 和 getRidInfo )响应类的部分字段信息
This commit is contained in:
@@ -15,7 +15,6 @@ public interface WxMaOpenApiService {
|
||||
|
||||
/**
|
||||
* 本接口用于清空公众号/小程序/第三方平台等接口的每日调用接口次数
|
||||
* HTTP调用:https://api.weixin.qq.com/cgi-bin/clear_quota?access_token=ACCESS_TOKEN
|
||||
*
|
||||
* @return 是否成功
|
||||
* @throws WxErrorException the wx error exception
|
||||
@@ -28,18 +27,18 @@ public interface WxMaOpenApiService {
|
||||
|
||||
/**
|
||||
* 查询API调用额度
|
||||
* HTTP调用:https://api.weixin.qq.com/cgi-bin/openapi/quota/get?access_token=ACCESS_TOKEN
|
||||
*
|
||||
* @param cgiPath api的请求地址,例如"/cgi-bin/message/custom/send";不要前缀“https://api.weixin.qq.com” ,也不要漏了"/",否则都会76003的报错
|
||||
* @param cgiPath api的请求地址,
|
||||
* 例如"/cgi-bin/message/custom/send";不要前缀“https://api.weixin.qq.com” ,也不要漏了"/",否则都会76003的报错;
|
||||
* @return 额度详情
|
||||
* @throws WxErrorException 微信异常
|
||||
* @apiNote "/xxx/sns/xxx" 这类接口不支持使用该接口,会出现76022报错。
|
||||
* @see <a href="https://developers.weixin.qq.com/miniprogram/dev/OpenApiDoc/openApi-mgnt/getApiQuota.html">注意事项参考微信文档</a>
|
||||
*/
|
||||
WxMiniGetApiQuotaResult getApiQuota(String cgiPath) throws WxErrorException;
|
||||
|
||||
/**
|
||||
* 查询rid信息
|
||||
* HTTP调用:https://api.weixin.qq.com/cgi-bin/openapi/rid/get?access_token=ACCESS_TOKEN
|
||||
*
|
||||
* @param rid 调用接口报错返回的rid
|
||||
* @return 该rid对应的请求详情
|
||||
@@ -51,7 +50,6 @@ public interface WxMaOpenApiService {
|
||||
|
||||
/**
|
||||
* 使用AppSecret重置 API 调用次数
|
||||
* HTTP调用:https://api.weixin.qq.com/cgi-bin/clear_quota/v2
|
||||
*
|
||||
* @return 是否成功
|
||||
* @throws WxErrorException 微信异常
|
||||
|
||||
@@ -23,7 +23,6 @@ import static me.chanjar.weixin.common.api.WxConsts.ERR_CODE;
|
||||
public class WxMaOpenApiServiceImpl implements WxMaOpenApiService {
|
||||
private final WxMaService wxMaService;
|
||||
|
||||
private static final String QUOTA = "quota";
|
||||
private static final String REQUEST = "request";
|
||||
|
||||
|
||||
@@ -42,11 +41,7 @@ public class WxMaOpenApiServiceImpl implements WxMaOpenApiService {
|
||||
params.addProperty("cgi_path", cgiPath);
|
||||
String responseContent = this.wxMaService.post(WxMaApiUrlConstants.OpenApi.GET_API_QUOTA, params.toString());
|
||||
parseErrorResponse(responseContent);
|
||||
JsonObject response = GsonParser.parse(responseContent);
|
||||
if (response.has(QUOTA)) {
|
||||
return WxMaGsonBuilder.create().fromJson(response.getAsJsonObject(QUOTA), WxMiniGetApiQuotaResult.class);
|
||||
}
|
||||
return null;
|
||||
return WxMaGsonBuilder.create().fromJson(GsonParser.parse(responseContent), WxMiniGetApiQuotaResult.class);
|
||||
}
|
||||
|
||||
|
||||
@@ -58,7 +53,7 @@ public class WxMaOpenApiServiceImpl implements WxMaOpenApiService {
|
||||
parseErrorResponse(responseContent);
|
||||
JsonObject response = GsonParser.parse(responseContent);
|
||||
if (response.has(REQUEST)) {
|
||||
return WxMaGsonBuilder.create().fromJson(response.getAsJsonObject(QUOTA), WxMiniGetRidInfoResult.class);
|
||||
return WxMaGsonBuilder.create().fromJson(response.getAsJsonObject(REQUEST), WxMiniGetRidInfoResult.class);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user