diff --git a/modules/user/api_login.go b/modules/user/api_login.go index f588dbf20..7fc58dde1 100644 --- a/modules/user/api_login.go +++ b/modules/user/api_login.go @@ -33,7 +33,7 @@ func (this *apiComp) Login(session comm.IUserSession, req *pb.UserLoginReq) (cod rsp := &pb.UserLoginResp{} defer func() { - if user != nil && code != pb.ErrorCode_Success { + if user != nil && code == pb.ErrorCode_Success { rsp.Data = user rsp.TimeNow = time.Now().Unix() // 设置服务器时间 err = session.SendMsg(string(this.module.GetType()), UserSubTypeLogin, rsp) @@ -68,7 +68,7 @@ func (this *apiComp) Login(session comm.IUserSession, req *pb.UserLoginReq) (cod } isNewUser = true } else { - if cu := this.module.modelSession.getUserSession(user.Uid); cu != nil { + if cu := this.module.modelSession.getUserSession(user.Uid); cu.SessionId != "" { code = pb.ErrorCode_UserLogined return } diff --git a/modules/user/module.go b/modules/user/module.go index 570d00abf..3d5beceff 100644 --- a/modules/user/module.go +++ b/modules/user/module.go @@ -1,6 +1,7 @@ package user import ( + "fmt" "go_dreamfactory/comm" "go_dreamfactory/modules" "go_dreamfactory/pb" @@ -68,9 +69,11 @@ func (this *User) GetUserSession(uid string) *pb.CacheUser { // 清除session func (this *User) CleanSession(session comm.IUserSession) { this.modelUser.updateOfflineTime(session.GetUserId()) - this.modelSession.Del(session.GetUserId(), db.SetDBMgoLog(false)) + sId := fmt.Sprintf("%s-%s", comm.RDS_SESSION, session.GetUserId()) + this.modelSession.Del(sId, db.SetDBMgoLog(false)) + this.modelSession.DelListlds(comm.RDS_SESSION, session.GetUserId()) this.modelUser.Del(session.GetUserId(), db.SetDBMgoLog(false)) - //this.modelExpand.Del(session.GetUserId(), modules.SetDBMgoLog(false)) // 暂时不清 + this.modelExpand.Del(session.GetUserId(), db.SetDBMgoLog(false)) this.modelSetting.Del(session.GetUserId(), db.SetDBMgoLog(false)) }