parent
c1481b9a79
commit
c6dd7830c9
@ -0,0 +1,40 @@
|
||||
package wechatminiprogram
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"net/http"
|
||||
)
|
||||
|
||||
type CgiBinWxaAppCreateWxaQrCodeResponse struct {
|
||||
Errcode int `json:"errcode"`
|
||||
Errmsg string `json:"errmsg"`
|
||||
ContentType string `json:"contentType"`
|
||||
Buffer interface{} `json:"buffer"`
|
||||
}
|
||||
|
||||
type CgiBinWxaAppCreateWxaQrCodeResult struct {
|
||||
Result CgiBinWxaAppCreateWxaQrCodeResponse // 结果
|
||||
Body []byte // 内容
|
||||
Err error // 错误
|
||||
}
|
||||
|
||||
func NewCgiBinWxaAppCreateWxaQrCodeResult(result CgiBinWxaAppCreateWxaQrCodeResponse, body []byte, err error) *CgiBinWxaAppCreateWxaQrCodeResult {
|
||||
return &CgiBinWxaAppCreateWxaQrCodeResult{Result: result, Body: body, Err: err}
|
||||
}
|
||||
|
||||
// CgiBinWxaAppCreateWxaQrCode 获取小程序二维码,适用于需要的码数量较少的业务场景。通过该接口生成的小程序码,永久有效,有数量限制
|
||||
// https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/qr-code/wxacode.createQRCode.html
|
||||
func (app *App) CgiBinWxaAppCreateWxaQrCode(path string, width int) *CgiBinWxaAppCreateWxaQrCodeResult {
|
||||
// 参数
|
||||
param := NewParams()
|
||||
param.Set("path", path)
|
||||
param.Set("width", width)
|
||||
params := app.NewParamsWith(param)
|
||||
// 请求
|
||||
body, err := app.request(fmt.Sprintf("https://api.weixin.qq.com/cgi-bin/wxaapp/createwxaqrcode?access_token=%s", app.AccessToken), params, http.MethodPost)
|
||||
// 定义
|
||||
var response CgiBinWxaAppCreateWxaQrCodeResponse
|
||||
err = json.Unmarshal(body, &response)
|
||||
return NewCgiBinWxaAppCreateWxaQrCodeResult(response, body, err)
|
||||
}
|
@ -0,0 +1,37 @@
|
||||
package wechatminiprogram
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"net/http"
|
||||
)
|
||||
|
||||
type WxaGetWxaCodeResponse struct {
|
||||
Errcode int `json:"errcode"`
|
||||
Errmsg string `json:"errmsg"`
|
||||
ContentType string `json:"contentType"`
|
||||
Buffer interface{} `json:"buffer"`
|
||||
}
|
||||
|
||||
type WxaGetWxaCodeResult struct {
|
||||
Result WxaGetWxaCodeResponse // 结果
|
||||
Body []byte // 内容
|
||||
Err error // 错误
|
||||
}
|
||||
|
||||
func NewWxaGetWxaCodeResult(result WxaGetWxaCodeResponse, body []byte, err error) *WxaGetWxaCodeResult {
|
||||
return &WxaGetWxaCodeResult{Result: result, Body: body, Err: err}
|
||||
}
|
||||
|
||||
// WxaGetWxaCode 获取小程序码,适用于需要的码数量较少的业务场景。通过该接口生成的小程序码,永久有效,有数量限制
|
||||
// https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/qr-code/wxacode.get.html
|
||||
func (app *App) WxaGetWxaCode(notMustParams ...Params) *WxaGetWxaCodeResult {
|
||||
// 参数
|
||||
params := app.NewParamsWith(notMustParams...)
|
||||
// 请求
|
||||
body, err := app.request(fmt.Sprintf("https://api.weixin.qq.com/wxa/getwxacode?access_token=%s", app.AccessToken), params, http.MethodPost)
|
||||
// 定义
|
||||
var response WxaGetWxaCodeResponse
|
||||
err = json.Unmarshal(body, &response)
|
||||
return NewWxaGetWxaCodeResult(response, body, err)
|
||||
}
|
@ -0,0 +1,37 @@
|
||||
package wechatminiprogram
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"net/http"
|
||||
)
|
||||
|
||||
type WxaGetWxaCodeUnLimitResponse struct {
|
||||
Errcode int `json:"errcode"`
|
||||
Errmsg string `json:"errmsg"`
|
||||
ContentType string `json:"contentType"`
|
||||
Buffer interface{} `json:"buffer"`
|
||||
}
|
||||
|
||||
type WxaGetWxaCodeUnLimitResult struct {
|
||||
Result WxaGetWxaCodeUnLimitResponse // 结果
|
||||
Body []byte // 内容
|
||||
Err error // 错误
|
||||
}
|
||||
|
||||
func NewWxaGetWxaCodeUnLimitResult(result WxaGetWxaCodeUnLimitResponse, body []byte, err error) *WxaGetWxaCodeUnLimitResult {
|
||||
return &WxaGetWxaCodeUnLimitResult{Result: result, Body: body, Err: err}
|
||||
}
|
||||
|
||||
// WxaGetWxaCodeUnLimit 获取小程序码,适用于需要的码数量极多的业务场景。通过该接口生成的小程序码,永久有效,数量暂无限制
|
||||
// https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/qr-code/wxacode.getUnlimited.html
|
||||
func (app *App) WxaGetWxaCodeUnLimit(notMustParams ...Params) *WxaGetWxaCodeUnLimitResult {
|
||||
// 参数
|
||||
params := app.NewParamsWith(notMustParams...)
|
||||
// 请求
|
||||
body, err := app.request(fmt.Sprintf("https://api.weixin.qq.com/wxa/getwxacodeunlimit?access_token=%s", app.AccessToken), params, http.MethodPost)
|
||||
// 定义
|
||||
var response WxaGetWxaCodeUnLimitResponse
|
||||
err = json.Unmarshal(body, &response)
|
||||
return NewWxaGetWxaCodeUnLimitResult(response, body, err)
|
||||
}
|
Loading…
Reference in new issue