|
|
@@ -2,6 +2,7 @@ package cc.smtweb.framework.core.session; |
|
|
|
|
|
|
|
import cc.smtweb.framework.core.cache.redis.RedisBroadcastEvent; |
|
|
|
import cc.smtweb.framework.core.cache.redis.RedisManager; |
|
|
|
import cc.smtweb.framework.core.common.SwEnum; |
|
|
|
import cc.smtweb.framework.core.db.jdbc.IdGenerator; |
|
|
|
import cc.smtweb.framework.core.mvc.controller.IEditor; |
|
|
|
import org.apache.commons.lang3.StringUtils; |
|
|
@@ -23,9 +24,11 @@ public class SessionManager { |
|
|
|
public String login(UserSession userSession) { |
|
|
|
if (userSession != null) { |
|
|
|
String sid = RedisManager.PREFIX_SESSION + Long.toHexString(idGenerator.nextId()) + "_" + Integer.toHexString(new Random().nextInt()); |
|
|
|
|
|
|
|
redisManager.set(sid, userSession, RedisManager.SESSION_EXPIRE_SEC); |
|
|
|
|
|
|
|
if(userSession.getUserLevel() == SwEnum.UserLevel.pub.value){ |
|
|
|
redisManager.set(sid, userSession, 0); |
|
|
|
}else { |
|
|
|
redisManager.set(sid, userSession, RedisManager.SESSION_EXPIRE_SEC); |
|
|
|
} |
|
|
|
return sid; |
|
|
|
} |
|
|
|
|
|
|
|