From 67b0b76094a62d9a9d90e7e289c7d473f51e5f43 Mon Sep 17 00:00:00 2001 From: dengbiao Date: Mon, 23 Sep 2024 18:40:42 +0800 Subject: [PATCH] 1 --- .../hdl_central_kitchen_for_school.go | 6 ++++++ app/admin/md/md_enterprise_manage.go | 2 ++ app/customer/md/md_enterprise.go | 2 ++ app/customer/svc/svc_enterprise.go | 2 ++ app/customer/svc/svc_pay.go | 4 ++-- app/db/model/central_kitchen_for_school_set.go | 12 +++++++----- 6 files changed, 21 insertions(+), 7 deletions(-) diff --git a/app/admin/hdl/enterprise_manage/hdl_central_kitchen_for_school.go b/app/admin/hdl/enterprise_manage/hdl_central_kitchen_for_school.go index 4c88d43..026cad7 100644 --- a/app/admin/hdl/enterprise_manage/hdl_central_kitchen_for_school.go +++ b/app/admin/hdl/enterprise_manage/hdl_central_kitchen_for_school.go @@ -910,6 +910,8 @@ func SetBasicCentralKitchenForSchool(c *gin.Context) { set.IsOpenTeacherReportMealForMonth = req.IsOpenTeacherReportMealForMonth set.IsOpenTeacherReportMealForSemester = req.IsOpenTeacherReportMealForSemester set.IsOpenLimitOrderFood = req.IsOpenLimitOrderFood + set.OrderFoodStartDate = req.OrderFoodStartDate + set.OrderFoodEndDate = req.OrderFoodEndDate set.IsOpenLimitTeacherRegister = req.IsOpenLimitTeacherRegister set.UpdateAt = now.Format("2006-01-02 15:04:05") @@ -931,6 +933,8 @@ func SetBasicCentralKitchenForSchool(c *gin.Context) { IsOpenTeacherReportMealForMonth: req.IsOpenTeacherReportMealForMonth, IsOpenTeacherReportMealForSemester: req.IsOpenTeacherReportMealForSemester, IsOpenLimitOrderFood: req.IsOpenLimitOrderFood, + OrderFoodStartDate: req.OrderFoodStartDate, + OrderFoodEndDate: req.OrderFoodEndDate, IsOpenLimitTeacherRegister: req.IsOpenLimitTeacherRegister, CreateAt: now.Format("2006-01-02 15:04:05"), UpdateAt: now.Format("2006-01-02 15:04:05"), @@ -1030,6 +1034,8 @@ func GetBasicCentralKitchenForSchool(c *gin.Context) { IsOpenTeacherReportMealForMonth: 1, IsOpenTeacherReportMealForSemester: 1, IsOpenLimitOrderFood: 2, + OrderFoodStartDate: 1, + OrderFoodEndDate: 31, IsOpenLimitTeacherRegister: 2, CreateAt: time.Now().Format("2006-01-02 15:04:05"), UpdateAt: time.Now().Format("2006-01-02 15:04:05"), diff --git a/app/admin/md/md_enterprise_manage.go b/app/admin/md/md_enterprise_manage.go index 043f176..891d99b 100644 --- a/app/admin/md/md_enterprise_manage.go +++ b/app/admin/md/md_enterprise_manage.go @@ -240,6 +240,8 @@ type SetBasicCentralKitchenForSchoolReq struct { IsOpenTeacherReportMealForMonth int `json:"is_open_teacher_report_meal_for_month" label:"开启教师按月报餐(1:开启 2:关闭)"` IsOpenTeacherReportMealForSemester int `json:"is_open_teacher_report_meal_for_semester" label:"开启教师按学期报餐(1:开启 2:关闭)"` IsOpenLimitOrderFood int `json:"is_open_limit_order_food" label:"是否开启限制订餐(1:开启 2:关闭)"` + OrderFoodStartDate int `json:"order_food_start_date" label:"订餐时间-起始时间"` + OrderFoodEndDate int `json:"order_food_end_date" label:"订餐时间-截止时间"` IsOpenLimitTeacherRegister int `json:"is_open_limit_teacher_register" label:"是否开启教师注册(1:开启 2:关闭)"` IsOpenTeacherReportMeal int `json:"is_open_teacher_report_meal" label:"'教师报餐(1:开启 2:关闭)"` } diff --git a/app/customer/md/md_enterprise.go b/app/customer/md/md_enterprise.go index 5a4e2f1..bf4bc58 100644 --- a/app/customer/md/md_enterprise.go +++ b/app/customer/md/md_enterprise.go @@ -19,6 +19,8 @@ type CentralKitchenForSchoolInfoResp struct { IsOpenTeacherReportMealForMonth int `json:"is_open_teacher_report_meal_for_month" label:"开启教师按月报餐(1:开启 2:关闭)"` IsOpenTeacherReportMealForSemester int `json:"is_open_teacher_report_meal_for_semester" label:"开启教师按学期报餐(1:开启 2:关闭)"` IsOpenLimitOrderFood int `json:"is_open_limit_order_food" label:"是否开启限制订餐(1:开启 2:关闭)"` + OrderFoodStartDate int `json:"order_food_start_date" label:"订餐时间-起始时间"` + OrderFoodEndDate int `json:"order_food_end_date" label:"订餐时间-截止时间"` IsOpenLimitTeacherRegister int `json:"is_open_limit_teacher_register" label:"是否开启教师注册(1:开启 2:关闭)"` IsOpenBreakfast int `json:"is_open_breakfast" label:"是否开启早餐(1:开启 0:关闭)"` IsOpenLunch int `json:"is_open_lunch" label:"是否开启午餐(1:开启 0:关闭)"` diff --git a/app/customer/svc/svc_enterprise.go b/app/customer/svc/svc_enterprise.go index cafa1d9..97f58fc 100644 --- a/app/customer/svc/svc_enterprise.go +++ b/app/customer/svc/svc_enterprise.go @@ -80,6 +80,8 @@ func CentralKitchenForSchoolInfo(enterpriseId int) (err error, resp md.CentralKi resp.IsOpenTeacherReportMealForMonth = set.IsOpenTeacherReportMealForMonth resp.IsOpenTeacherReportMealForSemester = set.IsOpenTeacherReportMealForSemester resp.IsOpenLimitOrderFood = set.IsOpenLimitOrderFood + resp.OrderFoodStartDate = set.OrderFoodStartDate + resp.OrderFoodEndDate = set.OrderFoodEndDate resp.IsOpenLimitTeacherRegister = set.IsOpenLimitTeacherRegister } return diff --git a/app/customer/svc/svc_pay.go b/app/customer/svc/svc_pay.go index ca56ce8..daafec8 100644 --- a/app/customer/svc/svc_pay.go +++ b/app/customer/svc/svc_pay.go @@ -35,8 +35,8 @@ func CheckIsOpenLimitOrderFood(enterpriseId int) (err error) { if set != nil && set.IsOpenLimitOrderFood == 1 { //TODO::判断每月25日至最后一日不可以订餐 day := time.Now().Day() - if day >= 25 { - return errors.New("每月25日至最后一日不可以订餐!") + if day >= set.OrderFoodStartDate && day <= set.OrderFoodEndDate { + return errors.New(fmt.Sprintf("每月%d日至%d日可以订餐!", set.OrderFoodStartDate, set.OrderFoodEndDate)) } } return diff --git a/app/db/model/central_kitchen_for_school_set.go b/app/db/model/central_kitchen_for_school_set.go index c72488e..cbf5ebe 100644 --- a/app/db/model/central_kitchen_for_school_set.go +++ b/app/db/model/central_kitchen_for_school_set.go @@ -1,16 +1,18 @@ package model type CentralKitchenForSchoolSet struct { - Id int `json:"id" xorm:"not null pk autoincr INT(11)"` - EnterpriseId int `json:"enterprise_id" xorm:"not null default 0 comment('所属单位id') INT(11)"` + Id int `json:"id" xorm:"not null pk autoincr INT"` + EnterpriseId int `json:"enterprise_id" xorm:"not null default 0 comment('所属单位id') INT"` IsOpenTeacherReportMeal int `json:"is_open_teacher_report_meal" xorm:"not null default 1 comment('教师报餐(1:开启 2:关闭)') TINYINT(1)"` IsOpenReportMealForDay int `json:"is_open_report_meal_for_day" xorm:"not null default 1 comment('开启学生按天报餐(1:开启 2:关闭)') TINYINT(1)"` IsOpenReportMealForMonth int `json:"is_open_report_meal_for_month" xorm:"not null default 1 comment('开启学生按月报餐(1:开启 2:关闭)') TINYINT(1)"` IsOpenReportMealForSemester int `json:"is_open_report_meal_for_semester" xorm:"not null default 1 comment('开启学生按学期报餐(1:开启 2:关闭)') TINYINT(1)"` - IsOpenTeacherReportMealForDay int `json:"is_open_teacher_report_meal_for_day" xorm:"not null default 1 comment('开启按天教师报餐(1:开启 2:关闭)') TINYINT(1)"` - IsOpenTeacherReportMealForMonth int `json:"is_open_teacher_report_meal_for_month" xorm:"not null default 1 comment('开启按月教师报餐(1:开启 2:关闭)') TINYINT(1)"` - IsOpenTeacherReportMealForSemester int `json:"is_open_teacher_report_meal_for_semester" xorm:"not null default 1 comment('开启按学期教师报餐(1:开启 2:关闭)') TINYINT(1)"` + IsOpenTeacherReportMealForDay int `json:"is_open_teacher_report_meal_for_day" xorm:"not null default 1 comment('开启教师按天报餐(1:开启 2:关闭)') TINYINT(1)"` + IsOpenTeacherReportMealForMonth int `json:"is_open_teacher_report_meal_for_month" xorm:"not null default 1 comment('开启教师按月报餐(1:开启 2:关闭)') TINYINT(1)"` + IsOpenTeacherReportMealForSemester int `json:"is_open_teacher_report_meal_for_semester" xorm:"not null default 1 comment('开启教师按学期报餐(1:开启 2:关闭)') TINYINT(1)"` IsOpenLimitOrderFood int `json:"is_open_limit_order_food" xorm:"not null default 2 comment('是否开启限制订餐(1:开启 2:关闭)') TINYINT(1)"` + OrderFoodStartDate int `json:"order_food_start_date" xorm:"not null default '1000-01-01' comment('订餐时间-起始时间') DATE"` + OrderFoodEndDate int `json:"order_food_end_date" xorm:"not null default '1000-01-01' comment('订餐时间-截止时间') DATE"` IsOpenLimitTeacherRegister int `json:"is_open_limit_teacher_register" xorm:"not null default 2 comment('是否开启教师注册(1:开启 2:关闭)') TINYINT(1)"` CreateAt string `json:"create_at" xorm:"not null default 'CURRENT_TIMESTAMP' DATETIME"` UpdateAt string `json:"update_at" xorm:"not null default 'CURRENT_TIMESTAMP' DATETIME"`