2
0
mirror of https://github.com/acepanel/panel.git synced 2026-02-04 11:27:17 +08:00

feat: 全局移除carbon

This commit is contained in:
耗子
2024-09-29 03:31:27 +08:00
parent 169c0ff18e
commit 3fce818d13
31 changed files with 136 additions and 151 deletions

View File

@@ -6,8 +6,7 @@ import (
"path/filepath"
"regexp"
"strconv"
"github.com/golang-module/carbon/v2"
"time"
"github.com/TheTNB/panel/internal/biz"
"github.com/TheTNB/panel/internal/http/request"
@@ -104,7 +103,7 @@ panel cutoff ${name} ${save}
if !io.Exists(shellLogDir) {
return errors.New("计划任务日志目录不存在")
}
shellFile := strconv.Itoa(int(carbon.Now().Timestamp())) + str.RandomString(16)
shellFile := strconv.Itoa(int(time.Now().Unix())) + str.RandomString(16)
if err := io.Write(filepath.Join(shellDir, shellFile+".sh"), script, 0700); err != nil {
return errors.New(err.Error())
}

View File

@@ -2,8 +2,8 @@ package data
import (
"errors"
"time"
"github.com/golang-module/carbon/v2"
"github.com/spf13/cast"
"github.com/TheTNB/panel/internal/biz"
@@ -53,7 +53,7 @@ func (r monitorRepo) Clear() error {
return panel.Orm.Delete(&biz.Monitor{}).Error
}
func (r monitorRepo) List(start, end carbon.Carbon) ([]*biz.Monitor, error) {
func (r monitorRepo) List(start, end time.Time) ([]*biz.Monitor, error) {
var monitors []*biz.Monitor
if err := panel.Orm.Where("created_at BETWEEN ? AND ?", start, end).Find(&monitors).Error; err != nil {
return nil, err