Commit 5a907b45 by 庄冰

feishu

parent cc4d8649
......@@ -21,10 +21,13 @@ class feishuAppAccessTokenCache extends CacheBase{
var result = await this.redisClient.get(key);
return result;
}
async set(accessToken){
async set(accessToken,expire){
if(!expire){
expire=7100;
}
var key = this.prefix;
if(accessToken){
await this.redisClient.setWithEx(key,accessToken,7100);
await this.redisClient.setWithEx(key,accessToken,expire);
}
return accessToken;
}
......
......@@ -2,7 +2,7 @@ const CacheBase=require("../cache.base");
const system=require("../../system");
// const OpenplatformWxop = require("../../wxop/impl/openplatformWxop");
/**
* 飞书小程序--AppTicket缓存--有效时间3500s
* 飞书小程序--AppTicket缓存--有效时间3600s
*/
class feishuAppTicketCache extends CacheBase{
constructor(){
......@@ -24,7 +24,7 @@ class feishuAppTicketCache extends CacheBase{
async set(appTicket){
var key = this.prefix;
if(appTicket){
await this.redisClient.setWithEx(key,appTicket,3500);
await this.redisClient.setWithEx(key,appTicket,3600);
}
return appTicket;
}
......
......@@ -59,7 +59,7 @@ class feishuLoginService{
} catch (e) {
return system.getResultFail(-200,e.stack);
}
return system.getResultFail("获取userpin失败");
return system.getResultFail(-100,"获取userpin失败");
}
//渠道通过账户进行登录,有则返回用户信息,没有则创建用户------>供后端调用
......
......@@ -99,7 +99,7 @@ class UtilsFeishuService{
var result = JSON.parse(rtn.stdout);
if(result.code==0 && result.app_access_token){
//缓存AppAccessToken
await this.cacheManager["feishuAppAccessTokenCache"].set(result.app_access_token);
await this.cacheManager["feishuAppAccessTokenCache"].set(result.app_access_token,result.expire);
return system.getResultSuccess(result.app_access_token);
}
return system.getResultFail("获取appAccessToken失败");
......
......@@ -63,6 +63,7 @@ class ExecClient {
console.log(cmd);
return cmd;
}
//飞书小程序GET请求
FetchFeishuGetCmd(subData, url) {
var cmd = this.cmdFeishuGetPattern.replace(
/\{data\}/g, subData).replace(/\{url\}/g, url).replace(/\{Authorization\}/g, "Bearer "+subData.user_access_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