提交 53784476 authored 作者: 张立波's avatar 张立波

淘特

上级 86576e49
...@@ -20,6 +20,7 @@ type Config struct { ...@@ -20,6 +20,7 @@ type Config struct {
ApiUrl string ApiUrl string
AppKey string AppKey string
AppSecret string AppSecret string
DB int
} }
var server *Config var server *Config
...@@ -30,6 +31,9 @@ const Host = "https://open.huoju6.com/openapi/param2/1/com.huoju6.open/" ...@@ -30,6 +31,9 @@ const Host = "https://open.huoju6.com/openapi/param2/1/com.huoju6.open/"
func New(req *Config) { func New(req *Config) {
server = req server = req
if server.DB == 0 {
server.DB = 10
}
return return
} }
...@@ -156,7 +160,7 @@ func AccessToken(ctx context.Context) (res string, err error) { ...@@ -156,7 +160,7 @@ func AccessToken(ctx context.Context) (res string, err error) {
defer func() { defer func() {
_ = conn.Close() _ = conn.Close()
}() }()
_, _ = conn.DoVar("SELECT", 10) _, _ = conn.DoVar("SELECT", server.DB)
cache, _ := conn.DoVar("HGETALL", CacheKey) cache, _ := conn.DoVar("HGETALL", CacheKey)
if cache.IsEmpty() { if cache.IsEmpty() {
g.Log().Ctx(ctx).Cat(PkgName).Line(true).Info("获取token失败") g.Log().Ctx(ctx).Cat(PkgName).Line(true).Info("获取token失败")
...@@ -186,7 +190,7 @@ func RefreshToken(ctx context.Context) (res *AuthTokenRes, err error) { ...@@ -186,7 +190,7 @@ func RefreshToken(ctx context.Context) (res *AuthTokenRes, err error) {
defer func() { defer func() {
_ = conn.Close() _ = conn.Close()
}() }()
_, _ = conn.DoVar("SELECT", 10) _, _ = conn.DoVar("SELECT", server.DB)
cache, _ := conn.DoVar("HGETALL", CacheKey) cache, _ := conn.DoVar("HGETALL", CacheKey)
if cache.IsEmpty() { if cache.IsEmpty() {
g.Log().Ctx(ctx).Cat(PkgName).Line(true).Info("获取token失败") g.Log().Ctx(ctx).Cat(PkgName).Line(true).Info("获取token失败")
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论