28 lines
577 B
Go
28 lines
577 B
Go
package account
|
|
|
|
import (
|
|
"SciencesServer/app/service"
|
|
"SciencesServer/app/session"
|
|
"SciencesServer/config"
|
|
"SciencesServer/utils"
|
|
)
|
|
|
|
type Logout struct {
|
|
*session.Enterprise
|
|
}
|
|
|
|
type LogoutHandle func(session *session.Enterprise) *Logout
|
|
|
|
func (c *Logout) Launch() error {
|
|
if c.Enterprise != nil && c.UID > 0 {
|
|
service.Publish(config.EventForRedisHashDestroy, config.RedisKeyForAccountEnterprise, utils.UintToString(c.UID))
|
|
}
|
|
return nil
|
|
}
|
|
|
|
func NewLogout() LogoutHandle {
|
|
return func(session *session.Enterprise) *Logout {
|
|
return &Logout{Enterprise: session}
|
|
}
|
|
}
|