package services import ( "context" "eta_gn/eta_task/models" "eta_gn/eta_task/services/alarm_msg" "eta_gn/eta_task/utils" "fmt" "time" ) // ClearAdminOperateLog 清理三个月前的用户操作日志 func ClearAdminOperateLog(cont context.Context) (err error) { defer func() { if err != nil { tips := fmt.Sprintf("清理用户操作日志, ClearAdminOperateLog error: %s", err.Error()) fmt.Println(tips) go alarm_msg.SendAlarmMsg(tips, 2) } }() preTime := time.Now().Local().AddDate(0, -3, 0).Format(utils.FormatDateTime) e := models.ClearAdminOperateRecord(preTime) if e != nil { err = fmt.Errorf("ClearAdminOperateRecord: %s", e.Error()) } return }