From e0a433e9c31594527a3bf7766c0bfb2cbbceffdb Mon Sep 17 00:00:00 2001 From: wangpengfei <274878379@qq.com> Date: 星期三, 26 七月 2023 10:09:04 +0800 Subject: [PATCH] fix add pageInfo, keyword to all the list --- api/v1/subOrder.go | 50 +++++++++++++++++++++++++++----------------------- 1 files changed, 27 insertions(+), 23 deletions(-) diff --git a/api/v1/subOrder.go b/api/v1/subOrder.go index a13f934..fd049ca 100644 --- a/api/v1/subOrder.go +++ b/api/v1/subOrder.go @@ -98,29 +98,6 @@ ctx.Ok() } -// List -// -// @Tags SubOrder -// @Summary 鑾峰彇瀛愯鍗曞垪琛� -// @Produce application/json -// @Success 200 {object} contextx.Response{data=response.SubOrderResponse} -// @Router /api/subOrder/list [get] -func (s *SubOrderApi) List(c *gin.Context) { - ctx, ok := contextx.NewContext(c, nil) - if !ok { - return - } - - subOrders, errCode := subOrderService.GetSubOrderList() - if errCode != ecode.OK { - ctx.Fail(errCode) - return - } - - ctx.OkWithDetailed(response.SubOrderResponse{ - List: subOrders, - }) -} // checkSubOrderParams // 妫�鏌ュ瓙璁㈠崟鍙傛暟 @@ -141,3 +118,30 @@ return ecode.OK, newSubOrder } + +// List +// +// @Tags SubOrder +// @Summary 閿�鍞瓙鍗曞垪琛� +// @Produce application/json +// @Param object body request.GetSubOrderList true "鍙傛暟" +// @Success 200 {object} contextx.Response{data=response.SubOrderResponse} +// @Router /api/subOrder/list [post] +func (con *SubOrderApi) List(c *gin.Context) { + var params request.GetSubOrderList + ctx, ok := contextx.NewContext(c, ¶ms) + if !ok { + return + } + + subOrders, errCode := subOrderService.GetSubOrderList(params.Page, params.PageSize, params.Keyword) + if errCode != ecode.OK { + ctx.Fail(errCode) + return + } + + ctx.OkWithDetailed(response.SubOrderResponse{ + List: subOrders, + Count: len(subOrders), + }) +} -- Gitblit v1.8.0