1
0
mirror of https://github.com/silenceper/wechat.git synced 2026-02-04 12:52:27 +08:00

1、新增基础接口-清理接口调用次数

2、fix 多客服消息转发文件名错误
This commit is contained in:
silenceper
2020-05-24 17:56:10 +08:00
parent 239fe1d758
commit 7a4230414d
2 changed files with 19 additions and 0 deletions

View File

@@ -12,6 +12,9 @@ var (
//文档https://developers.weixin.qq.com/doc/offiaccount/Basic_Information/Get_the_WeChat_server_IP_address.html
getCallbackIPURL = "https://api.weixin.qq.com/cgi-bin/getcallbackip"
getAPIDomainIPURL = "https://api.weixin.qq.com/cgi-bin/get_api_domain_ip"
//清理接口调用次数
clearQuotaURL = "https://api.weixin.qq.com/cgi-bin/clear_quota"
)
//Basic struct
@@ -63,3 +66,19 @@ func (basic *Basic) GetAPIDomainIP() ([]string, error) {
err = util.DecodeWithError(data, ipListRes, "GetAPIDomainIP")
return ipListRes.IPList, err
}
//ClearQuota 清理接口调用次数
func (basic *Basic) ClearQuota() error {
ak, err := basic.GetAccessToken()
if err != nil {
return err
}
url := fmt.Sprintf("%s?access_token=%s", clearQuotaURL, ak)
data, err := util.PostJSON(url, map[string]string{
"appid": basic.AppID,
})
if err != nil {
return err
}
return util.DecodeWithCommonError(data, "ClearQuota")
}