From 8be40ffd79c4dcdb4dc00bef359ccf48a6b031f3 Mon Sep 17 00:00:00 2001
From: zhangqian <zhangqian@123.com>
Date: 星期六, 28 十月 2023 15:56:26 +0800
Subject: [PATCH] 若干接口支持查看下属数据

---
 api/v1/contact.go |   17 ++++++++++++++++-
 1 files changed, 16 insertions(+), 1 deletions(-)

diff --git a/api/v1/contact.go b/api/v1/contact.go
index 1a72e6b..2a6b72e 100644
--- a/api/v1/contact.go
+++ b/api/v1/contact.go
@@ -34,11 +34,25 @@
 		return
 	}
 
+	if params.MemberId == 0 {
+		userInfo := utils.GetUserInfo(c)
+		if userInfo.UserType == constvar.UserTypeSub {
+			params.MemberId = userInfo.CrmUserId
+		}
+	}
+
 	errCode = contactService.AddContact(&contact)
 	if errCode != ecode.OK {
 		ctx.Fail(errCode)
 		return
 	}
+	//if params.CodeRule.Method == 1 {
+	//	autoCode := model.GetAutoCode(contact.Id, &params.CodeRule)
+	//	m := map[string]interface{}{
+	//		"number": autoCode,
+	//	}
+	//	_ = model.NewContactSearch(nil).SetId(contact.Id).UpdateByMap(m)
+	//}
 
 	ctx.Ok()
 }
@@ -143,6 +157,7 @@
 	contact.Birthday = t
 	contact.Wechat = params.Wechat
 	contact.IsFirst = params.IsFirst
+	//contact.CodeStandID = params.CodeStandID
 	return ecode.OK, contact
 }
 
@@ -169,7 +184,7 @@
 		params.SearchMap["member_id"] = userInfo.CrmUserId
 	}
 
-	contacts, total, errCode := contactService.GetContactList(params.Page, params.PageSize, params.SearchMap)
+	contacts, total, errCode := contactService.GetContactList(params.Page, params.PageSize, params.SearchMap, params.ClientId)
 	if errCode != ecode.OK {
 		ctx.Fail(errCode)
 		return

--
Gitblit v1.8.0