package manage import ( "Cold_Logistic/internal/pkg/common/codex" "Cold_Logistic/internal/pkg/common/global" "Cold_Logistic/internal/server/application/statisticsrv" "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" ) // statOrderNumByTime // @Tags 后台-统计 // @Summary 根据订单开始时间统计 // @Success 200 {object} dao.StaticNumData "成功响应的结构体" // @Param req body statisticsrv.OrderNumTimeStatReqVO true "请求参数" // @Accept application/json // @Router /manage/statistic/orderNum/byTime [post] func (api Api) statOrderNumByTime(c *gin.Context) { req := statisticsrv.OrderNumTimeStatReqVO{} if err := c.BindJSON(&req); err != nil { core.WriteErrResponse(c, errors.WithCodeOnce(err, codex.ErrBindJSON, "")) return } srv := statisticsrv.NewStatisticService(dao.NewDataStore(global.CommonConnectRepoInst.StoreDB)) res, err := srv.OrderNumTimeStat(c, req) if err != nil { core.WriteErrResponse(c, errors.WithCodeOnce(err, codex.ErrQueryFailed, "")) return } core.WriteResponse(c, nil, res) } // statOrderNumByUser // @Tags 后台-统计 // @Summary 根据订单用户统计 // @Success 200 {object} swagger.PageListResponse "成功响应的结构体" // @Param req body swagger.OrderNumUserStatReqVO true "请求参数" // @Accept application/json // @Router /manage/statistic/orderNum/byUser [post] func (api Api) statOrderNumByUser(c *gin.Context) { req := statisticsrv.OrderNumUserStatReqVO{} if err := c.BindJSON(&req); err != nil { core.WriteErrResponse(c, errors.WithCodeOnce(err, codex.ErrBindJSON, "")) return } srv := statisticsrv.NewStatisticService(dao.NewDataStore(global.CommonConnectRepoInst.StoreDB)) res, err := srv.OrderNumUserStat(c, req) if err != nil { core.WriteErrResponse(c, errors.WithCodeOnce(err, codex.ErrQueryFailed, "")) return } core.WriteResponse(c, nil, res) }