Commit bb93a0f7 by 庄冰

wxtoken

parent c56073b3
...@@ -22,13 +22,14 @@ class WxTokenCache extends CacheBase{ ...@@ -22,13 +22,14 @@ class WxTokenCache extends CacheBase{
var result = await this.redisClient.get(key); var result = await this.redisClient.get(key);
var obj = null; var obj = null;
if(result){ if(result){
console.log(result,"缓存中获取token+++++++++++++++++++++++");
obj=JSON.parse(result); obj=JSON.parse(result);
} }
if(!obj){//无缓存 if(!obj){//无缓存
var newobj = await this.wxTokenSve.getToken(); var newobj = await this.wxTokenSve.getToken();
if(newobj && newobj.access_token){ if(newobj && newobj.access_token){
var newobjstring=JSON.stringify(newobj); var newobjstring=JSON.stringify(newobj);
await this.redisClient.rpushWithEx(key,newobjstring,30); await this.redisClient.rpushWithEx(key,newobjstring,7000);
return newobj; return newobj;
}else{ }else{
return null; return null;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment