123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081 |
- 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"
- "gitee.com/hexingqq/go-backend/pkg/contrib/core"
- "gitee.com/hexingqq/go-backend/pkg/contrib/errors"
- "github.com/gin-gonic/gin"
- )
- 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)
- }
- 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)
- }
- 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)
- }
- 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)
- }
|