2021-09-29 16:25:56 +08:00
|
|
|
package account
|
|
|
|
|
|
|
|
import (
|
|
|
|
"SciencesServer/app/service"
|
|
|
|
"SciencesServer/config"
|
|
|
|
"SciencesServer/utils"
|
|
|
|
)
|
|
|
|
|
2021-10-13 11:23:55 +08:00
|
|
|
type Logout struct {
|
|
|
|
*service.SessionEnterprise
|
|
|
|
}
|
2021-09-29 16:25:56 +08:00
|
|
|
|
2021-10-27 13:27:01 +08:00
|
|
|
type LogoutHandle func(enterprise *service.SessionEnterprise) *Logout
|
2021-09-29 16:25:56 +08:00
|
|
|
|
|
|
|
func (c *Logout) Launch() error {
|
2021-11-24 09:59:29 +08:00
|
|
|
if c.SessionEnterprise != nil && c.UID > 0 {
|
2021-10-27 13:27:01 +08:00
|
|
|
service.Publish(config.EventForRedisHashDestroy, config.RedisKeyForAccount, utils.UintToString(c.UID))
|
|
|
|
}
|
2021-09-29 16:25:56 +08:00
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
|
|
|
func NewLogout() LogoutHandle {
|
2021-10-27 13:27:01 +08:00
|
|
|
return func(enterprise *service.SessionEnterprise) *Logout {
|
|
|
|
return &Logout{enterprise}
|
2021-09-29 16:25:56 +08:00
|
|
|
}
|
|
|
|
}
|