| | |
| | | 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 |
| | | // 检查子订单参数 |
| | |
| | | |
| | | 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), |
| | | }) |
| | | } |