SESSION读取失败时不强制重新登录

This commit is contained in:
GoEdgeLab
2023-04-21 15:39:51 +08:00
parent 39f8059600
commit a11d205c88
2 changed files with 6 additions and 0 deletions

View File

@@ -40,6 +40,7 @@ func (this *SessionManager) Read(sid string) map[string]string {
resp, err := rpcClient.LoginSessionRPC().FindLoginSession(rpcClient.Context(0), &pb.FindLoginSessionRequest{Sid: sid})
if err != nil {
logs.Println("SESSION", "read '"+sid+"' failed: "+err.Error())
result["@error"] = err.Error()
return result
}

View File

@@ -170,6 +170,11 @@ func (this *userMustAuth) BeforeAction(actionPtr actions.ActionWrapper, paramNam
var adminId = session.GetInt64("adminId")
if adminId <= 0 {
var errString = session.GetString("@error")
if len(errString) > 0 {
action.WriteString("read session failed: " + errString)
return false
}
this.login(action)
return false
}