From f20091a90377619633540352a322bf923b6e099d Mon Sep 17 00:00:00 2001 From: dengbiao Date: Mon, 23 Sep 2024 17:20:48 +0800 Subject: [PATCH] 1 --- .../hdl_central_kitchen_for_school.go | 3 +++ app/admin/md/md_enterprise_manage.go | 1 + app/customer/hdl/hdl_user_identity.go | 10 +++++++++- app/customer/md/md_enterprise.go | 1 + app/customer/svc/svc_enterprise.go | 1 + app/db/model/central_kitchen_for_school_set.go | 1 + 6 files changed, 16 insertions(+), 1 deletion(-) 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 7a01a7a..4c88d43 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,7 @@ func SetBasicCentralKitchenForSchool(c *gin.Context) { set.IsOpenTeacherReportMealForMonth = req.IsOpenTeacherReportMealForMonth set.IsOpenTeacherReportMealForSemester = req.IsOpenTeacherReportMealForSemester set.IsOpenLimitOrderFood = req.IsOpenLimitOrderFood + set.IsOpenLimitTeacherRegister = req.IsOpenLimitTeacherRegister set.UpdateAt = now.Format("2006-01-02 15:04:05") _, err2 := centralKitchenForSchoolSetDb.CentralKitchenForSchoolSetUpdate(set.Id, set, @@ -930,6 +931,7 @@ func SetBasicCentralKitchenForSchool(c *gin.Context) { IsOpenTeacherReportMealForMonth: req.IsOpenTeacherReportMealForMonth, IsOpenTeacherReportMealForSemester: req.IsOpenTeacherReportMealForSemester, IsOpenLimitOrderFood: req.IsOpenLimitOrderFood, + IsOpenLimitTeacherRegister: req.IsOpenLimitTeacherRegister, CreateAt: now.Format("2006-01-02 15:04:05"), UpdateAt: now.Format("2006-01-02 15:04:05"), }) @@ -1028,6 +1030,7 @@ func GetBasicCentralKitchenForSchool(c *gin.Context) { IsOpenTeacherReportMealForMonth: 1, IsOpenTeacherReportMealForSemester: 1, IsOpenLimitOrderFood: 2, + 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 f842321..043f176 100644 --- a/app/admin/md/md_enterprise_manage.go +++ b/app/admin/md/md_enterprise_manage.go @@ -240,6 +240,7 @@ 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:关闭)"` + 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/hdl/hdl_user_identity.go b/app/customer/hdl/hdl_user_identity.go index 2ff6266..cba03c4 100644 --- a/app/customer/hdl/hdl_user_identity.go +++ b/app/customer/hdl/hdl_user_identity.go @@ -39,10 +39,18 @@ func SaveCentralKitchenForSchoolUserIdentity(c *gin.Context) { now := time.Now() if isHasUserIdentity == nil { - if identity != enum.UserIdentityForCentralKitchenForStudent { + centralKitchenForSchoolSetDb := db.CentralKitchenForSchoolSetDb{} + centralKitchenForSchoolSetDb.Set(req.EnterpriseId) + set, err := centralKitchenForSchoolSetDb.GetCentralKitchenForSchoolSet() + if err != nil { + e.OutErr(c, e.ERR_DB_ORM, err.Error()) + return + } + if identity != enum.UserIdentityForCentralKitchenForStudent && set.IsOpenLimitTeacherRegister == 1 { e.OutErr(c, e.ERR_NO_DATA, "当前身份信息不存在") return } + //2、新增身份信息 userIdentity := &model.UserIdentity{ Uid: user.Id, diff --git a/app/customer/md/md_enterprise.go b/app/customer/md/md_enterprise.go index 76f2f87..5a4e2f1 100644 --- a/app/customer/md/md_enterprise.go +++ b/app/customer/md/md_enterprise.go @@ -19,6 +19,7 @@ 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:关闭)"` + 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:关闭)"` IsOpenDinner int `json:"is_open_dinner" label:"是否开启晚餐(1:开启 0:关闭)"` diff --git a/app/customer/svc/svc_enterprise.go b/app/customer/svc/svc_enterprise.go index 1668b5b..cafa1d9 100644 --- a/app/customer/svc/svc_enterprise.go +++ b/app/customer/svc/svc_enterprise.go @@ -80,6 +80,7 @@ func CentralKitchenForSchoolInfo(enterpriseId int) (err error, resp md.CentralKi resp.IsOpenTeacherReportMealForMonth = set.IsOpenTeacherReportMealForMonth resp.IsOpenTeacherReportMealForSemester = set.IsOpenTeacherReportMealForSemester resp.IsOpenLimitOrderFood = set.IsOpenLimitOrderFood + resp.IsOpenLimitTeacherRegister = set.IsOpenLimitTeacherRegister } return } diff --git a/app/db/model/central_kitchen_for_school_set.go b/app/db/model/central_kitchen_for_school_set.go index 9c43d2c..c72488e 100644 --- a/app/db/model/central_kitchen_for_school_set.go +++ b/app/db/model/central_kitchen_for_school_set.go @@ -11,6 +11,7 @@ type CentralKitchenForSchoolSet struct { 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)"` + 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"` }