dengbiao 2 months ago
parent
commit
6cbf9033fd
2 changed files with 6 additions and 4 deletions
  1. +2
    -1
      app/task/init.go
  2. +4
    -3
      app/task/svc/svc_central_kitchen_for_school_user_with_day.go

+ 2
- 1
app/task/init.go View File

@@ -23,7 +23,8 @@ var (
)

func Init() {
// 初始化任务列表initTasks()
// 初始化任务列表
initTasks()
var err error
timer = cron.New()
// reload为初始化数据库方法


+ 4
- 3
app/task/svc/svc_central_kitchen_for_school_user_with_day.go View File

@@ -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


Loading…
Cancel
Save