by Robin at 20240308; logout

This commit is contained in:
Leufolium 2024-03-08 12:52:10 +08:00
parent a1a4820b2c
commit f94f90b0e7
3 changed files with 26 additions and 0 deletions

View File

@ -891,6 +891,17 @@ func (m *Mongo) DeleteTokenByMid(ctx *gin.Context, mid int64) error {
return err
}
func (m *Mongo) DeleteTokenByMids(ctx *gin.Context, mids []int64) error {
col := m.getColToken()
err := col.Remove(ctx, qmgo.M{
"mid": qmgo.M{
"$in": mids,
},
})
return err
}
func (m *Mongo) GetTokenList(ctx *gin.Context, req *tokenproto.OpListReq) ([]*dbstruct.Token, error) {
list := make([]*dbstruct.Token, 0)
col := m.getColToken()

View File

@ -57,6 +57,15 @@ func (p *Token) OpDeleteByMid(ctx *gin.Context, mid int64) error {
return nil
}
func (p *Token) OpDeleteByMids(ctx *gin.Context, mids []int64) error {
err := p.store.DeleteTokenByMids(ctx, mids)
if err != nil {
logger.Error("OpDeleteByMids fail, err: %v", err)
return err
}
return nil
}
func (p *Token) OpList(ctx *gin.Context, req *tokenproto.OpListReq) ([]*dbstruct.Token, error) {
list, err := p.store.GetTokenList(ctx, req)
if err != nil {

View File

@ -636,6 +636,12 @@ func (s *Service) utilCancelAccountByMids(ctx *gin.Context, midList []int64) err
return nil
}
// 执行下线操作
if err := _DefaultToken.OpDeleteByMids(ctx, midList); err != nil {
logger.Error("_DefaultToken OpDeleteByMids fail, err: %v", err)
return err
}
// 查询相应的login和account信息
logins, err := _DefaultLogin.OpListByMids(ctx, &loginproto.OpListByMidsReq{
Mids: midList,