智慧食堂
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

hdl_set_center.go 2.1 KiB

1 year ago
3 months ago
3 months ago
1 year ago
1 year ago
1 year ago
1 year ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. package hdl
  2. import (
  3. "applet/app/admin/lib/validate"
  4. "applet/app/admin/md"
  5. "applet/app/db"
  6. "applet/app/e"
  7. "applet/app/enum"
  8. "github.com/gin-gonic/gin"
  9. )
  10. func SetCenter(c *gin.Context) {
  11. var req md.SetCenterReq
  12. err := c.ShouldBindJSON(&req)
  13. if err != nil {
  14. err = validate.HandleValidateErr(err)
  15. err1 := err.(e.E)
  16. e.OutErr(c, err1.Code, err1.Error())
  17. return
  18. }
  19. sysCfgDb := db.SysCfgDb{}
  20. sysCfgDb.Set()
  21. sysCfgDb.SysCfgUpdate(enum.AdministratorContactInfo, req.AdministratorContactInfo)
  22. sysCfgDb.SysCfgUpdate(enum.CentralKitchenForSchoolReserveMealTime, req.CentralKitchenForSchoolReserveMealTime)
  23. sysCfgDb.SysCfgUpdate(enum.CentralKitchenForSchoolCancelMealTimeForBreakfast, req.CentralKitchenForSchoolCancelMealTimeForBreakfast)
  24. sysCfgDb.SysCfgUpdate(enum.CentralKitchenForSchoolCancelMealTimeForLunch, req.CentralKitchenForSchoolCancelMealTimeForLunch)
  25. sysCfgDb.SysCfgUpdate(enum.CentralKitchenForSchoolCancelMealTimeForDinner, req.CentralKitchenForSchoolCancelMealTimeForDinner)
  26. e.OutSuc(c, "success", nil)
  27. return
  28. }
  29. func GetCenter(c *gin.Context) {
  30. sysCfgDb := db.SysCfgDb{}
  31. sysCfgDb.Set()
  32. res := sysCfgDb.SysCfgFindWithDb(enum.AdministratorContactInfo, enum.CentralKitchenForSchoolReserveMealTime,
  33. enum.CentralKitchenForSchoolCancelMealTimeForBreakfast,
  34. enum.CentralKitchenForSchoolCancelMealTimeForLunch,
  35. enum.CentralKitchenForSchoolCancelMealTimeForDinner)
  36. e.OutSuc(c, res, nil)
  37. return
  38. }
  39. func SetForNursingHome(c *gin.Context) {
  40. var req md.SetCenterReqForNursingHome
  41. err := c.ShouldBindJSON(&req)
  42. if err != nil {
  43. err = validate.HandleValidateErr(err)
  44. err1 := err.(e.E)
  45. e.OutErr(c, err1.Code, err1.Error())
  46. return
  47. }
  48. sysCfgDb := db.SysCfgDb{}
  49. sysCfgDb.Set()
  50. sysCfgDb.SysCfgUpdate(enum.NursingHomeReserveMealTime, req.NursingHomeReserveMealTime)
  51. sysCfgDb.SysCfgUpdate(enum.NursingHomeCancelMealTime, req.NursingHomeCancelMealTime)
  52. e.OutSuc(c, "success", nil)
  53. return
  54. }
  55. func GetForNursingHome(c *gin.Context) {
  56. sysCfgDb := db.SysCfgDb{}
  57. sysCfgDb.Set()
  58. res := sysCfgDb.SysCfgFindWithDb(enum.NursingHomeReserveMealTime, enum.NursingHomeCancelMealTime)
  59. e.OutSuc(c, res, nil)
  60. return
  61. }