|
- package hdl
-
- import (
- "applet/app/admin/lib/validate"
- "applet/app/admin/md"
- "applet/app/db"
- "applet/app/e"
- "applet/app/enum"
- "github.com/gin-gonic/gin"
- )
-
- func SetCenter(c *gin.Context) {
- var req md.SetCenterReq
- err := c.ShouldBindJSON(&req)
- if err != nil {
- err = validate.HandleValidateErr(err)
- err1 := err.(e.E)
- e.OutErr(c, err1.Code, err1.Error())
- return
- }
- sysCfgDb := db.SysCfgDb{}
- sysCfgDb.Set()
- sysCfgDb.SysCfgUpdate(enum.AdministratorContactInfo, req.AdministratorContactInfo)
- sysCfgDb.SysCfgUpdate(enum.CentralKitchenForSchoolReserveMealTime, req.CentralKitchenForSchoolReserveMealTime)
- sysCfgDb.SysCfgUpdate(enum.CentralKitchenForSchoolCancelMealTimeForBreakfast, req.CentralKitchenForSchoolCancelMealTimeForBreakfast)
- sysCfgDb.SysCfgUpdate(enum.CentralKitchenForSchoolCancelMealTimeForLunch, req.CentralKitchenForSchoolCancelMealTimeForLunch)
- sysCfgDb.SysCfgUpdate(enum.CentralKitchenForSchoolCancelMealTimeForDinner, req.CentralKitchenForSchoolCancelMealTimeForDinner)
- e.OutSuc(c, "success", nil)
- return
- }
-
- func GetCenter(c *gin.Context) {
- sysCfgDb := db.SysCfgDb{}
- sysCfgDb.Set()
- res := sysCfgDb.SysCfgFindWithDb(enum.AdministratorContactInfo, enum.CentralKitchenForSchoolReserveMealTime,
- enum.CentralKitchenForSchoolCancelMealTimeForBreakfast,
- enum.CentralKitchenForSchoolCancelMealTimeForLunch,
- enum.CentralKitchenForSchoolCancelMealTimeForDinner)
- e.OutSuc(c, res, nil)
- return
- }
-
- func SetForNursingHome(c *gin.Context) {
- var req md.SetCenterReqForNursingHome
- err := c.ShouldBindJSON(&req)
- if err != nil {
- err = validate.HandleValidateErr(err)
- err1 := err.(e.E)
- e.OutErr(c, err1.Code, err1.Error())
- return
- }
- sysCfgDb := db.SysCfgDb{}
- sysCfgDb.Set()
- sysCfgDb.SysCfgUpdate(enum.NursingHomeReserveMealTime, req.NursingHomeReserveMealTime)
- sysCfgDb.SysCfgUpdate(enum.NursingHomeCancelMealTime, req.NursingHomeCancelMealTime)
- e.OutSuc(c, "success", nil)
- return
- }
-
- func GetForNursingHome(c *gin.Context) {
- sysCfgDb := db.SysCfgDb{}
- sysCfgDb.Set()
- res := sysCfgDb.SysCfgFindWithDb(enum.NursingHomeReserveMealTime, enum.NursingHomeCancelMealTime)
- e.OutSuc(c, res, nil)
- return
- }
|