From ec41fd80a8a56bb4e9a9743f2760e4e8082a79a4 Mon Sep 17 00:00:00 2001 From: Yun <995116474@qq.com> Date: Fri, 31 May 2024 09:52:10 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=96=B9=E6=B3=95=E5=90=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- cluster.go | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/cluster.go b/cluster.go index dba663f..24c1756 100644 --- a/cluster.go +++ b/cluster.go @@ -95,8 +95,8 @@ func InitCluster(ctx context.Context, red redis.UniversalClient, keyPrefix strin // @param callback 回调函数 // @param extendData 扩展数据 // @return error -func (c *Cluster) AddMonth(ctx context.Context, taskId string, day int, hour int, minute int, second int, callback callback, extendData interface{}) error { - nowTime := time.Now() +func (c *Cluster) EveryMonth(ctx context.Context, taskId string, day int, hour int, minute int, second int, callback callback, extendData interface{}) error { + nowTime := time.Now().In(c.location) jobData := JobData{ JobType: JobTypeEveryMonth, @@ -117,8 +117,8 @@ func (c *Cluster) AddMonth(ctx context.Context, taskId string, day int, hour int // @param hour int 小时 // @param minute int 分钟 // @param second int 秒 -func (c *Cluster) AddWeek(ctx context.Context, taskId string, week time.Weekday, hour int, minute int, second int, callback callback, extendData interface{}) error { - nowTime := time.Now() +func (c *Cluster) EveryWeek(ctx context.Context, taskId string, week time.Weekday, hour int, minute int, second int, callback callback, extendData interface{}) error { + nowTime := time.Now().In(c.location) jobData := JobData{ JobType: JobTypeEveryWeek, @@ -133,8 +133,8 @@ func (c *Cluster) AddWeek(ctx context.Context, taskId string, week time.Weekday, } // 每天执行一次 -func (c *Cluster) AddDay(ctx context.Context, taskId string, hour int, minute int, second int, callback callback, extendData interface{}) error { - nowTime := time.Now() +func (c *Cluster) EveryDay(ctx context.Context, taskId string, hour int, minute int, second int, callback callback, extendData interface{}) error { + nowTime := time.Now().In(c.location) jobData := JobData{ JobType: JobTypeEveryDay, @@ -148,8 +148,8 @@ func (c *Cluster) AddDay(ctx context.Context, taskId string, hour int, minute in } // 每小时执行一次 -func (c *Cluster) AddHour(ctx context.Context, taskId string, minute int, second int, callback callback, extendData interface{}) error { - nowTime := time.Now() +func (c *Cluster) EveryHour(ctx context.Context, taskId string, minute int, second int, callback callback, extendData interface{}) error { + nowTime := time.Now().In(c.location) jobData := JobData{ JobType: JobTypeEveryHour, @@ -162,8 +162,8 @@ func (c *Cluster) AddHour(ctx context.Context, taskId string, minute int, second } // 每分钟执行一次 -func (c *Cluster) AddMinute(ctx context.Context, taskId string, second int, callback callback, extendData interface{}) error { - nowTime := time.Now() +func (c *Cluster) EveryMinute(ctx context.Context, taskId string, second int, callback callback, extendData interface{}) error { + nowTime := time.Now().In(c.location) jobData := JobData{ JobType: JobTypeEveryMinute, @@ -175,8 +175,8 @@ func (c *Cluster) AddMinute(ctx context.Context, taskId string, second int, call } // 特定时间间隔 -func (c *Cluster) AddSpace(ctx context.Context, taskId string, spaceTime time.Duration, callback callback, extendData interface{}) error { - nowTime := time.Now() +func (c *Cluster) EverySpace(ctx context.Context, taskId string, spaceTime time.Duration, callback callback, extendData interface{}) error { + nowTime := time.Now().In(c.location) if spaceTime < 0 { c.logger.Errorf(ctx, "间隔时间不能小于0")