save_log.go 776 B

123456789101112131415161718192021222324252627282930313233343536
  1. package services
  2. import (
  3. "context"
  4. "eta/eta_task/models"
  5. "eta/eta_task/models/data_manage"
  6. "eta/eta_task/services/alarm_msg"
  7. "eta/eta_task/utils"
  8. "time"
  9. )
  10. func DeleteLog(cont context.Context) (err error) {
  11. date := time.Now().AddDate(0, -1, 0).Format(utils.FormatDate)
  12. go func() {
  13. err = data_manage.DeletePPTLogByDate(date)
  14. if err != nil {
  15. alarm_msg.SendAlarmMsg("DeletePPTLogByDate ErrMsg:"+err.Error(), 3)
  16. }
  17. }()
  18. go func() {
  19. err = data_manage.DeleteReportLogByDate(date)
  20. if err != nil {
  21. alarm_msg.SendAlarmMsg("DeleteReportLogByDate ErrMsg:"+err.Error(), 3)
  22. }
  23. }()
  24. go func() {
  25. err = models.DeleteTemplateRecordByDate(date)
  26. if err != nil {
  27. alarm_msg.SendAlarmMsg("DeleteTemplateRecordByDate ErrMsg:"+err.Error(), 3)
  28. }
  29. }()
  30. return
  31. }