You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
go-library/service/wechatopen/wxa.unbind_tester.go

44 lines
1.5 KiB

2 years ago
package wechatopen
import (
2 years ago
"context"
1 year ago
"github.com/dtapps/go-library/utils/gojson"
2 years ago
"github.com/dtapps/go-library/utils/gorequest"
2 years ago
"net/http"
)
type WxaUnbindTesterResponse struct {
Errcode int `json:"errcode"` // 错误码
Errmsg string `json:"errmsg"` // 错误信息
}
type WxaUnbindTesterResult struct {
Result WxaUnbindTesterResponse // 结果
Body []byte // 内容
Http gorequest.Response // 请求
2 years ago
}
func newWxaUnbindTesterResult(result WxaUnbindTesterResponse, body []byte, http gorequest.Response) *WxaUnbindTesterResult {
return &WxaUnbindTesterResult{Result: result, Body: body, Http: http}
2 years ago
}
// WxaUnbindTester 解除绑定体验者
// https://developers.weixin.qq.com/doc/oplatform/Third-party_Platforms/2.0/api/Mini_Program_AdminManagement/unbind_tester.html
12 months ago
func (c *Client) WxaUnbindTester(ctx context.Context, authorizerAccessToken, wechatid, userstr string, notMustParams ...gorequest.Params) (*WxaUnbindTesterResult, error) {
2 years ago
// 参数
params := gorequest.NewParamsWith(notMustParams...)
2 years ago
if wechatid != "" {
params.Set("wechatid", wechatid)
2 years ago
}
params.Set("userstr", userstr)
2 years ago
// 请求
12 months ago
request, err := c.request(ctx, apiUrl+"/wxa/unbind_tester?access_token="+authorizerAccessToken, params, http.MethodPost)
if err != nil {
return newWxaUnbindTesterResult(WxaUnbindTesterResponse{}, request.ResponseBody, request), err
}
2 years ago
// 定义
var response WxaUnbindTesterResponse
1 year ago
err = gojson.Unmarshal(request.ResponseBody, &response)
return newWxaUnbindTesterResult(response, request.ResponseBody, request), err
2 years ago
}