From f80c6068d5e2ae5b9101125497b4de88726e1d9e Mon Sep 17 00:00:00 2001
From: zhangqian <zhangqian@123.com>
Date: 星期日, 07 四月 2024 21:44:58 +0800
Subject: [PATCH] 发货接口增加仓库ID

---
 service/contact.go |   27 ++++++++++++++++++++++-----
 1 files changed, 22 insertions(+), 5 deletions(-)

diff --git a/service/contact.go b/service/contact.go
index 7b61053..08b1503 100644
--- a/service/contact.go
+++ b/service/contact.go
@@ -33,7 +33,6 @@
 	return ecode.OK
 }
 
-
 func (ContactService) UpdateContact(contact *model.Contact) int {
 	// check contact exist
 	_, err := model.NewContactSearch(nil).SetId(contact.Id).First()
@@ -103,20 +102,38 @@
 	return ecode.OK
 }
 
-func (ContactService) GetContactList(page, pageSize int, keyword string) ([]*model.ContactDetail, int64, int) {
+func (ContactService) GetContactList(page, pageSize int, data map[string]interface{}, clientId int) ([]*model.ContactDetail, int64, int) {
 	// get contact list
-	contacts, total, err := model.NewContactSearch(nil).SetKeyword(keyword).SetPage(page, pageSize).FindAll()
+	contacts, total, err := model.NewContactSearch(nil).SetPage(page, pageSize).SetSearchMap(data).SetClientId(clientId).FindAll()
 	if err != nil {
 		return nil, 0, ecode.ContactListErr
 	}
 	return contacts, total, ecode.OK
 }
 
-func (ContactService) DeleteContact (ids []int) int {
+func (ContactService) DeleteContact(ids []int) int {
 	// delete client
 	err := model.NewContactSearch(nil).SetIds(ids).Delete()
 	if err != nil {
 		return ecode.ContactDeleteErr
 	}
 	return ecode.OK
-}
\ No newline at end of file
+}
+
+func (ContactService) Assign(ids []int, memberId int) int {
+	// check contact exist
+	//errCode := CheckContactExist(id)
+	//if errCode != ecode.OK {
+	//	return errCode
+	//}
+
+	// assign contact
+	err := model.NewContactSearch(nil).SetIds(ids).UpdateByMap(map[string]interface{}{
+		"member_id": memberId,
+	})
+	if err != nil {
+		return ecode.ContactAssignErr
+	}
+
+	return ecode.OK
+}

--
Gitblit v1.8.0