|
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061 |
- 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.CentralKitchenForSchoolCancelMealTime, req.CentralKitchenForSchoolCancelMealTime)
- e.OutSuc(c, "success", nil)
- return
- }
-
- func GetCenter(c *gin.Context) {
- sysCfgDb := db.SysCfgDb{}
- sysCfgDb.Set()
- res := sysCfgDb.SysCfgFindWithDb(enum.AdministratorContactInfo, enum.CentralKitchenForSchoolReserveMealTime, enum.CentralKitchenForSchoolCancelMealTime)
- 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
- }
|