Преглед изворни кода

Merge pull request #247 from silenceper/feature-v2

新增基础接口
silenceper пре 6 година
родитељ
комит
a4a388aef7
2 измењених фајлова са 19 додато и 0 уклоњено
  1. 19 0
      officialaccount/basic/basic.go
  2. 0 0
      officialaccount/message/transfer_customer.go

+ 19 - 0
officialaccount/basic/basic.go

@@ -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")
+}

officialaccount/message/ransfer_customer.go → officialaccount/message/transfer_customer.go