Merge pull request 'by Robin at 20240308; logout' (#164) from feat-IRONFANS-62-Robin into test

Reviewed-on: http://121.41.31.146:3000/wishpal_ironfan/service/pulls/164
This commit is contained in:
chenhao 2024-03-08 12:52:59 +08:00
commit 74c6061db0
3 changed files with 26 additions and 0 deletions

View File

@ -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()

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

@ -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,