parent
3b3e91bb17
commit
f646934937
@ -0,0 +1,61 @@
|
|||||||
|
package wechatopen
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"encoding/json"
|
||||||
|
"fmt"
|
||||||
|
"go.dtapp.net/gorequest"
|
||||||
|
"net/http"
|
||||||
|
)
|
||||||
|
|
||||||
|
type WxaSecurityApplySetOrderPathInfoResponse struct {
|
||||||
|
Errcode int `json:"errcode"` // 返回码
|
||||||
|
Errmsg string `json:"errmsg"` // 返回码信息
|
||||||
|
}
|
||||||
|
|
||||||
|
type WxaSecurityApplySetOrderPathInfoResult struct {
|
||||||
|
Result WxaSecurityApplySetOrderPathInfoResponse // 结果
|
||||||
|
Body []byte // 内容
|
||||||
|
Http gorequest.Response // 请求
|
||||||
|
}
|
||||||
|
|
||||||
|
func newWxaSecurityApplySetOrderPathInfoResult(result WxaSecurityApplySetOrderPathInfoResponse, body []byte, http gorequest.Response) *WxaSecurityApplySetOrderPathInfoResult {
|
||||||
|
return &WxaSecurityApplySetOrderPathInfoResult{Result: result, Body: body, Http: http}
|
||||||
|
}
|
||||||
|
|
||||||
|
// WxaSecurityApplySetOrderPathInfo 申请设置订单页 path 信息
|
||||||
|
// https://developers.weixin.qq.com/doc/oplatform/openApi/OpenApiDoc/miniprogram-management/basic-info-management/applySetOrderPathInfo.html
|
||||||
|
func (c *Client) WxaSecurityApplySetOrderPathInfo(ctx context.Context, notMustParams ...gorequest.Params) (*WxaSecurityApplySetOrderPathInfoResult, error) {
|
||||||
|
// 检查
|
||||||
|
err := c.checkComponentIsConfig()
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
// 参数
|
||||||
|
params := gorequest.NewParamsWith(notMustParams...)
|
||||||
|
// 请求
|
||||||
|
request, err := c.request(ctx, fmt.Sprintf(apiUrl+"/wxa/security/applysetorderpathinfo?access_token=%s", c.GetAuthorizerAccessToken(ctx)), params, http.MethodPost)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
// 定义
|
||||||
|
var response WxaSecurityApplySetOrderPathInfoResponse
|
||||||
|
err = json.Unmarshal(request.ResponseBody, &response)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return newWxaSecurityApplySetOrderPathInfoResult(response, request.ResponseBody, request), nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// ErrcodeInfo 错误描述
|
||||||
|
func (resp *WxaSecurityApplySetOrderPathInfoResult) ErrcodeInfo() string {
|
||||||
|
switch resp.Result.Errcode {
|
||||||
|
case 61042:
|
||||||
|
return "批量提交超过最大数量,一次提交的 appid 数量不超过100个"
|
||||||
|
case 61043:
|
||||||
|
return "参数填写错误"
|
||||||
|
case 61044:
|
||||||
|
return "path填写不规范"
|
||||||
|
}
|
||||||
|
return "系统繁忙"
|
||||||
|
}
|
@ -0,0 +1,68 @@
|
|||||||
|
package wechatopen
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"encoding/json"
|
||||||
|
"fmt"
|
||||||
|
"go.dtapp.net/gorequest"
|
||||||
|
"net/http"
|
||||||
|
)
|
||||||
|
|
||||||
|
type WxaSecurityGetOrderPathInfoResponse struct {
|
||||||
|
Errcode int `json:"errcode"` // 返回码
|
||||||
|
Errmsg string `json:"errmsg"` // 返回码信息
|
||||||
|
msg struct {
|
||||||
|
Path string `json:"path"`
|
||||||
|
ImgList []string `json:"img_list"`
|
||||||
|
Video string `json:"video"`
|
||||||
|
TestAccount string `json:"test_account"`
|
||||||
|
TestPwd string `json:"test_pwd"`
|
||||||
|
TestRemark string `json:"test_remark"`
|
||||||
|
Status int `json:"status"`
|
||||||
|
ApplyTime int64 `json:"apply_time"`
|
||||||
|
} `json:"msg"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type WxaSecurityGetOrderPathInfoResult struct {
|
||||||
|
Result WxaSecurityGetOrderPathInfoResponse // 结果
|
||||||
|
Body []byte // 内容
|
||||||
|
Http gorequest.Response // 请求
|
||||||
|
}
|
||||||
|
|
||||||
|
func newWxaSecurityGetOrderPathInfoResult(result WxaSecurityGetOrderPathInfoResponse, body []byte, http gorequest.Response) *WxaSecurityGetOrderPathInfoResult {
|
||||||
|
return &WxaSecurityGetOrderPathInfoResult{Result: result, Body: body, Http: http}
|
||||||
|
}
|
||||||
|
|
||||||
|
// WxaSecurityGetOrderPathInfo 获取订单页 path 信息
|
||||||
|
// https://developers.weixin.qq.com/doc/oplatform/openApi/OpenApiDoc/miniprogram-management/basic-info-management/getOrderPathInfo.html
|
||||||
|
func (c *Client) WxaSecurityGetOrderPathInfo(ctx context.Context, infoType int) (*WxaSecurityGetOrderPathInfoResult, error) {
|
||||||
|
// 检查
|
||||||
|
err := c.checkComponentIsConfig()
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
// 参数
|
||||||
|
params := gorequest.NewParams()
|
||||||
|
params.Set("info_type", infoType)
|
||||||
|
// 请求
|
||||||
|
request, err := c.request(ctx, fmt.Sprintf(apiUrl+"/wxa/security/getorderpathinfo?access_token=%s", c.GetAuthorizerAccessToken(ctx)), params, http.MethodPost)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
// 定义
|
||||||
|
var response WxaSecurityGetOrderPathInfoResponse
|
||||||
|
err = json.Unmarshal(request.ResponseBody, &response)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return newWxaSecurityGetOrderPathInfoResult(response, request.ResponseBody, request), nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// ErrcodeInfo 错误描述
|
||||||
|
func (resp *WxaSecurityGetOrderPathInfoResult) ErrcodeInfo() string {
|
||||||
|
switch resp.Result.Errcode {
|
||||||
|
case 61041:
|
||||||
|
return "订单页 path 未设置"
|
||||||
|
}
|
||||||
|
return "系统繁忙"
|
||||||
|
}
|
Loading…
Reference in new issue