You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
wechatoffice/cgi-bin.ticket.getticket.mo...

23 lines
613 B

package wechatoffice
import (
"context"
"errors"
"time"
)
// GetJsapiTicketMonitor 监控api_ticket
func (c *Client) GetJsapiTicketMonitor(ctx context.Context) (string, error) {
if c.cache.redisClient.Db == nil {
return "", errors.New("驱动没有初始化")
}
result := c.DebugCgiBinTicketCheck(ctx)
if result.Result.Errcode == 0 {
return c.config.jsapiTicket, nil
}
c.config.accessToken = c.GetAccessToken(ctx)
token := c.CgiBinTicketGetTicket(ctx, "jsapi")
c.cache.redisClient.Set(ctx, c.getJsapiTicketCacheKeyName(), token.Result.Ticket, time.Second*7000)
return token.Result.Ticket, nil
}