Commit 10ce8a27 by linboxuan

update getLoginByUserName

parent 3ae4fe68
...@@ -305,6 +305,11 @@ class OpPlatformUtils { ...@@ -305,6 +305,11 @@ class OpPlatformUtils {
var result = await cacheManager["AppUserPinByUserNameCache"].getCache(inputkey); var result = await cacheManager["AppUserPinByUserNameCache"].getCache(inputkey);
if (result && result.status == 0) { if (result && result.status == 0) {
if (result.data.userpin) { if (result.data.userpin) {
// 2020 0723 lin修改 登录并重新设置过期时间
var inputkey = this.getUserPinKey(inputkey);
var userpinKey = this.getUserPinKey(result.data.userpin);
await this.redisClient.setExpire(inputkey, system.exTime);
await this.redisClient.setExpire(userpinKey, system.exTime);
return system.getResultFail(system.reDoLoginFail, "请勿重复处理", { userpin: result.data.userpin || "" }); return system.getResultFail(system.reDoLoginFail, "请勿重复处理", { userpin: result.data.userpin || "" });
} else { } else {
await this.clearLoginCache(inputkey); await this.clearLoginCache(inputkey);
...@@ -387,6 +392,8 @@ class OpPlatformUtils { ...@@ -387,6 +392,8 @@ class OpPlatformUtils {
if (!userInfoResult) { if (!userInfoResult) {
return system.getResultFail(system.noLogin, "user no login"); return system.getResultFail(system.noLogin, "user no login");
} }
// 2020 0723 lin修改 获取账户信息并重新设置过期时间
// await this.redisClient.setExpire(userpinKey, system.exTime);
return JSON.parse(userInfoResult); return JSON.parse(userInfoResult);
} }
/** /**
......
...@@ -248,6 +248,10 @@ class RedisClient { ...@@ -248,6 +248,10 @@ class RedisClient {
console.log("publish--" + channel + ":" + consumetarget); console.log("publish--" + channel + ":" + consumetarget);
return this.client.publishAsync(channel, consumetarget); return this.client.publishAsync(channel, consumetarget);
} }
// 2020 0723 lin 新增 设置过期时间方法
async setExpire(key, t) {
this.client.expire(key, t);
}
} }
module.exports = RedisClient; module.exports = RedisClient;
// var client=new RedisClient(); // var client=new RedisClient();
......
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