123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117 |
- package myself
- import (
- "Cold_Logistic/internal/pkg/common/codex"
- "Cold_Logistic/internal/pkg/common/global"
- "Cold_Logistic/internal/server/application/myselfsrv"
- "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 用户-我的
- // @BasePath /clodLogistic/app/api/v1
- // @Summary 订单列表
- // @Success 200 {object} swagger.PageListResponse "成功响应的结构体"
- // @Param req body swagger.OrderPageReqVO true "请求参数"
- // @Accept application/json
- // @Authorization
- // @Router /app/myself/orderPage [post]
- func (api Api) orderPage(c *gin.Context) {
- req := myselfsrv.OrderPageReqVO{}
- if err := c.BindJSON(&req); err != nil {
- core.WriteErrResponse(c, errors.WithCodeOnce(err, codex.ErrBindJSON, ""))
- return
- }
- srv := myselfsrv.NewMyselfService(dao.NewDataStore(global.CommonConnectRepoInst.StoreDB))
- res, err := srv.OrderPage(c, req)
- if err != nil {
- core.WriteErrResponse(c, errors.WithCodeOnce(err, codex.ErrQueryFailed, ""))
- return
- }
- core.WriteResponse(c, nil, res)
- }
- // orderSubNo
- // @Tags 用户-我的
- // @BasePath /clodLogistic/app/api/v1
- // @Summary 订单揽件码
- // @Success 200 {object} myselfsrv.OrderSubNoRespVO "成功响应的结构体"
- // @Param req body myselfsrv.OrderSubNoReqVO true "请求参数"
- // @Accept application/json
- // @Authorization
- // @Router /app/myself/orderSubNo [post]
- func (api Api) orderSubNo(c *gin.Context) {
- req := myselfsrv.OrderSubNoReqVO{}
- if err := c.BindJSON(&req); err != nil {
- core.WriteErrResponse(c, errors.WithCodeOnce(err, codex.ErrBindJSON, ""))
- return
- }
- srv := myselfsrv.NewMyselfService(dao.NewDataStore(global.CommonConnectRepoInst.StoreDB))
- res, err := srv.OrderSubNo(c, req)
- if err != nil {
- core.WriteErrResponse(c, errors.WithCodeOnce(err, codex.ErrQueryFailed, ""))
- return
- }
- core.WriteResponse(c, nil, res)
- }
- // placeOrder
- // @Tags 用户-我的
- // @BasePath /clodLogistic/app/api/v1
- // @Summary 下单
- // @Success 200 {object} ordersrv.PlaceOrderRespVO "成功响应的结构体"
- // @Param req body ordersrv.PlaceOrderReqVO true "请求参数"
- // @Accept application/json
- // @Authorization
- // @Router /app/myself/placeOrder [post]
- func (api Api) placeOrder(c *gin.Context) {
- req := ordersrv.PlaceOrderReqVO{}
- if err := c.BindJSON(&req); err != nil {
- core.WriteErrResponse(c, errors.WithCodeOnce(err, codex.ErrBindJSON, ""))
- return
- }
- if err := req.Validate(); err != nil {
- core.WriteErrResponse(c, errors.WithCodeOnce(err, codex.ErrParamValidate, "参数验证失败:"))
- return
- }
- srv := ordersrv.NewOrderService(dao.NewDataStore(global.CommonConnectRepoInst.StoreDB))
- res, err := srv.PlaceOrder(c, req)
- if err != nil {
- core.WriteErrResponse(c, errors.WithCodeOnce(err, codex.ErrPlaceOrderFailed, ""))
- return
- }
- core.WriteResponse(c, nil, res)
- }
- // placeOrder
- // @Tags 用户-我的
- // @BasePath /clodLogistic/app/api/v1
- // @Summary 订单详情
- // @Success 200 {object} ordersrv.OrderDetailRespVO "成功响应的结构体"
- // @Param req body ordersrv.OrderDetailReqVO true "请求参数"
- // @Accept application/json
- // @Authorization
- // @Router /app/myself/orderDetail [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)
- }
|