package manage import ( "Cold_Logistic/internal/pkg/common/codex" "Cold_Logistic/internal/pkg/common/global" "Cold_Logistic/internal/server/application/ordersrv" "Cold_Logistic/internal/server/infra/dao" "github.com/gin-gonic/gin" "gogs.baozhida.cn/Cold_Logistic_libs/pkg/contrib/core" "gogs.baozhida.cn/Cold_Logistic_libs/pkg/contrib/errors" ) // orderPage // @Tags 后台-订单管理 // @Summary 订单列表 // @Success 200 {object} swagger.PageListResponse "成功响应的结构体" // @Param req body swagger.ManageOrderPageReqVO true "请求参数" // @Accept application/json // @Router /manage/order/page [post] func (api Api) orderPage(c *gin.Context) { req := ordersrv.ManageOrderPageReqVO{} if err := c.BindJSON(&req); err != nil { core.WriteErrResponse(c, errors.WithCodeOnce(err, codex.ErrBindJSON, "")) return } srv := ordersrv.NewOrderService(dao.NewDataStore(global.CommonConnectRepoInst.StoreDB)) res, err := srv.ManageOrderPage(c, req) if err != nil { core.WriteErrResponse(c, errors.WithCodeOnce(err, codex.ErrQueryFailed, "")) return } core.WriteResponse(c, nil, res) } // orderDetail // @Tags 后台-订单管理 // @Summary 订单详情 // @Success 200 {object} ordersrv.OrderDetailRespVO "成功响应的结构体" // @Param req body ordersrv.OrderDetailReqVO true "请求参数" // @Accept application/json // @Router /manage/order/detail [post] func (api Api) orderDetail(c *gin.Context) { req := ordersrv.OrderDetailReqVO{} if err := c.BindJSON(&req); err != nil { core.WriteErrResponse(c, errors.WithCodeOnce(err, codex.ErrBindJSON, "")) return } srv := ordersrv.NewOrderService(dao.NewDataStore(global.CommonConnectRepoInst.StoreDB)) res, err := srv.OrderDetail(c, req) if err != nil { core.WriteErrResponse(c, errors.WithCodeOnce(err, codex.ErrQueryFailed, "")) return } core.WriteResponse(c, nil, res) } // orderLogistic // @Tags 后台-订单管理 // @Summary 物流详情 // @Success 200 {object} ordersrv.OrderLogisticDetailRespVO "成功响应的结构体" // @Param req body ordersrv.OrderLogisticDetailReqVO true "请求参数" // @Accept application/json // @Router /manage/order/logistic [post] func (api Api) orderLogistic(c *gin.Context) { req := ordersrv.OrderLogisticDetailReqVO{} if err := c.BindJSON(&req); err != nil { core.WriteErrResponse(c, errors.WithCodeOnce(err, codex.ErrBindJSON, "")) return } srv := ordersrv.NewOrderService(dao.NewDataStore(global.CommonConnectRepoInst.StoreDB)) res, err := srv.OrderLogisticDetail(c, req) if err != nil { core.WriteErrResponse(c, errors.WithCodeOnce(err, codex.ErrQueryFailed, "")) return } core.WriteResponse(c, nil, res) } // orderAssign // @Tags 后台-订单管理 // @Summary 派单订单 // @Success 200 {object} ordersrv.AssignOrderRespVO "成功响应的结构体" // @Param req body ordersrv.AssignOrderReqVO true "请求参数" // @Accept application/json // @Router /manage/order/assign [post] func (api Api) orderAssign(c *gin.Context) { req := ordersrv.AssignOrderReqVO{} if err := c.BindJSON(&req); err != nil { core.WriteErrResponse(c, errors.WithCodeOnce(err, codex.ErrBindJSON, "")) return } srv := ordersrv.NewOrderService(dao.NewDataStore(global.CommonConnectRepoInst.StoreDB)) res, err := srv.AssignOrder(c, req) if err != nil { core.WriteErrResponse(c, errors.WithCodeOnce(err, codex.ErrQueryFailed, "")) return } core.WriteResponse(c, nil, res) }