From c5a0eb549cba2cd358a2d0496c44f3a289f15d9c Mon Sep 17 00:00:00 2001
From: wangpengfei <274878379@qq.com>
Date: 星期一, 28 八月 2023 14:22:06 +0800
Subject: [PATCH] fix

---
 api/v1/saleChance.go |   47 ++++++++++++++++++++++++++++++++++++-----------
 1 files changed, 36 insertions(+), 11 deletions(-)

diff --git a/api/v1/saleChance.go b/api/v1/saleChance.go
index b938563..6c9d8dc 100644
--- a/api/v1/saleChance.go
+++ b/api/v1/saleChance.go
@@ -7,7 +7,6 @@
 	"aps_crm/pkg/contextx"
 	"aps_crm/pkg/ecode"
 	"github.com/gin-gonic/gin"
-	"strconv"
 )
 
 type SaleChanceApi struct{}
@@ -47,17 +46,17 @@
 //	@Tags		SaleChance
 //	@Summary	鍒犻櫎閿�鍞満浼�
 //	@Produce	application/json
-//	@Param		id	path		int	true	"鏌ヨ鍙傛暟"
+//	@Param		object	body		request.DeleteSaleChance true	"鏌ヨ鍙傛暟"
 //	@Success	200	{object}	contextx.Response{}
-//	@Router		/api/saleChance/delete/{id} [delete]
+//	@Router		/api/saleChance/delete [delete]
 func (s *SaleChanceApi) Delete(c *gin.Context) {
-	ctx, ok := contextx.NewContext(c, nil)
+	var params request.DeleteSaleChance
+	ctx, ok := contextx.NewContext(c, &params)
 	if !ok {
 		return
 	}
 
-	id, _ := strconv.Atoi(c.Param("id"))
-	errCode := saleChanceService.DeleteSaleChance(id)
+	errCode := saleChanceService.DeleteSaleChance(params.Ids)
 	if errCode != ecode.OK {
 		ctx.Fail(errCode)
 		return
@@ -103,7 +102,6 @@
 
 	ctx.Ok()
 }
-
 
 // checkSaleChanceParams
 // 妫�鏌ラ攢鍞満浼氬弬鏁�
@@ -191,7 +189,9 @@
 //	@Summary	閿�鍞満浼氬垪琛�
 //	@Produce	application/json
 //	@Param		object	body		request.GetSaleChanceList	true	"鍙傛暟"
-//	@Success	200		{object}	contextx.Response{data=response.SaleChanceResponse}
+//
+// @Success	200		{object}	contextx.Response{data=response.SaleChanceResponse}
+//
 //	@Router		/api/saleChance/list [post]
 func (con *SaleChanceApi) List(c *gin.Context) {
 	var params request.GetSaleChanceList
@@ -200,14 +200,39 @@
 		return
 	}
 
-	saleChances, total, errCode := saleChanceService.GetSaleChanceList(params.Page, params.PageSize, params.Keyword)
+	saleChances, total, errCode := saleChanceService.GetSaleChanceList(params.Page, params.PageSize, params.SearchMap)
 	if errCode != ecode.OK {
 		ctx.Fail(errCode)
 		return
 	}
 
 	ctx.OkWithDetailed(response.SaleChanceResponse{
-		List: saleChances,
+		List:  saleChances,
 		Count: int(total),
 	})
-}
\ No newline at end of file
+}
+
+// Push
+//
+//	@Tags		SaleChance
+//	@Summary	鎺ㄨ繘閿�鍞満浼�
+//	@Produce	application/json
+//	@Param		object	body		request.PushSaleChance  true	"鏌ヨ鍙傛暟"
+//	@Success	200	{object}	contextx.Response{}
+//	@Router		/api/saleChance/push [put]
+func (s *SaleChanceApi) Push(c *gin.Context) {
+	var params request.PushSaleChance
+	ctx, ok := contextx.NewContext(c, &params)
+	if !ok {
+		ctx.Fail(ecode.InvalidParams)
+		return
+	}
+
+	errCode := saleChanceService.PushSaleChance(params.Id, params.Step)
+	if errCode != ecode.OK {
+		ctx.Fail(errCode)
+		return
+	}
+
+	ctx.Ok()
+}

--
Gitblit v1.8.0