智慧食堂
Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

62 строки
1.7 KiB

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