面包店
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_data.go 1.4 KiB

9 months ago
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. package hdl
  2. import (
  3. "applet/app/bigData/lib/validate"
  4. "applet/app/bigData/md"
  5. "applet/app/bigData/svc"
  6. "applet/app/e"
  7. "applet/app/enum"
  8. "github.com/gin-gonic/gin"
  9. )
  10. func LeftData(c *gin.Context) {
  11. loginKind := svc.GetUser(c).LoginKind
  12. var result interface{}
  13. var err error
  14. switch loginKind {
  15. case enum.LoginKindForMake:
  16. result, err = svc.LeftDataForMake()
  17. break
  18. case enum.LoginKindForBaking:
  19. result, err = svc.LeftDataForBaking()
  20. break
  21. case enum.LoginKindForSorting:
  22. result, err = svc.LeftDataForSorting()
  23. break
  24. }
  25. if err != nil {
  26. e.OutErr(c, e.ERR, err.Error())
  27. return
  28. }
  29. e.OutSuc(c, result, nil)
  30. return
  31. }
  32. func RightData(c *gin.Context) {
  33. var req md.RightDataForMakeReq
  34. err := c.ShouldBindJSON(&req)
  35. if err != nil {
  36. err = validate.HandleValidateErr(err)
  37. err1 := err.(e.E)
  38. e.OutErr(c, err1.Code, err1.Error())
  39. return
  40. }
  41. loginKind := svc.GetUser(c).LoginKind
  42. var result interface{}
  43. var total int64
  44. switch loginKind {
  45. case enum.LoginKindForMake:
  46. result, total, err = svc.RightDataForMake(req)
  47. break
  48. case enum.LoginKindForBaking:
  49. result, total, err = svc.RightDataForMake(req)
  50. break
  51. case enum.LoginKindForSorting:
  52. result, total, err = svc.RightDataForMake(req)
  53. break
  54. }
  55. if err != nil {
  56. e.OutErr(c, e.ERR, err.Error())
  57. return
  58. }
  59. e.OutSuc(c, map[string]interface{}{
  60. "list": result,
  61. "total": total,
  62. }, nil)
  63. return
  64. }