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

92 lines
2.8 KiB

  1. package hdl
  2. import (
  3. "applet/app/admin/lib/validate"
  4. "applet/app/admin/md"
  5. svc2 "applet/app/admin/svc/order"
  6. "applet/app/e"
  7. "applet/app/enum"
  8. "github.com/gin-gonic/gin"
  9. )
  10. func CentralKitchenForSchoolOrderRefundList(c *gin.Context) {
  11. var req md.CentralKitchenForSchoolOrderRefundListReq
  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. list, total, err := svc2.CentralKitchenForSchoolOrderRefundList(req)
  20. if err != nil {
  21. e.OutErr(c, e.ERR_DB_ORM, err.Error())
  22. return
  23. }
  24. e.OutSuc(c, map[string]interface{}{
  25. "list": list,
  26. "total": total,
  27. "audit_kind_list": []map[string]interface{}{
  28. {
  29. "name": "同意",
  30. "value": 1,
  31. },
  32. {
  33. "name": "拒绝",
  34. "value": 2,
  35. },
  36. },
  37. "kind_list": []map[string]interface{}{
  38. {
  39. "name": enum.CentralKitchenForSchoolUserWithDayKind.String(enum.CentralKitchenForSchoolUserWithDayKindForBreakfast),
  40. "value": enum.CentralKitchenForSchoolUserWithDayKindForBreakfast,
  41. },
  42. {
  43. "name": enum.CentralKitchenForSchoolUserWithDayKind.String(enum.CentralKitchenForSchoolUserWithDayKindForLunch),
  44. "value": enum.CentralKitchenForSchoolUserWithDayKindForLunch,
  45. },
  46. {
  47. "name": enum.CentralKitchenForSchoolUserWithDayKind.String(enum.CentralKitchenForSchoolUserWithDayKindForDinner),
  48. "value": enum.CentralKitchenForSchoolUserWithDayKindForDinner,
  49. },
  50. },
  51. "state_list": []map[string]interface{}{
  52. {
  53. "name": enum.CentralKitchenForSchoolUserRefundDayState.String(enum.CentralKitchenForSchoolUserRefundDayStateForAuditing),
  54. "value": enum.CentralKitchenForSchoolUserRefundDayStateForAuditing,
  55. },
  56. {
  57. "name": enum.CentralKitchenForSchoolUserRefundDayState.String(enum.CentralKitchenForSchoolUserRefundDayStateForAuditPass),
  58. "value": enum.CentralKitchenForSchoolUserRefundDayStateForAuditPass,
  59. },
  60. {
  61. "name": enum.CentralKitchenForSchoolUserRefundDayState.String(enum.CentralKitchenForSchoolUserRefundDayStateForAuditReject),
  62. "value": enum.CentralKitchenForSchoolUserRefundDayStateForAuditReject,
  63. },
  64. {
  65. "name": enum.CentralKitchenForSchoolUserRefundDayState.String(enum.CentralKitchenForSchoolUserRefundDayStateForAuditComplete),
  66. "value": enum.CentralKitchenForSchoolUserRefundDayStateForAuditComplete,
  67. },
  68. },
  69. }, nil)
  70. return
  71. }
  72. func CentralKitchenForSchoolOrderRefundAudit(c *gin.Context) {
  73. var req md.CentralKitchenForSchoolOrderRefundAuditReq
  74. err := c.ShouldBindJSON(&req)
  75. if err != nil {
  76. err = validate.HandleValidateErr(err)
  77. err1 := err.(e.E)
  78. e.OutErr(c, err1.Code, err1.Error())
  79. return
  80. }
  81. err = svc2.CentralKitchenForSchoolOrderRefundAudit(req)
  82. if err != nil {
  83. e.OutErr(c, e.ERR, err.Error())
  84. return
  85. }
  86. e.OutSuc(c, "success", nil)
  87. return
  88. }