- update request
continuous-integration/drone/push Build is passing Details
continuous-integration/drone/tag Build is passing Details

master v1.0.8
李光春 2 years ago
parent 1defa20a76
commit 2bffadd116

@ -58,7 +58,7 @@ func newCgiBinAccountGetAccountBasicInfoResult(result CgiBinAccountGetAccountBas
// https://developers.weixin.qq.com/doc/oplatform/Third-party_Platforms/2.0/api/Mini_Program_Basic_Info/Mini_Program_Information_Settings.html
func (c *Client) CgiBinAccountGetAccountBasicInfo(ctx context.Context) *CgiBinAccountGetAccountBasicInfoResult {
// 请求
request, err := c.request(ctx, fmt.Sprintf(apiUrl+"/cgi-bin/account/getaccountbasicinfo?access_token=%v", c.GetAuthorizerAccessToken()), map[string]interface{}{}, http.MethodGet)
request, err := c.request(ctx, fmt.Sprintf(apiUrl+"/cgi-bin/account/getaccountbasicinfo?access_token=%v", c.GetAuthorizerAccessToken(ctx)), map[string]interface{}{}, http.MethodGet)
// 定义
var response CgiBinAccountGetAccountBasicInfoResponse
err = json.Unmarshal(request.ResponseBody, &response)

@ -36,7 +36,7 @@ func (c *Client) CgiBinComponentApiAuthorizerToken(ctx context.Context, authoriz
param["authorizer_refresh_token"] = authorizerRefreshToken // 授权码, 会在授权成功时返回给第三方平台
params := gorequest.NewParamsWith(param)
// 请求
request, err := c.request(ctx, fmt.Sprintf(apiUrl+"/cgi-bin/component/api_authorizer_token?component_access_token=%v", c.GetComponentAccessToken()), params, http.MethodPost)
request, err := c.request(ctx, fmt.Sprintf(apiUrl+"/cgi-bin/component/api_authorizer_token?component_access_token=%v", c.GetComponentAccessToken(ctx)), params, http.MethodPost)
// 定义
var response CgiBinComponentApiAuthorizerTokenResponse
err = json.Unmarshal(request.ResponseBody, &response)

@ -28,9 +28,9 @@ func newCgiBinComponentApiComponentTokenResult(result CgiBinComponentApiComponen
func (c *Client) CgiBinComponentApiComponentToken(ctx context.Context) *CgiBinComponentApiComponentTokenResult {
// 参数
param := gorequest.NewParams()
param["component_appid"] = c.config.ComponentAppId // 第三方平台 appid
param["component_appsecret"] = c.config.ComponentAppSecret // 第三方平台 appsecret
param["component_verify_ticket"] = c.GetComponentVerifyTicket() // 微信后台推送的 ticket
param["component_appid"] = c.config.ComponentAppId // 第三方平台 appid
param["component_appsecret"] = c.config.ComponentAppSecret // 第三方平台 appsecret
param["component_verify_ticket"] = c.GetComponentVerifyTicket(ctx) // 微信后台推送的 ticket
params := gorequest.NewParamsWith(param)
// 请求
request, err := c.request(ctx, apiUrl+"/cgi-bin/component/api_component_token", params, http.MethodPost)

@ -32,7 +32,7 @@ func (c *Client) CgiBinComponentApiCreatePreAuthCoden(ctx context.Context) *CgiB
param["component_appid"] = c.config.ComponentAppId // 第三方平台 appid
params := gorequest.NewParamsWith(param)
// 请求
request, err := c.request(ctx, fmt.Sprintf(apiUrl+"/cgi-bin/component/api_create_preauthcode?component_access_token=%v", c.GetComponentAccessToken()), params, http.MethodPost)
request, err := c.request(ctx, fmt.Sprintf(apiUrl+"/cgi-bin/component/api_create_preauthcode?component_access_token=%v", c.GetComponentAccessToken(ctx)), params, http.MethodPost)
// 定义
var response CgiBinComponentApiCreatePreAuthCodenResponse
err = json.Unmarshal(request.ResponseBody, &response)

@ -91,7 +91,7 @@ func (c *Client) CgiBinComponentApiGetAuthorizerInfo(ctx context.Context) *CgiBi
param["authorizer_appid"] = c.config.AuthorizerAppid // 授权方 appid
params := gorequest.NewParamsWith(param)
// 请求
request, err := c.request(ctx, fmt.Sprintf(apiUrl+"/cgi-bin/component/api_get_authorizer_info?component_access_token=%v", c.GetComponentAccessToken()), params, http.MethodPost)
request, err := c.request(ctx, fmt.Sprintf(apiUrl+"/cgi-bin/component/api_get_authorizer_info?component_access_token=%v", c.GetComponentAccessToken(ctx)), params, http.MethodPost)
// 定义
var response CgiBinComponentApiGetAuthorizerInfoResponse
err = json.Unmarshal(request.ResponseBody, &response)

@ -47,7 +47,7 @@ func (c *Client) CgiBinComponentApiQueryAuth(ctx context.Context, authorizationC
param["authorization_code"] = authorizationCode // 授权码, 会在授权成功时返回给第三方平台
params := gorequest.NewParamsWith(param)
// 请求
request, err := c.request(ctx, fmt.Sprintf(apiUrl+"/cgi-bin/component/api_query_auth?component_access_token=%v", c.GetComponentAccessToken()), params, http.MethodPost)
request, err := c.request(ctx, fmt.Sprintf(apiUrl+"/cgi-bin/component/api_query_auth?component_access_token=%v", c.GetComponentAccessToken(ctx)), params, http.MethodPost)
// 定义
var response CgiBinComponentApiQueryAuthResponse
err = json.Unmarshal(request.ResponseBody, &response)

@ -64,7 +64,7 @@ func (c *Client) CgiBinComponentGetPrivacySetting(ctx context.Context, privacyVe
params := gorequest.NewParams()
params["privacy_ver"] = privacyVer
// 请求
request, err := c.request(ctx, fmt.Sprintf(apiUrl+"/cgi-bin/component/getprivacysetting?access_token=%s", c.GetAuthorizerAccessToken()), params, http.MethodPost)
request, err := c.request(ctx, fmt.Sprintf(apiUrl+"/cgi-bin/component/getprivacysetting?access_token=%s", c.GetAuthorizerAccessToken(ctx)), params, http.MethodPost)
// 定义
var response CgiBinComponentGetPrivacySettingResponse
err = json.Unmarshal(request.ResponseBody, &response)

@ -30,7 +30,7 @@ func (c *Client) CgiBinComponentSetPrivacySetting(ctx context.Context, notMustPa
// 参数
params := gorequest.NewParamsWith(notMustParams...)
// 请求
request, err := c.request(ctx, fmt.Sprintf(apiUrl+"/cgi-bin/component/setprivacysetting?access_token=%s", c.GetAuthorizerAccessToken()), params, http.MethodPost)
request, err := c.request(ctx, fmt.Sprintf(apiUrl+"/cgi-bin/component/setprivacysetting?access_token=%s", c.GetAuthorizerAccessToken(ctx)), params, http.MethodPost)
// 定义
var response CgiBinComponentSetPrivacySettingResponse
err = json.Unmarshal(request.ResponseBody, &response)

@ -33,7 +33,7 @@ func (c *Client) CgiBinShortUrl(ctx context.Context, longUrl string) *CgiBinShor
params["action"] = "long2short" // 此处填long2short代表长链接转短链接
params["long_url"] = longUrl // 需要转换的长链接支持http://、https://、weixin://wxpay 格式的url
// 请求
request, err := c.request(ctx, fmt.Sprintf(apiUrl+"/cgi-bin/shorturl?access_token=%s", c.GetAuthorizerAccessToken()), params, http.MethodPost)
request, err := c.request(ctx, fmt.Sprintf(apiUrl+"/cgi-bin/shorturl?access_token=%s", c.GetAuthorizerAccessToken(ctx)), params, http.MethodPost)
// 定义
var response CgiBinShortUrlResponse
err = json.Unmarshal(request.ResponseBody, &response)

@ -30,7 +30,7 @@ func (c *Client) CgiBinWxOpenQrCodeJumpAdd(ctx context.Context, notMustParams ..
// 参数
params := gorequest.NewParamsWith(notMustParams...)
// 请求
request, err := c.request(ctx, fmt.Sprintf(apiUrl+"/cgi-bin/wxopen/qrcodejumpadd?access_token=%s", c.GetAuthorizerAccessToken()), params, http.MethodPost)
request, err := c.request(ctx, fmt.Sprintf(apiUrl+"/cgi-bin/wxopen/qrcodejumpadd?access_token=%s", c.GetAuthorizerAccessToken(ctx)), params, http.MethodPost)
// 定义
var response CgiBinWxOpenQrCodeJumpAddResponse
err = json.Unmarshal(request.ResponseBody, &response)

@ -31,7 +31,7 @@ func (c *Client) CgiBinWxOpenQrCodeJumpDelete(ctx context.Context, prefix string
params := gorequest.NewParams()
params["prefix"] = prefix
// 请求
request, err := c.request(ctx, fmt.Sprintf(apiUrl+"/cgi-bin/wxopen/qrcodejumpdelete?access_token=%s", c.GetAuthorizerAccessToken()), params, http.MethodPost)
request, err := c.request(ctx, fmt.Sprintf(apiUrl+"/cgi-bin/wxopen/qrcodejumpdelete?access_token=%s", c.GetAuthorizerAccessToken(ctx)), params, http.MethodPost)
// 定义
var response CgiBinWxOpenQrCodeJumpDeleteResponse
err = json.Unmarshal(request.ResponseBody, &response)

@ -32,7 +32,7 @@ func (c *Client) CgiBinWxOpenQrCodeJumpDownload(ctx context.Context) *CgiBinWxOp
// 参数
params := gorequest.NewParams()
// 请求
request, err := c.request(ctx, fmt.Sprintf(apiUrl+"/cgi-bin/wxopen/qrcodejumpdownload?access_token=%s", c.GetAuthorizerAccessToken()), params, http.MethodPost)
request, err := c.request(ctx, fmt.Sprintf(apiUrl+"/cgi-bin/wxopen/qrcodejumpdownload?access_token=%s", c.GetAuthorizerAccessToken(ctx)), params, http.MethodPost)
// 定义
var response CgiBinWxOpenQrCodeJumpDownloadResponse
err = json.Unmarshal(request.ResponseBody, &response)

@ -41,7 +41,7 @@ func (c *Client) CgiBinWxOpenQrCodeJumpGet(ctx context.Context) *CgiBinWxOpenQrC
// 参数
params := gorequest.NewParams()
// 请求
request, err := c.request(ctx, fmt.Sprintf(apiUrl+"/cgi-bin/wxopen/qrcodejumpget?access_token=%s", c.GetAuthorizerAccessToken()), params, http.MethodPost)
request, err := c.request(ctx, fmt.Sprintf(apiUrl+"/cgi-bin/wxopen/qrcodejumpget?access_token=%s", c.GetAuthorizerAccessToken(ctx)), params, http.MethodPost)
// 定义
var response CgiBinWxOpenQrCodeJumpGetResponse
err = json.Unmarshal(request.ResponseBody, &response)

@ -31,7 +31,7 @@ func (c *Client) CgiBinWxOpenQrCodeJumpPublish(ctx context.Context, prefix strin
params := gorequest.NewParams()
params["prefix"] = prefix
// 请求
request, err := c.request(ctx, fmt.Sprintf(apiUrl+"/cgi-bin/wxopen/qrcodejumppublish?access_token=%s", c.GetAuthorizerAccessToken()), params, http.MethodPost)
request, err := c.request(ctx, fmt.Sprintf(apiUrl+"/cgi-bin/wxopen/qrcodejumppublish?access_token=%s", c.GetAuthorizerAccessToken(ctx)), params, http.MethodPost)
// 定义
var response CgiBinWxOpenQrCodeJumpPublishResponse
err = json.Unmarshal(request.ResponseBody, &response)

@ -8,4 +8,4 @@ const (
logTable = "wechatopen"
)
const Version = "1.0.7"
const Version = "1.0.8"

@ -4,7 +4,7 @@ go 1.19
require (
github.com/mitchellh/mapstructure v1.5.0
go.dtapp.net/dorm v1.0.16
go.dtapp.net/dorm v1.0.17
go.dtapp.net/golog v1.0.22
go.dtapp.net/gorequest v1.0.24
gorm.io/gorm v1.23.8

@ -185,7 +185,6 @@ github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANyt
github.com/influxdata/influxdb1-client v0.0.0-20191209144304-8bf82d3c094d/go.mod h1:qj24IKcXYK6Iy9ceXlo3Tc+vtHo9lIhSX5JddghvEPo=
github.com/ipfs/go-detect-race v0.0.1 h1:qX/xay2W3E4Q1U7d9lNs1sU9nvguX0a7319XbyQ6cOk=
github.com/ipfs/go-detect-race v0.0.1/go.mod h1:8BNT7shDZPo99Q74BpGMK+4D8Mn4j46UU0LZ723meps=
github.com/jackc/chunkreader v1.0.0 h1:4s39bBR8ByfqH+DKm8rQA3E1LHZWB9XWcrz8fqaZbe0=
github.com/jackc/chunkreader v1.0.0/go.mod h1:RT6O25fNZIuasFJRyZ4R/Y2BbhasbmZXF9QQ7T3kePo=
github.com/jackc/chunkreader/v2 v2.0.0/go.mod h1:odVSm741yZoC3dpHEUXIqA9tQRhFrgOHwnPIn9lDKlk=
github.com/jackc/chunkreader/v2 v2.0.1 h1:i+RDz65UE+mmpjTfyz0MoVTnzeYxroil2G82ki7MGG8=
@ -212,7 +211,6 @@ github.com/jackc/pgmock v0.0.0-20210724152146-4ad1a8207f65 h1:DadwsjnMwFjfWc9y5W
github.com/jackc/pgmock v0.0.0-20210724152146-4ad1a8207f65/go.mod h1:5R2h2EEX+qri8jOWMbJCtaPWkrrNc7OHwsp2TCqp7ak=
github.com/jackc/pgpassfile v1.0.0 h1:/6Hmqy13Ss2zCq62VdNG8tM1wchn8zjSGOBJ6icpsIM=
github.com/jackc/pgpassfile v1.0.0/go.mod h1:CEx0iS5ambNFdcRtxPj5JhEz+xB6uRky5eyVu/W2HEg=
github.com/jackc/pgproto3 v1.1.0 h1:FYYE4yRw+AgI8wXIinMlNjBbp/UitDJwfj5LqqewP1A=
github.com/jackc/pgproto3 v1.1.0/go.mod h1:eR5FA3leWg7p9aeAqi37XOTgTIbkABlvcPB3E5rlc78=
github.com/jackc/pgproto3/v2 v2.0.0-alpha1.0.20190420180111-c116219b62db/go.mod h1:bhq50y+xrl9n5mRYyCBFKkpRVTLYJVWeCc+mEAI3yXA=
github.com/jackc/pgproto3/v2 v2.0.0-alpha1.0.20190609003834-432c2951c711/go.mod h1:uH0AWtUmuShn0bcesswc4aBTWGvw0cAxIJp+6OB//Wg=
@ -470,7 +468,6 @@ github.com/tidwall/pretty v1.0.0/go.mod h1:XNkn88O1ChpSDQmQeStsy+sBenx6DDtFZJxhV
github.com/tmc/grpc-websocket-proxy v0.0.0-20170815181823-89b8d40f7ca8/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U=
github.com/tmthrgd/go-hex v0.0.0-20190904060850-447a3041c3bc h1:9lRDQMhESg+zvGYmW5DyG0UqvY96Bu5QYsTLvCHdrgo=
github.com/tmthrgd/go-hex v0.0.0-20190904060850-447a3041c3bc/go.mod h1:bciPuU6GHm1iF1pBvUfxfsH0Wmnc2VbpgvbI9ZWuIRs=
github.com/ugorji/go v1.2.7 h1:qYhyWUUd6WbiM+C6JZAUkIJt/1WrjzNHY9+KCIjVqTo=
github.com/ugorji/go v1.2.7/go.mod h1:nF9osbDWLy6bDVv/Rtoh6QgnvNDpmCalQV5urGCCS6M=
github.com/ugorji/go/codec v1.2.7 h1:YPXUKf7fYbp/y8xloBqZOw2qaVggbfwMlI8WM3wZUJ0=
github.com/ugorji/go/codec v1.2.7/go.mod h1:WGN1fab3R1fzQlVQTkfxVtIBhWDRqOviHU95kRgeqEY=
@ -505,16 +502,12 @@ github.com/youmark/pkcs8 v0.0.0-20201027041543-1326539a0a0a/go.mod h1:ul22v+Nro/
github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
github.com/zenazn/goji v0.9.0/go.mod h1:7S9M489iMyHBNxwZnk9/EHS098H4/F6TATF2mIxtB1Q=
github.com/ziutek/mymysql v1.5.4/go.mod h1:LMSpPZ6DbqWFxNCHW77HeMg9I646SAhApZ/wKdgO/C0=
go.dtapp.net/dorm v1.0.14 h1:HDsaMwKGlKFKt59Y3hPI9aVnSjfXOyjoHw2uoXErKEo=
go.dtapp.net/dorm v1.0.14/go.mod h1:bHG7BmgeLaAlc56myYF63lwZAIuMeWRAqHBb/L84dLM=
go.dtapp.net/dorm v1.0.16 h1:aLBW9mgXjN9enV7cAqNpErQPDZk1oM6JxX62vz6hTdQ=
go.dtapp.net/dorm v1.0.16/go.mod h1:bHG7BmgeLaAlc56myYF63lwZAIuMeWRAqHBb/L84dLM=
go.dtapp.net/dorm v1.0.17 h1:3VQKUl05CDxFg3T1c/M8wYf2I+H+oVGBDh4NCV30nn0=
go.dtapp.net/dorm v1.0.17/go.mod h1:bHG7BmgeLaAlc56myYF63lwZAIuMeWRAqHBb/L84dLM=
go.dtapp.net/goip v1.0.24 h1:62k3xt9I/YLUwA5tLp7YC8XPskkswc4RJrvxRRxjwIY=
go.dtapp.net/goip v1.0.24/go.mod h1:tps0yoq5kSykLGDb01vuai47hzAQ6nYUPFWLdlQA2Oo=
go.dtapp.net/gojson v1.0.1 h1:MHeSGlq1KxzL7rCkm18fhwW4GNORHohdDMmxY5PupKY=
go.dtapp.net/gojson v1.0.1/go.mod h1:TkkpTNxHBKxul0e7gC5MrL1K4ICFB9mQ7wHzjBah3/k=
go.dtapp.net/golog v1.0.21 h1:pSGmDz3SJTH7M/NvVLZb+YJd8uNl5g18aORibuaY2JU=
go.dtapp.net/golog v1.0.21/go.mod h1:Wxm2Kh77JN5zFDZ72el9E9c/YkoJnOvHVusB7SqvoC8=
go.dtapp.net/golog v1.0.22 h1:sOJr5f/iLk/6irT/RuwTQSTwvL2DR8SIhzMsKdHo0Ic=
go.dtapp.net/golog v1.0.22/go.mod h1:sbn2WQXmlukcZ4T3Kz9iWOSznL8H3RCkD+1nicZHMfI=
go.dtapp.net/gorandom v1.0.1 h1:IWfMClh1ECPvyUjlqD7MwLq4mZdUusD1qAwAdsvEJBs=
@ -539,8 +532,6 @@ go.uber.org/atomic v1.4.0/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE=
go.uber.org/atomic v1.5.0/go.mod h1:sABNBOSYdrvTF6hTgEIbc7YasKWGhgEQZyfxyTvoXHQ=
go.uber.org/atomic v1.6.0/go.mod h1:sABNBOSYdrvTF6hTgEIbc7YasKWGhgEQZyfxyTvoXHQ=
go.uber.org/atomic v1.7.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc=
go.uber.org/atomic v1.9.0 h1:ECmE8Bn/WFTYwEW/bpKD3M8VtR/zQVbavAoalC1PYyE=
go.uber.org/atomic v1.9.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc=
go.uber.org/atomic v1.10.0 h1:9qC72Qh0+3MqyJbAn8YU5xVq1frD8bn3JtD2oXtafVQ=
go.uber.org/atomic v1.10.0/go.mod h1:LUxbIzbOniOlMKjJjyPfpl4v+PKK2cNJn91OQbhoJI0=
go.uber.org/goleak v1.1.11 h1:wy28qYRKZgnJTxGxvye5/wgWr1EKjmUDGYox5mGlRlI=
@ -613,8 +604,6 @@ golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwY
golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
golang.org/x/net v0.0.0-20210610132358-84b48f89b13b/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
golang.org/x/net v0.0.0-20220809184613-07c6da5e1ced h1:3dYNDff0VT5xj+mbj2XucFst9WKk6PdGOrb9n+SbIvw=
golang.org/x/net v0.0.0-20220809184613-07c6da5e1ced/go.mod h1:YDH+HFinaLZZlnHAfSS6ZXJJ9M9t4Dl22yv3iI2vPwk=
golang.org/x/net v0.0.0-20220811182439-13a9a731de15 h1:cik0bxZUSJVDyaHf1hZPSDsU8SZHGQZQMeueXCE7yBQ=
golang.org/x/net v0.0.0-20220811182439-13a9a731de15/go.mod h1:YDH+HFinaLZZlnHAfSS6ZXJJ9M9t4Dl22yv3iI2vPwk=
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
@ -661,8 +650,6 @@ golang.org/x/sys v0.0.0-20210902050250-f475640dd07b/go.mod h1:oPkhp1MJrh7nUepCBc
golang.org/x/sys v0.0.0-20211007075335-d3039528d8ac/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20211210111614-af8b64212486/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220808155132-1c4a2a72c664 h1:v1W7bwXHsnLLloWYTVEdvGvA7BHMeBYsPcF0GLDxIRs=
golang.org/x/sys v0.0.0-20220808155132-1c4a2a72c664/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab h1:2QkjZIsXupsJbJIdSjjUOgWK3aEtzyuh2mPt3l/CkeU=
golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw=

@ -12,20 +12,20 @@ func (c *Client) getComponentVerifyTicketCacheKeyName() string {
}
// SetComponentVerifyTicket 设置微信后台推送的ticke
func (c *Client) SetComponentVerifyTicket(componentVerifyTicket string) string {
func (c *Client) SetComponentVerifyTicket(ctx context.Context, componentVerifyTicket string) string {
if componentVerifyTicket == "" {
return ""
}
c.config.RedisClient.Db.Set(context.Background(), c.getComponentVerifyTicketCacheKeyName(), componentVerifyTicket, time.Hour*12)
return c.GetComponentVerifyTicket()
c.config.RedisClient.Set(ctx, c.getComponentVerifyTicketCacheKeyName(), componentVerifyTicket, time.Hour*12)
return c.GetComponentVerifyTicket(ctx)
}
// GetComponentVerifyTicket 获取微信后台推送的ticke
func (c *Client) GetComponentVerifyTicket() string {
func (c *Client) GetComponentVerifyTicket(ctx context.Context) string {
if c.config.RedisClient.Db == nil {
return c.config.ComponentVerifyTicket
}
result, _ := c.config.RedisClient.Db.Get(context.Background(), c.getComponentVerifyTicketCacheKeyName()).Result()
result, _ := c.config.RedisClient.Get(ctx, c.getComponentVerifyTicketCacheKeyName()).Result()
return result
}
@ -35,34 +35,34 @@ func (c *Client) getComponentAccessTokenCacheKeyName() string {
}
// SetComponentAccessToken 设置令牌
func (c *Client) SetComponentAccessToken(componentAccessToken string) string {
func (c *Client) SetComponentAccessToken(ctx context.Context, componentAccessToken string) string {
if componentAccessToken == "" {
return ""
}
c.config.RedisClient.Db.Set(context.Background(), c.getComponentAccessTokenCacheKeyName(), componentAccessToken, time.Second*7200)
return c.GetComponentAccessToken()
c.config.RedisClient.Set(ctx, c.getComponentAccessTokenCacheKeyName(), componentAccessToken, time.Second*7200)
return c.GetComponentAccessToken(ctx)
}
// GetComponentAccessToken 获取令牌
func (c *Client) GetComponentAccessToken() string {
func (c *Client) GetComponentAccessToken(ctx context.Context) string {
if c.config.RedisClient.Db == nil {
return c.config.ComponentAccessToken
}
result, _ := c.config.RedisClient.Db.Get(context.Background(), c.getComponentAccessTokenCacheKeyName()).Result()
result, _ := c.config.RedisClient.Db.Get(ctx, c.getComponentAccessTokenCacheKeyName()).Result()
return result
}
// MonitorComponentAccessToken 监控令牌
func (c *Client) MonitorComponentAccessToken() string {
func (c *Client) MonitorComponentAccessToken(ctx context.Context) string {
// 查询
componentAccessToken := c.GetComponentAccessToken()
componentAccessToken := c.GetComponentAccessToken(ctx)
// 判断
result := c.CgiBinGetApiDomainIp(componentAccessToken)
result := c.CgiBinGetApiDomainIp(ctx, componentAccessToken)
if len(result.Result.IpList) > 0 {
return componentAccessToken
}
// 重新获取
return c.SetComponentAccessToken(c.CgiBinComponentApiComponentToken().Result.ComponentAccessToken)
return c.SetComponentAccessToken(ctx, c.CgiBinComponentApiComponentToken(ctx).Result.ComponentAccessToken)
}
// 授权方令牌
@ -71,33 +71,33 @@ func (c *Client) getAuthorizerAccessTokenCacheKeyName() string {
}
// SetAuthorizerAccessToken 设置授权方令牌
func (c *Client) SetAuthorizerAccessToken(authorizerAccessToken string) string {
func (c *Client) SetAuthorizerAccessToken(ctx context.Context, authorizerAccessToken string) string {
if authorizerAccessToken == "" {
return ""
}
c.config.RedisClient.Db.Set(context.Background(), c.getAuthorizerAccessTokenCacheKeyName(), authorizerAccessToken, time.Hour*2)
return c.GetComponentAccessToken()
c.config.RedisClient.Set(ctx, c.getAuthorizerAccessTokenCacheKeyName(), authorizerAccessToken, time.Hour*2)
return c.GetComponentAccessToken(ctx)
}
// GetAuthorizerAccessToken 获取授权方令牌
func (c *Client) GetAuthorizerAccessToken() string {
func (c *Client) GetAuthorizerAccessToken(ctx context.Context) string {
if c.config.RedisClient.Db == nil {
return c.config.AuthorizerAccessToken
}
result, _ := c.config.RedisClient.Db.Get(context.Background(), c.getAuthorizerAccessTokenCacheKeyName()).Result()
result, _ := c.config.RedisClient.Get(ctx, c.getAuthorizerAccessTokenCacheKeyName()).Result()
return result
}
// MonitorAuthorizerAccessToken 监控授权方令牌
func (c *Client) MonitorAuthorizerAccessToken(authorizerRefreshToken string) string {
func (c *Client) MonitorAuthorizerAccessToken(ctx context.Context, authorizerRefreshToken string) string {
// 查询
authorizerAccessToken := c.GetAuthorizerAccessToken()
authorizerAccessToken := c.GetAuthorizerAccessToken(ctx)
// 判断
if authorizerAccessToken != "" {
return authorizerAccessToken
}
// 重新获取
return c.SetAuthorizerAccessToken(c.CgiBinComponentApiAuthorizerToken(authorizerRefreshToken).Result.AuthorizerAccessToken)
return c.SetAuthorizerAccessToken(ctx, c.CgiBinComponentApiAuthorizerToken(ctx, authorizerRefreshToken).Result.AuthorizerAccessToken)
}
// 预授权码
@ -106,36 +106,36 @@ func (c *Client) getPreAuthCodeCacheKeyName() string {
}
// SetPreAuthCode 设置预授权码
func (c *Client) SetPreAuthCode(preAuthCode string) string {
func (c *Client) SetPreAuthCode(ctx context.Context, preAuthCode string) string {
if preAuthCode == "" {
return ""
}
c.config.RedisClient.Db.Set(context.Background(), c.getPreAuthCodeCacheKeyName(), preAuthCode, time.Second*1700)
return c.GetComponentAccessToken()
c.config.RedisClient.Set(ctx, c.getPreAuthCodeCacheKeyName(), preAuthCode, time.Second*1700)
return c.GetComponentAccessToken(ctx)
}
// GetPreAuthCode 获取预授权码
func (c *Client) GetPreAuthCode() string {
func (c *Client) GetPreAuthCode(ctx context.Context) string {
if c.config.RedisClient.Db == nil {
return c.config.AuthorizerAccessToken
}
result, _ := c.config.RedisClient.Db.Get(context.Background(), c.getPreAuthCodeCacheKeyName()).Result()
result, _ := c.config.RedisClient.Get(ctx, c.getPreAuthCodeCacheKeyName()).Result()
return result
}
// DelPreAuthCode 删除预授权码
func (c *Client) DelPreAuthCode() error {
return c.config.RedisClient.Db.Del(context.Background(), c.getPreAuthCodeCacheKeyName()).Err()
func (c *Client) DelPreAuthCode(ctx context.Context) error {
return c.config.RedisClient.Del(ctx, c.getPreAuthCodeCacheKeyName()).Err()
}
// MonitorPreAuthCode 监控预授权码
func (c *Client) MonitorPreAuthCode() string {
func (c *Client) MonitorPreAuthCode(ctx context.Context) string {
// 查询
preAuthCode := c.GetPreAuthCode()
preAuthCode := c.GetPreAuthCode(ctx)
// 判断
if preAuthCode != "" {
return preAuthCode
}
// 重新获取
return c.SetPreAuthCode(c.CgiBinComponentApiCreatePreAuthCoden().Result.PreAuthCode)
return c.SetPreAuthCode(ctx, c.CgiBinComponentApiCreatePreAuthCoden(ctx).Result.PreAuthCode)
}

@ -1,6 +1,7 @@
package wechatopen
import (
"context"
"go.dtapp.net/gorequest"
"log"
"os"
@ -11,7 +12,7 @@ type SaveImgResponse struct {
Name string
}
func (c *Client) SaveImg(resp gorequest.Response, dir, saveName string) SaveImgResponse {
func (c *Client) SaveImg(ctx context.Context, resp gorequest.Response, dir, saveName string) SaveImgResponse {
// 返回是二进制图片或者json错误
if resp.ResponseHeader.Get("Content-Type") == "image/jpeg" || resp.ResponseHeader.Get("Content-Type") == "image/png" {
// 保存在output目录

@ -34,11 +34,11 @@ func newSnsComponentJsCode2sessionResult(result SnsComponentJsCode2sessionRespon
func (c *Client) SnsComponentJsCode2session(ctx context.Context, jsCode string) *SnsComponentJsCode2sessionResult {
// 参数
params := gorequest.NewParams()
params["appid"] = c.config.AuthorizerAppid // 小程序的 appId
params["js_code"] = jsCode // wx.login 获取的 code
params["grant_type"] = "authorization_code" // 填 authorization_code
params["component_appid"] = c.config.ComponentAppId // 第三方平台 appid
params["component_access_token"] = c.GetComponentAccessToken() // 第三方平台的component_access_token
params["appid"] = c.config.AuthorizerAppid // 小程序的 appId
params["js_code"] = jsCode // wx.login 获取的 code
params["grant_type"] = "authorization_code" // 填 authorization_code
params["component_appid"] = c.config.ComponentAppId // 第三方平台 appid
params["component_access_token"] = c.GetComponentAccessToken(ctx) // 第三方平台的component_access_token
// 请求
request, err := c.request(ctx, apiUrl+"/sns/component/jscode2session", params, http.MethodGet)
// 定义

@ -37,7 +37,7 @@ func (c *Client) TckWxPayList(ctx context.Context) *TckWxPayListResult {
// 参数
params := gorequest.NewParams()
// 请求
request, err := c.request(ctx, apiUrl+"/tcb/wxpaylist?access_token="+c.GetComponentAccessToken(), params, http.MethodPost)
request, err := c.request(ctx, apiUrl+"/tcb/wxpaylist?access_token="+c.GetComponentAccessToken(ctx), params, http.MethodPost)
// 定义
var response TckWxPayListResponse
err = json.Unmarshal(request.ResponseBody, &response)

@ -32,7 +32,7 @@ func (c *Client) WxaAddToTemplate(ctx context.Context, draftId string, templateT
params["draft_id"] = draftId
params["template_type"] = templateType
// 请求
request, err := c.request(ctx, fmt.Sprintf(apiUrl+"/wxa/addtotemplate?access_token=%s", c.GetComponentAccessToken()), params, http.MethodPost)
request, err := c.request(ctx, fmt.Sprintf(apiUrl+"/wxa/addtotemplate?access_token=%s", c.GetComponentAccessToken(ctx)), params, http.MethodPost)
// 定义
var response WxaAddToTemplateResponse
err = json.Unmarshal(request.ResponseBody, &response)

@ -32,7 +32,7 @@ func (c *Client) WxaBindTester(ctx context.Context, wechatid string) *WxaBindTes
params := gorequest.NewParams()
params["wechatid"] = wechatid
// 请求
request, err := c.request(ctx, fmt.Sprintf(apiUrl+"/wxa/bind_tester?access_token=%s", c.GetAuthorizerAccessToken()), params, http.MethodPost)
request, err := c.request(ctx, fmt.Sprintf(apiUrl+"/wxa/bind_tester?access_token=%s", c.GetAuthorizerAccessToken(ctx)), params, http.MethodPost)
// 定义
var response WxaBindTesterResponse
err = json.Unmarshal(request.ResponseBody, &response)

@ -40,7 +40,7 @@ func (c *Client) WxaBusinessGetUserPhoneNumber(ctx context.Context, code string)
params := gorequest.NewParams()
params.Set("code", code)
// 请求
request, err := c.request(ctx, fmt.Sprintf(apiUrl+"/wxa/business/getuserphonenumber?access_token=%s", c.GetAuthorizerAccessToken()), params, http.MethodPost)
request, err := c.request(ctx, fmt.Sprintf(apiUrl+"/wxa/business/getuserphonenumber?access_token=%s", c.GetAuthorizerAccessToken(ctx)), params, http.MethodPost)
// 定义
var response WxaBusinessGetUserPhoneNumberResponse
err = json.Unmarshal(request.ResponseBody, &response)

@ -30,7 +30,7 @@ func (c *Client) WxaCommit(ctx context.Context, notMustParams ...gorequest.Param
// 参数
params := gorequest.NewParamsWith(notMustParams...)
// 请求
request, err := c.request(ctx, fmt.Sprintf(apiUrl+"/wxa/commit?access_token=%s", c.GetAuthorizerAccessToken()), params, http.MethodPost)
request, err := c.request(ctx, fmt.Sprintf(apiUrl+"/wxa/commit?access_token=%s", c.GetAuthorizerAccessToken(ctx)), params, http.MethodPost)
// 定义
var response WxaCommitResponse
err = json.Unmarshal(request.ResponseBody, &response)

@ -31,7 +31,7 @@ func (c *Client) WxaDeleteTemplate(ctx context.Context, templateId string) *WxaD
params := gorequest.NewParams()
params.Set("template_id", templateId)
// 请求
request, err := c.request(ctx, fmt.Sprintf(apiUrl+"/wxa/deletetemplate?access_token=%s", c.GetComponentAccessToken()), params, http.MethodPost)
request, err := c.request(ctx, fmt.Sprintf(apiUrl+"/wxa/deletetemplate?access_token=%s", c.GetComponentAccessToken(ctx)), params, http.MethodPost)
// 定义
var response WxaDeleteTemplateResponse
err = json.Unmarshal(request.ResponseBody, &response)

@ -35,7 +35,7 @@ func (c *Client) WxaGetAuditStatus(ctx context.Context, auditid int64) *WxaGetAu
params := gorequest.NewParams()
params.Set("auditid", auditid)
// 请求
request, err := c.request(ctx, fmt.Sprintf(apiUrl+"/wxa/get_auditstatus?access_token=%s", c.GetAuthorizerAccessToken()), params, http.MethodPost)
request, err := c.request(ctx, fmt.Sprintf(apiUrl+"/wxa/get_auditstatus?access_token=%s", c.GetAuthorizerAccessToken(ctx)), params, http.MethodPost)
// 定义
var response WxaGetAuditStatusResponse
err = json.Unmarshal(request.ResponseBody, &response)

@ -36,7 +36,7 @@ func newWxaGetCategoryResult(result WxaGetCategoryResponse, body []byte, http go
// https://developers.weixin.qq.com/doc/oplatform/Third-party_Platforms/2.0/api/category/get_category.html
func (c *Client) WxaGetCategory(ctx context.Context) *WxaGetCategoryResult {
// 请求
request, err := c.request(ctx, fmt.Sprintf(apiUrl+"/wxa/get_category?access_token=%s", c.GetAuthorizerAccessToken()), map[string]interface{}{}, http.MethodGet)
request, err := c.request(ctx, fmt.Sprintf(apiUrl+"/wxa/get_category?access_token=%s", c.GetAuthorizerAccessToken(ctx)), map[string]interface{}{}, http.MethodGet)
// 定义
var response WxaGetCategoryResponse
err = json.Unmarshal(request.ResponseBody, &response)

@ -54,7 +54,7 @@ func (c *Client) WxaGetEffectiveDomain(ctx context.Context, notMustParams ...gor
// 参数
params := gorequest.NewParamsWith(notMustParams...)
// 请求
request, err := c.request(ctx, fmt.Sprintf(apiUrl+"/wxa/get_effective_domain?access_token=%s", c.GetAuthorizerAccessToken()), params, http.MethodPost)
request, err := c.request(ctx, fmt.Sprintf(apiUrl+"/wxa/get_effective_domain?access_token=%s", c.GetAuthorizerAccessToken(ctx)), params, http.MethodPost)
// 定义
var response WxaGetEffectiveDomainResponse
err = json.Unmarshal(request.ResponseBody, &response)

@ -32,7 +32,7 @@ func newWxaGetLatestAuditStatusResult(result WxaGetLatestAuditStatusResponse, bo
// https://developers.weixin.qq.com/doc/oplatform/Third-party_Platforms/2.0/api/code/get_auditstatus.html
func (c *Client) WxaGetLatestAuditStatus(ctx context.Context) *WxaGetLatestAuditStatusResult {
// 请求
request, err := c.request(ctx, fmt.Sprintf(apiUrl+"/wxa/get_latest_auditstatus?access_token=%s", c.GetAuthorizerAccessToken()), map[string]interface{}{}, http.MethodPost)
request, err := c.request(ctx, fmt.Sprintf(apiUrl+"/wxa/get_latest_auditstatus?access_token=%s", c.GetAuthorizerAccessToken(ctx)), map[string]interface{}{}, http.MethodPost)
// 定义
var response WxaGetLatestAuditStatusResponse
err = json.Unmarshal(request.ResponseBody, &response)

@ -29,7 +29,7 @@ func newWxaGetPageResult(result WxaGetPageResponse, body []byte, http gorequest.
// https://developers.weixin.qq.com/doc/oplatform/Third-party_Platforms/2.0/api/code/get_page.html
func (c *Client) WxaGetPage(ctx context.Context) *WxaGetPageResult {
// 请求
request, err := c.request(ctx, fmt.Sprintf(apiUrl+"/wxa/get_page?access_token=%s", c.GetAuthorizerAccessToken()), map[string]interface{}{}, http.MethodGet)
request, err := c.request(ctx, fmt.Sprintf(apiUrl+"/wxa/get_page?access_token=%s", c.GetAuthorizerAccessToken(ctx)), map[string]interface{}{}, http.MethodGet)
// 定义
var response WxaGetPageResponse
err = json.Unmarshal(request.ResponseBody, &response)

@ -33,7 +33,7 @@ func (c *Client) WxaGetQrcode(ctx context.Context, path string) *WxaGetQrcodeRes
params["path"] = path // 指定二维码扫码后直接进入指定页面并可同时带上参数)
}
// 请求
request, err := c.request(ctx, fmt.Sprintf(apiUrl+"/wxa/get_qrcode?access_token=%s", c.GetAuthorizerAccessToken()), params, http.MethodGet)
request, err := c.request(ctx, fmt.Sprintf(apiUrl+"/wxa/get_qrcode?access_token=%s", c.GetAuthorizerAccessToken(ctx)), params, http.MethodGet)
// 定义
var response WxaGetQrcodeResponse
err = json.Unmarshal(request.ResponseBody, &response)

@ -38,7 +38,7 @@ func newWxaGetTemplateDraftListResult(result WxaGetTemplateDraftListResponse, bo
// https://developers.weixin.qq.com/doc/oplatform/Third-party_Platforms/2.0/api/ThirdParty/code_template/gettemplatedraftlist.html
func (c *Client) WxaGetTemplateDraftList(ctx context.Context) *WxaGetTemplateDraftListResult {
// 请求
request, err := c.request(ctx, fmt.Sprintf(apiUrl+"/wxa/gettemplatedraftlist?access_token=%s", c.GetComponentAccessToken()), map[string]interface{}{}, http.MethodGet)
request, err := c.request(ctx, fmt.Sprintf(apiUrl+"/wxa/gettemplatedraftlist?access_token=%s", c.GetComponentAccessToken(ctx)), map[string]interface{}{}, http.MethodGet)
// 定义
var response WxaGetTemplateDraftListResponse
err = json.Unmarshal(request.ResponseBody, &response)

@ -39,7 +39,7 @@ func newWxaGetTemplateListResult(result WxaGetTemplateListResponse, body []byte,
// https://developers.weixin.qq.com/doc/oplatform/Third-party_Platforms/2.0/api/ThirdParty/code_template/gettemplatelist.html
func (c *Client) WxaGetTemplateList(ctx context.Context) *WxaGetTemplateListResult {
// 请求
request, err := c.request(ctx, fmt.Sprintf(apiUrl+"/wxa/gettemplatelist?access_token=%s", c.GetComponentAccessToken()), map[string]interface{}{}, http.MethodGet)
request, err := c.request(ctx, fmt.Sprintf(apiUrl+"/wxa/gettemplatelist?access_token=%s", c.GetComponentAccessToken(ctx)), map[string]interface{}{}, http.MethodGet)
// 定义
var response WxaGetTemplateListResponse
err = json.Unmarshal(request.ResponseBody, &response)

@ -38,7 +38,7 @@ func newWxaGetVersionInfoResult(result WxaGetVersionInfoResponse, body []byte, h
// WxaGetVersionInfo 查询小程序版本信息
// https://developers.weixin.qq.com/doc/oplatform/Third-party_Platforms/2.0/api/code/get_versioninfo.html
func (c *Client) WxaGetVersionInfo(ctx context.Context) *WxaGetVersionInfoResult {
accessToken := c.GetAuthorizerAccessToken()
accessToken := c.GetAuthorizerAccessToken(ctx)
if accessToken == "" {
return newWxaGetVersionInfoResult(WxaGetVersionInfoResponse{}, nil, gorequest.Response{}, errors.New("访问令牌为空"))
}

@ -32,7 +32,7 @@ func (c *Client) WxaGetWxaCodeUnLimit(ctx context.Context, notMustParams ...gore
// 参数
params := gorequest.NewParamsWith(notMustParams...)
// 请求
request, err := c.request(ctx, fmt.Sprintf(apiUrl+"/wxa/getwxacodeunlimit?access_token=%s", c.GetAuthorizerAccessToken()), params, http.MethodPost)
request, err := c.request(ctx, fmt.Sprintf(apiUrl+"/wxa/getwxacodeunlimit?access_token=%s", c.GetAuthorizerAccessToken(ctx)), params, http.MethodPost)
// 定义
var response WxaGetWxaCodeUnLimitResponse
err = json.Unmarshal(request.ResponseBody, &response)

@ -31,7 +31,7 @@ func newWxaMemberAuthResult(result WxaMemberAuthResponse, body []byte, http gore
// WxaMemberAuth 获取体验者列表
// https://developers.weixin.qq.com/doc/oplatform/Third-party_Platforms/2.0/api/Mini_Program_AdminManagement/memberauth.html
func (c *Client) WxaMemberAuth(ctx context.Context) *WxaMemberAuthResult {
accessToken := c.GetAuthorizerAccessToken()
accessToken := c.GetAuthorizerAccessToken(ctx)
if accessToken == "" {
return newWxaMemberAuthResult(WxaMemberAuthResponse{}, nil, gorequest.Response{}, errors.New("访问令牌为空"))
}

@ -43,7 +43,7 @@ func (c *Client) WxaModifyDomain(ctx context.Context, notMustParams ...gorequest
// 参数
params := gorequest.NewParamsWith(notMustParams...)
// 请求
request, err := c.request(ctx, fmt.Sprintf(apiUrl+"/wxa/modify_domain?access_token=%s", c.GetAuthorizerAccessToken()), params, http.MethodPost)
request, err := c.request(ctx, fmt.Sprintf(apiUrl+"/wxa/modify_domain?access_token=%s", c.GetAuthorizerAccessToken(ctx)), params, http.MethodPost)
// 定义
var response WxaModifyDomainResponse
err = json.Unmarshal(request.ResponseBody, &response)

@ -30,7 +30,7 @@ func (c *Client) WxaModifyDomainDirectly(ctx context.Context, notMustParams ...g
// 参数
params := gorequest.NewParamsWith(notMustParams...)
// 请求
request, err := c.request(ctx, fmt.Sprintf(apiUrl+"/wxa/modify_domain_directly?access_token=%s", c.GetAuthorizerAccessToken()), params, http.MethodPost)
request, err := c.request(ctx, fmt.Sprintf(apiUrl+"/wxa/modify_domain_directly?access_token=%s", c.GetAuthorizerAccessToken(ctx)), params, http.MethodPost)
// 定义
var response WxaModifyDomainDirectlyResponse
err = json.Unmarshal(request.ResponseBody, &response)

@ -30,7 +30,7 @@ func (c *Client) WxaRelease(ctx context.Context) *WxaReleaseResult {
// 参数
params := gorequest.NewParams()
// 请求
request, err := c.request(ctx, fmt.Sprintf(apiUrl+"/wxa/release?access_token=%s", c.GetAuthorizerAccessToken()), params, http.MethodPost)
request, err := c.request(ctx, fmt.Sprintf(apiUrl+"/wxa/release?access_token=%s", c.GetAuthorizerAccessToken(ctx)), params, http.MethodPost)
// 定义
var response WxaReleaseResponse
err = json.Unmarshal(request.ResponseBody, &response)

@ -31,7 +31,7 @@ func (c *Client) WxaSecurityApplyPrivacyInterface(ctx context.Context, notMustPa
// 参数
params := gorequest.NewParamsWith(notMustParams...)
// 请求
request, err := c.request(ctx, fmt.Sprintf(apiUrl+"/wxa/security/apply_privacy_interface?access_token=%s", c.GetAuthorizerAccessToken()), params, http.MethodPost)
request, err := c.request(ctx, fmt.Sprintf(apiUrl+"/wxa/security/apply_privacy_interface?access_token=%s", c.GetAuthorizerAccessToken(ctx)), params, http.MethodPost)
// 定义
var response WxaSecurityApplyPrivacyInterfaceResponse
err = json.Unmarshal(request.ResponseBody, &response)

@ -41,7 +41,7 @@ func (c *Client) WxaSecurityGetPrivacyInterface(ctx context.Context) *WxaSecurit
// 参数
params := gorequest.NewParams()
// 请求
request, err := c.request(ctx, fmt.Sprintf(apiUrl+"/wxa/security/get_privacy_interface?access_token=%s", c.GetAuthorizerAccessToken()), params, http.MethodGet)
request, err := c.request(ctx, fmt.Sprintf(apiUrl+"/wxa/security/get_privacy_interface?access_token=%s", c.GetAuthorizerAccessToken(ctx)), params, http.MethodGet)
// 定义
var response WxaSecurityGetPrivacyInterfaceResponse
err = json.Unmarshal(request.ResponseBody, &response)

@ -31,7 +31,7 @@ func (c *Client) WxaSubmitAudit(ctx context.Context, notMustParams ...gorequest.
// 参数
params := gorequest.NewParamsWith(notMustParams...)
// 请求
request, err := c.request(ctx, fmt.Sprintf(apiUrl+"/wxa/submit_audit?access_token=%s", c.GetAuthorizerAccessToken()), params, http.MethodPost)
request, err := c.request(ctx, fmt.Sprintf(apiUrl+"/wxa/submit_audit?access_token=%s", c.GetAuthorizerAccessToken(ctx)), params, http.MethodPost)
// 定义
var response WxaSubmitAuditResponse
err = json.Unmarshal(request.ResponseBody, &response)

@ -34,7 +34,7 @@ func (c *Client) WxaUnbindTester(ctx context.Context, wechatid, userstr string)
}
params["userstr"] = userstr
// 请求
request, err := c.request(ctx, fmt.Sprintf(apiUrl+"/wxa/unbind_tester?access_token=%s", c.GetAuthorizerAccessToken()), params, http.MethodPost)
request, err := c.request(ctx, fmt.Sprintf(apiUrl+"/wxa/unbind_tester?access_token=%s", c.GetAuthorizerAccessToken(ctx)), params, http.MethodPost)
// 定义
var response WxaUnbindTesterResponse
err = json.Unmarshal(request.ResponseBody, &response)

Loading…
Cancel
Save