history.go 1.2 KB

123456789101112131415161718192021222324252627282930313233343536
  1. package service
  2. import (
  3. "context"
  4. "time"
  5. "go-common/library/log"
  6. )
  7. func (s *Service) delArcEditHistory(limit int64) (delRows int64, err error) {
  8. var (
  9. c = context.TODO()
  10. mtime = time.Now().Add(-2 * 30 * 24 * time.Hour)
  11. before = time.Date(mtime.Year(), mtime.Month(), mtime.Day(), mtime.Hour(), 0, 0, 0, mtime.Location())
  12. )
  13. if delRows, err = s.arc.DelArcEditHistoryBefore(c, before, limit); err != nil {
  14. log.Error("s.arc.TxDelArcEditHistoryBefore(%s) error(%v)", mtime.Format("2006-01-02 15:04:05"), err)
  15. return
  16. }
  17. log.Info("delArchiveHistory before mtime(%s) rows(%d)", before.Format("2006-01-02 15:04:05"), delRows)
  18. return
  19. }
  20. func (s *Service) delArcVideoEditHistory(limit int64) (delRows int64, err error) {
  21. var (
  22. c = context.TODO()
  23. mtime = time.Now().Add(-2 * 30 * 24 * time.Hour)
  24. before = time.Date(mtime.Year(), mtime.Month(), mtime.Day(), mtime.Hour(), 0, 0, 0, mtime.Location())
  25. )
  26. if delRows, err = s.arc.DelArcVideoEditHistoryBefore(c, before, limit); err != nil {
  27. log.Error("s.arc.TxDelArcVideoEditHistoryBefore(%s) error(%v)", mtime.Format("2006-01-02 15:04:05"), err)
  28. return
  29. }
  30. log.Info("delArcVideoEditHistory before mtime(%s) rows(%d)", before.Format("2006-01-02 15:04:05"), delRows)
  31. return
  32. }