|
@ -60,7 +60,7 @@ class Users extends RedisModel {
|
|
user.birthdate = res[0].birthdate;
|
|
user.birthdate = res[0].birthdate;
|
|
user.avatar = res[0].avatar;
|
|
user.avatar = res[0].avatar;
|
|
|
|
|
|
if(res[0].openid) user.openid = res[0].openid;
|
|
|
|
|
|
if (res[0].openid) user.openid = res[0].openid;
|
|
}
|
|
}
|
|
|
|
|
|
outCallback(null, user);
|
|
outCallback(null, user);
|
|
@ -108,11 +108,11 @@ class Users extends RedisModel {
|
|
function (userInfo, callback) {
|
|
function (userInfo, callback) {
|
|
let multi = redisConn.multi()
|
|
let multi = redisConn.multi()
|
|
.zadd(usersKey, lastLoginTime.getTime(), userId);
|
|
.zadd(usersKey, lastLoginTime.getTime(), userId);
|
|
/*.hmset(userKey,
|
|
|
|
'avatar', userInfo.avatar ? userInfo.avatar : '',
|
|
|
|
'birthdate', userInfo.birthdate ? ObjectUtil.timestampToLong(userInfo.birthdate) : '',
|
|
|
|
'name', userInfo.name,
|
|
|
|
'role', loginFromApp ? 'doctor' : 'patient');*/
|
|
|
|
|
|
/*.hmset(userKey,
|
|
|
|
'avatar', userInfo.avatar ? userInfo.avatar : '',
|
|
|
|
'birthdate', userInfo.birthdate ? ObjectUtil.timestampToLong(userInfo.birthdate) : '',
|
|
|
|
'name', userInfo.name,
|
|
|
|
'role', loginFromApp ? 'doctor' : 'patient');*/
|
|
|
|
|
|
if (loginFromApp) {
|
|
if (loginFromApp) {
|
|
// cache app status
|
|
// cache app status
|
|
@ -148,16 +148,16 @@ class Users extends RedisModel {
|
|
|
|
|
|
sessions.forEach(function (session) {
|
|
sessions.forEach(function (session) {
|
|
redisConn.zscore(REDIS_KEYS.Sessions, session.id, function (err, res) {
|
|
redisConn.zscore(REDIS_KEYS.Sessions, session.id, function (err, res) {
|
|
// 已经缓存过的会话不再缓存
|
|
|
|
if (res != null) return;
|
|
|
|
|
|
if (res != null) return; // 已经缓存过的会话不再缓存
|
|
|
|
|
|
(function (sessionId, userId) {
|
|
(function (sessionId, userId) {
|
|
var business_type = session.business_type;
|
|
|
|
if(!session.business_type&&session.type==SESSION_TYPE.MUC){
|
|
|
|
|
|
let business_type = session.business_type;
|
|
|
|
if (!session.business_type && session.type == SESSION_TYPE.MUC) {
|
|
business_type = 2
|
|
business_type = 2
|
|
}else if(!session.business_type&&session.type!=SESSION_TYPE.MUC){
|
|
|
|
|
|
} else if (!session.business_type && session.type != SESSION_TYPE.MUC) {
|
|
business_type = 1
|
|
business_type = 1
|
|
}
|
|
}
|
|
|
|
|
|
let redisSession = [
|
|
let redisSession = [
|
|
"id", session.id,
|
|
"id", session.id,
|
|
"name", session.name,
|
|
"name", session.name,
|