Commit 2180a990 by 宋毅

tj

parent 896f8ecd
...@@ -34,7 +34,6 @@ class CacheBase { ...@@ -34,7 +34,6 @@ class CacheBase {
this.redisClient.sadd(this.cacheCacheKeyPrefix, [cachekey + "|" + this.desc]); this.redisClient.sadd(this.cacheCacheKeyPrefix, [cachekey + "|" + this.desc]);
return objval; return objval;
} else { } else {
this.redisClient.set(cachekey, cacheValue, ex);
return JSON.parse(cacheValue); return JSON.parse(cacheValue);
} }
} }
......
...@@ -25,10 +25,18 @@ class OpPlatformUtils { ...@@ -25,10 +25,18 @@ class OpPlatformUtils {
async getReqApiAccessKey(appKey, secret) { async getReqApiAccessKey(appKey, secret) {
var cacheManager = system.getObject("db.common.cacheManager"); var cacheManager = system.getObject("db.common.cacheManager");
var reqApiAccessKey = null; var reqApiAccessKey = null;
appKey = appKey && secret ? appKey : settings.appKey;
var cacheValue = await cacheManager["ApiAccessKeyCache"].getCache(appKey);
if (cacheValue) {
var tmpValue = JSON.parse(cacheValue);
if (tmpValue.status == 0) {
return tmpValue;
}
}
if (appKey && secret) { if (appKey && secret) {
reqApiAccessKey = await cacheManager["ApiAccessKeyCache"].cache(appKey, null, 10, secret); reqApiAccessKey = await cacheManager["ApiAccessKeyCache"].cache(appKey, null, 10, secret);
} else { } else {
reqApiAccessKey = await cacheManager["ApiAccessKeyCache"].cache(settings.appKey, null, 10); reqApiAccessKey = await cacheManager["ApiAccessKeyCache"].cache(appKey, null, 10);
} }
if (!reqApiAccessKey || !reqApiAccessKey.data) { if (!reqApiAccessKey || !reqApiAccessKey.data) {
return system.getResult(null, "获取请求token失败"); return system.getResult(null, "获取请求token失败");
......
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