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.
21 lines
517 B
21 lines
517 B
3 years ago
|
package wechatoffice
|
||
|
|
||
|
import (
|
||
|
"fmt"
|
||
|
"gopkg.in/dtapps/go-library.v3/utils/goredis"
|
||
|
)
|
||
|
|
||
|
// 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(), 7000)
|
||
|
newCache.DBGetter = func() string {
|
||
|
token := app.GetTicket(app.GetAccessTokenRDb(), "jsapi")
|
||
|
return token.Result.Ticket
|
||
|
}
|
||
|
return newCache.GetCache(cacheName)
|
||
|
}
|