package routers import ( "github.com/gin-gonic/gin" "kpt.xdmy/apiserver/model" "kpt.xdmy/apiserver/model/http" "kpt.xdmy/pkg/app" "kpt.xdmy/pkg/e" ) func InsertDieselData(c *gin.Context) { appG := app.Gin{C: c} p := new(http.DieselReq) if !Bind(c, p) { return } err := svc.InsertDieselData(p) if err != nil { c.JSON(200, map[string]interface{}{"code": 200, "data": err.Error(), "msg": "fail"}) return } appG.Response(200, e.SUCCESS, true) } func InsertDieselImportExcel(c *gin.Context) { appG := app.Gin{C: c} data, err := svc.ImportExcel(c) if err != nil { c.JSON(200, map[string]interface{}{"code": 200, "data": err.Error(), "msg": "fail"}) return } appG.Response(200, e.SUCCESS, data) } func DieselOff(c *gin.Context) { p := new(http.DieselReq) if !Bind(c, p) { return } hrp := svc.DieselOff(p.Id) c.JSON(200, &hrp) } func EditPartpurchase(c *gin.Context) { appG := app.Gin{C: c} req := make([]*model.EditPartpurchaseReq, 0) if err := c.ShouldBind(&req); err != nil { appG.Response(500, e.ERROR, "数据格式不正确!"+err.Error()) return } err := svc.EditPartpurchase(req) if err != nil { appG.Response(200, e.ERROR, err.Error()) return } appG.Response(200, e.SUCCESS, true) }