From 38427bd1931107447652cde2ccd69eb0c1ebd4cf Mon Sep 17 00:00:00 2001
From: wangpengfei <274878379@qq.com>
Date: 星期四, 03 八月 2023 13:59:31 +0800
Subject: [PATCH] fix

---
 service/contact.go |   23 ++++++++++++++++++++---
 1 files changed, 20 insertions(+), 3 deletions(-)

diff --git a/service/contact.go b/service/contact.go
index 7b61053..25f898d 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()
@@ -112,11 +111,29 @@
 	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