JS-SDK

获取js-sdk操作实例

oa := wc.GetOfficialAccount(cfg)
j:=oa.GetJs()

获取js配置

GetConfig(uri string) (config *Config, err error)

其中 Config 结果为:

// Config 返回给用户jssdk配置信息
type Config struct {
    AppID     string `json:"app_id"`
    Timestamp int64  `json:"timestamp"`
    NonceStr  string `json:"nonce_str"`
    Signature string `json:"signature"`
}

替换js-ticket取值方式

默认js-ticket是存放在sdk设置的cache,如果需要自定义取值,可以实现credential.JsTicketHandle接口:

//JsTicketHandle js ticket获取
type JsTicketHandle interface {
    //GetTicket 获取ticket
    GetTicket(accessToken string) (ticket string, err error)
}

然后通过js.SetJsTicketHandle(ticketHandle credential.JsTicketHandle)进行设置

Copyright © Wechat SDK For Go 2020 all right reserved,powered by Gitbook该文件修订时间: 2020-08-12 14:13:08

results matching ""

    No results matching ""