|
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768 |
- package hdl
-
- import (
- "applet/app/bigData/lib/validate"
- "applet/app/bigData/md"
- "applet/app/bigData/svc"
- "applet/app/e"
- "applet/app/enum"
- "github.com/gin-gonic/gin"
- )
-
- func LeftData(c *gin.Context) {
- loginKind := svc.GetUser(c).LoginKind
- var result interface{}
- var err error
- switch loginKind {
- case enum.LoginKindForMake:
- result, err = svc.LeftDataForMake()
- break
- case enum.LoginKindForBaking:
- result, err = svc.LeftDataForBaking()
- break
- case enum.LoginKindForSorting:
- result, err = svc.LeftDataForSorting()
- break
- }
- if err != nil {
- e.OutErr(c, e.ERR, err.Error())
- return
- }
- e.OutSuc(c, result, nil)
- return
- }
-
- func RightData(c *gin.Context) {
- var req md.RightDataForMakeReq
- err := c.ShouldBindJSON(&req)
- if err != nil {
- err = validate.HandleValidateErr(err)
- err1 := err.(e.E)
- e.OutErr(c, err1.Code, err1.Error())
- return
- }
- loginKind := svc.GetUser(c).LoginKind
-
- var result interface{}
- var total int64
- switch loginKind {
- case enum.LoginKindForMake:
- result, total, err = svc.RightDataForMake(req)
- break
- case enum.LoginKindForBaking:
- result, total, err = svc.RightDataForMake(req)
- break
- case enum.LoginKindForSorting:
- result, total, err = svc.RightDataForMake(req)
- break
- }
- if err != nil {
- e.OutErr(c, e.ERR, err.Error())
- return
- }
- e.OutSuc(c, map[string]interface{}{
- "list": result,
- "total": total,
- }, nil)
- return
- }
|