From 2267c97ab1cbbe94edcc221e960084fc63d52afe Mon Sep 17 00:00:00 2001
From: wangpengfei <274878379@qq.com>
Date: 星期三, 26 七月 2023 10:19:49 +0800
Subject: [PATCH] fix fix file name

---
 api/v1/subOrder.go |   64 +++++++++++++++++--------------
 1 files changed, 35 insertions(+), 29 deletions(-)

diff --git a/api/v1/subOrder.go b/api/v1/subOrder.go
index 41e74cd..fd049ca 100644
--- a/api/v1/subOrder.go
+++ b/api/v1/subOrder.go
@@ -87,6 +87,8 @@
 		return
 	}
 
+	subOrder.Id = params.Id
+
 	errCode = subOrderService.UpdateSubOrder(&subOrder)
 	if errCode != ecode.OK {
 		ctx.Fail(errCode)
@@ -96,39 +98,16 @@
 	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
 // 妫�鏌ュ瓙璁㈠崟鍙傛暟
 func checkSubOrderParams(subOrder request.SubOrder) (errCode int, newSubOrder model.SubOrder) {
-	if subOrder.Number == "" {
-		return ecode.InvalidParams, newSubOrder
-	}
-	if subOrder.MemberId == 0 {
-		return ecode.InvalidParams, newSubOrder
-	}
+	//if subOrder.Number == "" {
+	//	return ecode.InvalidParams, newSubOrder
+	//}
+	//if subOrder.MemberId == 0 {
+	//	return ecode.InvalidParams, newSubOrder
+	//}
 
 	newSubOrder.ClientId = subOrder.ClientId
 	newSubOrder.MasterOrderId = subOrder.MasterOrderId
@@ -139,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, &params)
+	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