diff --git a/app/mix/dao/mongo.go b/app/mix/dao/mongo.go index 91f5fac1..aa5a3475 100644 --- a/app/mix/dao/mongo.go +++ b/app/mix/dao/mongo.go @@ -901,6 +901,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() diff --git a/app/mix/service/logic/token.go b/app/mix/service/logic/token.go index 7f2f7548..52deae54 100644 --- a/app/mix/service/logic/token.go +++ b/app/mix/service/logic/token.go @@ -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 { diff --git a/app/mix/service/utilservice.go b/app/mix/service/utilservice.go index 9cf8606d..186728f6 100644 --- a/app/mix/service/utilservice.go +++ b/app/mix/service/utilservice.go @@ -638,6 +638,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,