From 6cbf9033fdd0c45c67f21ed19f3da8b4c01de7d8 Mon Sep 17 00:00:00 2001 From: dengbiao Date: Fri, 6 Sep 2024 12:17:24 +0800 Subject: [PATCH] 1 --- app/task/init.go | 3 ++- .../svc/svc_central_kitchen_for_school_user_with_day.go | 7 ++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/app/task/init.go b/app/task/init.go index 55fe6f7..a7f01c8 100644 --- a/app/task/init.go +++ b/app/task/init.go @@ -23,7 +23,8 @@ var ( ) func Init() { - // 初始化任务列表initTasks() + // 初始化任务列表 + initTasks() var err error timer = cron.New() // reload为初始化数据库方法 diff --git a/app/task/svc/svc_central_kitchen_for_school_user_with_day.go b/app/task/svc/svc_central_kitchen_for_school_user_with_day.go index 0e845f5..9e3688a 100644 --- a/app/task/svc/svc_central_kitchen_for_school_user_with_day.go +++ b/app/task/svc/svc_central_kitchen_for_school_user_with_day.go @@ -19,9 +19,9 @@ func SyncCentralKitchenForSchoolUserWithDayState(eg *xorm.Engine) { now := time.Now() today := now.Format("2006-01-02") - breakfastMealTime, _ := time.ParseInLocation("2006-01-02 15:04:05", now.Format("2006-01-02")+" 06:30", time.Local) - lunchMealTime, _ := time.ParseInLocation("2006-01-02 15:04:05", now.Format("2006-01-02")+" 12:00", time.Local) - dinnerMealTime, _ := time.ParseInLocation("2006-01-02 15:04:05", now.Format("2006-01-02")+" 17:00", time.Local) + breakfastMealTime, _ := time.ParseInLocation("2006-01-02 15:04:05", now.Format("2006-01-02")+" 06:30:00", time.Local) + lunchMealTime, _ := time.ParseInLocation("2006-01-02 15:04:05", now.Format("2006-01-02")+" 12:30:00", time.Local) + dinnerMealTime, _ := time.ParseInLocation("2006-01-02 15:04:05", now.Format("2006-01-02")+" 17:00:00", time.Local) //1、判断当前已过早餐就餐时间 if now.After(breakfastMealTime) { centralKitchenForSchoolUserWithDay := new(model.CentralKitchenForSchoolUserWithDay) @@ -38,6 +38,7 @@ func SyncCentralKitchenForSchoolUserWithDayState(eg *xorm.Engine) { } //2、判断当前已过午餐就餐时间 + fmt.Println(lunchMealTime.Format("2006-01-02 15:04:05")) if now.After(lunchMealTime) { centralKitchenForSchoolUserWithDay := new(model.CentralKitchenForSchoolUserWithDay) centralKitchenForSchoolUserWithDay.State = enum.CentralKitchenForSchoolUserWithDayStateForAlready