From cc3f07175d93b5f4fbcc6fd8a87a563a7f8e1a7c Mon Sep 17 00:00:00 2001
From: zhangqian <zhangqian@123.com>
Date: 星期二, 15 八月 2023 14:26:27 +0800
Subject: [PATCH] 服务单批量删除接口

---
 api/v1/client.go |   20 +++++++++-----------
 1 files changed, 9 insertions(+), 11 deletions(-)

diff --git a/api/v1/client.go b/api/v1/client.go
index ad91842..1162b78 100644
--- a/api/v1/client.go
+++ b/api/v1/client.go
@@ -7,7 +7,6 @@
 	"aps_crm/pkg/contextx"
 	"aps_crm/pkg/ecode"
 	"github.com/gin-gonic/gin"
-	"strconv"
 )
 
 type ClientApi struct{}
@@ -33,9 +32,7 @@
 		return
 	}
 
-	// check member exist
-
-	errCode = clientService.AddClient(client)
+	errCode = clientService.AddClient(client, params.SalesLeadsId)
 	if errCode != ecode.OK {
 		ctx.Fail(errCode)
 		return
@@ -60,7 +57,6 @@
 	//if params.MemberId == 0 {
 	//	return ecode.InvalidParams, nil
 	//}
-	client.MemberId = params.MemberId
 
 	t, err := checkTimeFormat(params.NextVisitTime)
 	if err != nil {
@@ -87,6 +83,7 @@
 	client.ClientOriginId = params.ClientOriginId
 	client.ClientLevelId = params.ClientLevelId
 	client.DetailAddress = params.DetailAddress
+	client.ClientStatusId = params.ClientStatusId
 	client.Remark = params.Remark
 	client.Number = params.Number
 	client.ServiceMemberId = params.ServiceMemberId
@@ -100,6 +97,7 @@
 	client.Business.IndustryId = params.IndustryId
 	client.Business.EnterpriseNatureId = params.EnterpriseNatureId
 	client.Business.EnterpriseScaleId = params.EnterpriseScaleId
+	client.MemberId = params.MemberId
 
 	if params.Contact.Name != "" {
 		// assign the client's member id to contact when adding
@@ -120,17 +118,17 @@
 //	@Tags		Client
 //	@Summary	鍒犻櫎瀹㈡埛
 //	@Produce	application/json
-//	@Param		id	path		int	true	"瀹㈡埛ID"
+//	@Param		object	body		request.DeleteClient true	"鏌ヨ鍙傛暟"
 //	@Success	200	{object}	contextx.Response{}
-//	@Router		/api/client/delete/{id} [delete]
+//	@Router		/api/client/delete [delete]
 func (cli *ClientApi) Delete(c *gin.Context) {
-	ctx, ok := contextx.NewContext(c, nil)
+	var params request.DeleteClient
+	ctx, ok := contextx.NewContext(c, &params)
 	if !ok {
 		return
 	}
 
-	id, _ := strconv.Atoi(c.Param("id"))
-	errCode := clientService.DeleteClient(id)
+	errCode := clientService.DeleteClient(params.Ids)
 	if errCode != ecode.OK {
 		ctx.Fail(errCode)
 		return
@@ -192,7 +190,7 @@
 		return
 	}
 
-	clients, total, errCode := clientService.GetClientList(params.Page, params.PageSize, params.Keyword)
+	clients, total, errCode := clientService.GetClientList(params.Page, params.PageSize, params.SearchMap)
 	if errCode != ecode.OK {
 		ctx.Fail(errCode)
 		return

--
Gitblit v1.8.0