Merge pull request 'by Robin at 20240103; fix' (#38) from feat-20230102-001-Robin into test
Reviewed-on: #38
This commit is contained in:
commit
8dd36740ce
|
@ -360,7 +360,7 @@ func Init(r *gin.Engine) {
|
||||||
|
|
||||||
// 每日报表表
|
// 每日报表表
|
||||||
opDailyStatementGroup := r.Group("/op/daily_statement", PrepareOp())
|
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")
|
//accountGroup := r.Group("/account")
|
||||||
|
|
|
@ -114,7 +114,7 @@ func (s *CronService) CreateDailyStatement() {
|
||||||
loc, _ := time.LoadLocation("Asia/Shanghai")
|
loc, _ := time.LoadLocation("Asia/Shanghai")
|
||||||
scheduler := gocron.NewScheduler(loc)
|
scheduler := gocron.NewScheduler(loc)
|
||||||
|
|
||||||
scheduler.CronWithSeconds("0 0 * * * *").Do(func() {
|
scheduler.CronWithSeconds("0 * * * * *").Do(func() {
|
||||||
|
|
||||||
//拿到现在的时间戳
|
//拿到现在的时间戳
|
||||||
nowTimeStamp := util.GetHourStartTimeStamp(time.Now())
|
nowTimeStamp := util.GetHourStartTimeStamp(time.Now())
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
package service
|
package service
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
|
||||||
"os/exec"
|
"os/exec"
|
||||||
"service/library/logger"
|
"service/library/logger"
|
||||||
"strconv"
|
"strconv"
|
||||||
|
@ -20,8 +19,7 @@ func NewScriptsService() *ScriptsService {
|
||||||
|
|
||||||
// 放置一些执行服务器脚本的service
|
// 放置一些执行服务器脚本的service
|
||||||
func (s *ScriptsService) QueryCallCount(url string, logpath string) (count int, err error) {
|
func (s *ScriptsService) QueryCallCount(url string, logpath string) (count int, err error) {
|
||||||
cmdStr := fmt.Sprintf("grep -c %v %v", url, logpath)
|
cmd := exec.Command("grep", "-c", url, logpath)
|
||||||
cmd := exec.Command(cmdStr)
|
|
||||||
out, err := cmd.Output()
|
out, err := cmd.Output()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
logger.Error("could not run command: %v", err)
|
logger.Error("could not run command: %v", err)
|
||||||
|
|
Loading…
Reference in New Issue