diff --git a/dao/account_log.go b/dao/account_log.go index 4a32fad..866f38c 100644 --- a/dao/account_log.go +++ b/dao/account_log.go @@ -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 +} diff --git a/dbproxy/svc/l_accountlog.go b/dbproxy/svc/l_accountlog.go index bb15ae9..ae145fc 100644 --- a/dbproxy/svc/l_accountlog.go +++ b/dbproxy/svc/l_accountlog.go @@ -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() { diff --git a/model/accountlog.go b/model/accountlog.go index f2c021b..28d680a 100644 --- a/model/accountlog.go +++ b/model/accountlog.go @@ -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 +} diff --git a/worldsrv/trascate_webapi.go b/worldsrv/trascate_webapi.go index 46066d3..42065d9 100644 --- a/worldsrv/trascate_webapi.go +++ b/worldsrv/trascate_webapi.go @@ -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) {