智慧食堂
Du kannst nicht mehr als 25 Themen auswählen Themen müssen entweder mit einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.

108 Zeilen
2.7 KiB

  1. package hdl
  2. import (
  3. "applet/app/admin/lib/validate"
  4. "applet/app/admin/md"
  5. "applet/app/admin/svc"
  6. svc2 "applet/app/admin/svc/enterprise_manage"
  7. "applet/app/db"
  8. "applet/app/e"
  9. "applet/app/enum"
  10. "applet/app/utils"
  11. "github.com/gin-gonic/gin"
  12. )
  13. func EnterpriseManageInfo(c *gin.Context) {
  14. enterpriseId := c.DefaultQuery("enterprise_id", "")
  15. enterpriseDb := db.EnterpriseDb{}
  16. enterpriseDb.Set()
  17. enterprise, err := enterpriseDb.GetEnterprise(utils.StrToInt(enterpriseId))
  18. if err != nil {
  19. e.OutErr(c, e.ERR_DB_ORM, err.Error())
  20. return
  21. }
  22. if enterprise == nil {
  23. e.OutErr(c, e.ERR_NO_DATA, "未查询到对应记录")
  24. return
  25. }
  26. var resp interface{}
  27. switch enterprise.Kind {
  28. case enum.EnterprisePvdByCentralKitchenForSchool:
  29. err, resp = svc.CentralKitchenForSchoolInfo(utils.StrToInt(enterpriseId))
  30. if err != nil {
  31. e.OutErr(c, e.ERR, err.Error())
  32. return
  33. }
  34. break
  35. case enum.EnterprisePvdByCentralKitchenForFactory:
  36. break
  37. case enum.EnterprisePvdBySelfSupportForSchool:
  38. break
  39. case enum.EnterprisePvdBySelfSupportForFactory:
  40. break
  41. }
  42. e.OutSuc(c, map[string]interface{}{
  43. "info": resp,
  44. "kind": []map[string]interface{}{
  45. {
  46. "name": enum.EnterprisePvd(enum.EnterprisePvdByCentralKitchenForSchool).String(),
  47. "value": enum.EnterprisePvdByCentralKitchenForSchool,
  48. },
  49. {
  50. "name": enum.EnterprisePvd(enum.EnterprisePvdByCentralKitchenForFactory).String(),
  51. "value": enum.EnterprisePvdByCentralKitchenForFactory,
  52. },
  53. {
  54. "name": enum.EnterprisePvd(enum.EnterprisePvdBySelfSupportForSchool).String(),
  55. "value": enum.EnterprisePvdBySelfSupportForSchool,
  56. },
  57. {
  58. "name": enum.EnterprisePvd(enum.EnterprisePvdBySelfSupportForFactory).String(),
  59. "value": enum.EnterprisePvdBySelfSupportForFactory,
  60. },
  61. },
  62. }, nil)
  63. return
  64. }
  65. func UserIdentityList(c *gin.Context) {
  66. var req md.EnterpriseUserListReq
  67. err := c.ShouldBindJSON(&req)
  68. if err != nil {
  69. err = validate.HandleValidateErr(err)
  70. err1 := err.(e.E)
  71. e.OutErr(c, err1.Code, err1.Error())
  72. return
  73. }
  74. enterpriseDb := db.EnterpriseDb{}
  75. enterpriseDb.Set()
  76. enterprise, err := enterpriseDb.GetEnterprise(req.EnterpriseId)
  77. if err != nil {
  78. e.OutErr(c, e.ERR_DB_ORM, err.Error())
  79. return
  80. }
  81. if enterprise == nil {
  82. e.OutErr(c, e.ERR_NO_DATA, "未查询到对应记录")
  83. return
  84. }
  85. var resp interface{}
  86. switch enterprise.Kind {
  87. case enum.EnterprisePvdByCentralKitchenForSchool:
  88. resp, err = svc2.EnterpriseUserListByCentralKitchenForSchool(req)
  89. if err != nil {
  90. e.OutErr(c, e.ERR, err.Error())
  91. return
  92. }
  93. break
  94. case enum.EnterprisePvdByCentralKitchenForFactory:
  95. break
  96. case enum.EnterprisePvdBySelfSupportForSchool:
  97. break
  98. case enum.EnterprisePvdBySelfSupportForFactory:
  99. break
  100. }
  101. e.OutSuc(c, resp, nil)
  102. return
  103. }