MCPcopy
hub / github.com/silenceper/wechat / GetConfig

Method GetConfig

work/jsapi/jsapi.go:38–55  ·  view source on GitHub ↗

GetConfig 获取企业微信JS配置 https://developer.work.weixin.qq.com/document/path/90514

(uri string)

Source from the content-addressed store, hash-verified

36
37// GetConfig 获取企业微信JS配置 https://developer.work.weixin.qq.com/document/path/90514
38func (js *Js) GetConfig(uri string) (config *Config, err error) {
39 config = new(Config)
40 var accessToken string
41 accessToken, err = js.GetAccessToken()
42 if err != nil {
43 return
44 }
45 var ticketStr string
46 ticketStr, err = js.jsTicket.GetTicket(accessToken, credential.TicketTypeCorpJs)
47 if err != nil {
48 return
49 }
50 config.NonceStr = util.RandomStr(16)
51 config.Timestamp = util.GetCurrTS()
52 str := fmt.Sprintf("jsapi_ticket=%s&noncestr=%s&timestamp=%d&url=%s", ticketStr, config.NonceStr, config.Timestamp, uri)
53 config.Signature = util.Signature(str)
54 return
55}
56
57// GetAgentConfig 获取企业微信应用JS配置 https://developer.work.weixin.qq.com/document/path/94313
58func (js *Js) GetAgentConfig(uri string) (config *Config, err error) {

Callers

nothing calls this directly

Calls 5

RandomStrFunction · 0.92
GetCurrTSFunction · 0.92
SignatureFunction · 0.92
GetAccessTokenMethod · 0.65
GetTicketMethod · 0.65

Tested by

no test coverage detected