fix facebook账号删除

This commit is contained in:
sk 2025-02-06 16:09:11 +08:00
parent 2512994ee8
commit d8752b962b
4 changed files with 45 additions and 0 deletions

View File

@ -92,3 +92,10 @@ func (a *AccountLog) Save(log *modelpkg.AccountLog) error {
_, err = a.InsertOne(context.Background(), log)
return err
}
func (a *AccountLog) RemoveByFaceBookId(id string) error {
_, err := a.DeleteMany(context.Background(), func(cols *internal.AccountLogColumns) interface{} {
return bson.M{cols.FaceBookId: id}
})
return err
}

View File

@ -26,6 +26,21 @@ func (a *AccountLogSvc) GetByFaceBookId(req *string, res *model.AccountLog) erro
return nil
}
func (a *AccountLogSvc) RemoveByFaceBookId(req *string, res *bool) error {
c, err := dao.GetAccountLog(mongox.Global)
if err != nil {
logger.Logger.Errorf("GetAccountLog error: %v", err)
return err
}
err = c.RemoveByFaceBookId(*req)
if err != nil {
logger.Logger.Errorf("RemoveByFaceBookId error: %v", err)
return err
}
*res = true
return err
}
var AccountLogSvcInst = new(AccountLogSvc)
func init() {

View File

@ -45,3 +45,22 @@ func GetByFaceBookId(faceBookId string) (*AccountLog, error) {
return accountLog, nil
}
func RemoveByFaceBookId(faceBookId string) error {
if rpcCli == nil {
return errors.New("rpc client is nil")
}
if faceBookId == "" {
return nil
}
ret := false
err := rpcCli.CallWithTimeout("AccountLogSvc.RemoveByFaceBookId", &faceBookId, &ret, time.Second*30)
if err != nil {
logger.Logger.Errorf("RemoveByFaceBookId err:%v", err)
return err
}
return nil
}

View File

@ -2446,6 +2446,10 @@ func init() {
}
msg.Platform = fb.Platform
msg.Snid = fb.SnId
err = model.RemoveByFaceBookId(msg.GetFaceBookId())
if err != nil {
return err
}
}
return nil
}), task.CompleteNotifyWrapper(func(i interface{}, t task.Task) {