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.
wechatopen/wxa.security.apply_privacy_...

71 lines
2.3 KiB

2 years ago
package wechatopen
import (
2 years ago
"context"
2 years ago
"encoding/json"
"fmt"
"go.dtapp.net/gorequest"
"net/http"
)
type WxaSecurityApplyPrivacyInterfaceResponse struct {
Errcode int `json:"errcode"` // 返回码
Errmsg string `json:"errmsg"` // 返回码信息
AuditId int64 `json:"audit_id"` // 审核单id
}
type WxaSecurityApplyPrivacyInterfaceResult struct {
Result WxaSecurityApplyPrivacyInterfaceResponse // 结果
Body []byte // 内容
Http gorequest.Response // 请求
}
2 years ago
func newWxaSecurityApplyPrivacyInterfaceResult(result WxaSecurityApplyPrivacyInterfaceResponse, body []byte, http gorequest.Response) *WxaSecurityApplyPrivacyInterfaceResult {
return &WxaSecurityApplyPrivacyInterfaceResult{Result: result, Body: body, Http: http}
2 years ago
}
// WxaSecurityApplyPrivacyInterface 申请接口
// https://developers.weixin.qq.com/doc/oplatform/Third-party_Platforms/2.0/api/apply_api/apply_privacy_interface.html
2 years ago
func (c *Client) WxaSecurityApplyPrivacyInterface(ctx context.Context, notMustParams ...gorequest.Params) (*WxaSecurityApplyPrivacyInterfaceResult, error) {
// 检查
err := c.checkComponentIsConfig()
if err != nil {
return nil, err
}
2 years ago
// 参数
2 years ago
params := gorequest.NewParamsWith(notMustParams...)
2 years ago
// 请求
2 years ago
request, err := c.request(ctx, fmt.Sprintf(apiUrl+"/wxa/security/apply_privacy_interface?access_token=%s", c.GetAuthorizerAccessToken(ctx)), params, http.MethodPost)
2 years ago
if err != nil {
return nil, err
}
2 years ago
// 定义
var response WxaSecurityApplyPrivacyInterfaceResponse
err = json.Unmarshal(request.ResponseBody, &response)
2 years ago
if err != nil {
return nil, err
}
return newWxaSecurityApplyPrivacyInterfaceResult(response, request.ResponseBody, request), nil
2 years ago
}
// ErrcodeInfo 错误描述
func (resp *WxaSecurityApplyPrivacyInterfaceResult) ErrcodeInfo() string {
switch resp.Result.Errcode {
case 61031:
return "审核中,请不要重复申请"
case 61032:
return "视频格式不对要传mp4格式的"
case 61033:
return "视频下载失败"
case 61034:
return "必填的参数没填,检查后重新提交"
case 61035:
return "输入的apiapi_name严格区分大小写无需申请可以直接使用"
case 61036:
return "该帐号不可申请,请检查类目是否符合"
case 61037:
return "需要以ntf-8的编码格式提交"
}
return "系统繁忙"
}