智慧食堂
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.3 KiB

1 year ago
4 months ago
3 months ago
4 months ago
3 months ago
4 months ago
1 year ago
1 year ago
1 year ago
1 year ago
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  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. sysCfgDb.SysCfgUpdate(enum.CentralKitchenForSchoolTeacherMealNotice, req.CentralKitchenForSchoolTeacherMealNotice)
  27. e.OutSuc(c, "success", nil)
  28. return
  29. }
  30. func GetCenter(c *gin.Context) {
  31. sysCfgDb := db.SysCfgDb{}
  32. sysCfgDb.Set()
  33. res := sysCfgDb.SysCfgFindWithDb(enum.AdministratorContactInfo, enum.CentralKitchenForSchoolReserveMealTime,
  34. enum.CentralKitchenForSchoolCancelMealTimeForBreakfast,
  35. enum.CentralKitchenForSchoolCancelMealTimeForLunch,
  36. enum.CentralKitchenForSchoolTeacherMealNotice,
  37. enum.CentralKitchenForSchoolCancelMealTimeForDinner)
  38. e.OutSuc(c, res, nil)
  39. return
  40. }
  41. func SetForNursingHome(c *gin.Context) {
  42. var req md.SetCenterReqForNursingHome
  43. err := c.ShouldBindJSON(&req)
  44. if err != nil {
  45. err = validate.HandleValidateErr(err)
  46. err1 := err.(e.E)
  47. e.OutErr(c, err1.Code, err1.Error())
  48. return
  49. }
  50. sysCfgDb := db.SysCfgDb{}
  51. sysCfgDb.Set()
  52. sysCfgDb.SysCfgUpdate(enum.NursingHomeReserveMealTime, req.NursingHomeReserveMealTime)
  53. sysCfgDb.SysCfgUpdate(enum.NursingHomeCancelMealTime, req.NursingHomeCancelMealTime)
  54. e.OutSuc(c, "success", nil)
  55. return
  56. }
  57. func GetForNursingHome(c *gin.Context) {
  58. sysCfgDb := db.SysCfgDb{}
  59. sysCfgDb.Set()
  60. res := sysCfgDb.SysCfgFindWithDb(enum.NursingHomeReserveMealTime, enum.NursingHomeCancelMealTime)
  61. e.OutSuc(c, res, nil)
  62. return
  63. }