dengbiao 2 个月前
父节点
当前提交
6cbf9033fd
共有 2 个文件被更改,包括 6 次插入4 次删除
  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 查看文件

@@ -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 查看文件

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


正在加载...
取消
保存