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.
|
|
|
package wechatoffice
|
|
|
|
|
|
|
|
import (
|
|
|
|
"fmt"
|
|
|
|
"gopkg.in/dtapps/go-library.v3/utils/goredis"
|
|
|
|
"time"
|
|
|
|
)
|
|
|
|
|
|
|
|
// GetJsapiTicketRDb 获取api_ticket
|
|
|
|
func (app *App) GetJsapiTicketRDb() string {
|
|
|
|
cacheName := fmt.Sprintf("wechat_jsapi_ticket:%v", app.AppId)
|
|
|
|
redis := goredis.App{
|
|
|
|
Rdb: app.RDb,
|
|
|
|
}
|
|
|
|
newCache := redis.NewSimpleStringCache(redis.NewStringOperation(), time.Second*7000)
|
|
|
|
newCache.DBGetter = func() string {
|
|
|
|
token := app.GetTicket(app.GetAccessTokenRDb(), "jsapi")
|
|
|
|
return token.Result.Ticket
|
|
|
|
}
|
|
|
|
return newCache.GetCache(cacheName)
|
|
|
|
}
|