From 82985d051c58167bf4c268ff22a74a2788e98543 Mon Sep 17 00:00:00 2001 From: Leufolium Date: Wed, 3 Jan 2024 22:53:53 +0800 Subject: [PATCH] by Robin at 20240103; fix --- app/mix/controller/init.go | 2 +- app/mix/service/cronservice.go | 2 +- app/mix/service/scripts_service.go | 4 +--- 3 files changed, 3 insertions(+), 5 deletions(-) diff --git a/app/mix/controller/init.go b/app/mix/controller/init.go index 3eb5c1db..b62da9fd 100644 --- a/app/mix/controller/init.go +++ b/app/mix/controller/init.go @@ -360,7 +360,7 @@ func Init(r *gin.Engine) { // 每日报表表 opDailyStatementGroup := r.Group("/op/daily_statement", PrepareOp()) - opDailyStatementGroup.POST("list", middleware.JSONParamValidator(daily_statementproto.OpListReq{}), OpGetDailyStatementList) + opDailyStatementGroup.POST("list", middleware.JSONParamValidator(daily_statementproto.OpListReq{}), middleware.JwtAuthenticator(), OpGetDailyStatementList) // 账号相关 //accountGroup := r.Group("/account") diff --git a/app/mix/service/cronservice.go b/app/mix/service/cronservice.go index 307c7986..b3466ff3 100644 --- a/app/mix/service/cronservice.go +++ b/app/mix/service/cronservice.go @@ -114,7 +114,7 @@ func (s *CronService) CreateDailyStatement() { loc, _ := time.LoadLocation("Asia/Shanghai") scheduler := gocron.NewScheduler(loc) - scheduler.CronWithSeconds("0 0 * * * *").Do(func() { + scheduler.CronWithSeconds("0 * * * * *").Do(func() { //拿到现在的时间戳 nowTimeStamp := util.GetHourStartTimeStamp(time.Now()) diff --git a/app/mix/service/scripts_service.go b/app/mix/service/scripts_service.go index 47b745ed..12880828 100644 --- a/app/mix/service/scripts_service.go +++ b/app/mix/service/scripts_service.go @@ -1,7 +1,6 @@ package service import ( - "fmt" "os/exec" "service/library/logger" "strconv" @@ -20,8 +19,7 @@ func NewScriptsService() *ScriptsService { // 放置一些执行服务器脚本的service func (s *ScriptsService) QueryCallCount(url string, logpath string) (count int, err error) { - cmdStr := fmt.Sprintf("grep -c %v %v", url, logpath) - cmd := exec.Command(cmdStr) + cmd := exec.Command("grep", "-c", url, logpath) out, err := cmd.Output() if err != nil { logger.Error("could not run command: %v", err)