面包店
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
 
 
 
 
 

69 行
1.4 KiB

  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. }