From 115bd9b51f5d8eade4658f844de37516486c60e7 Mon Sep 17 00:00:00 2001
From: liujiandao <274878379@qq.com>
Date: 星期六, 18 十一月 2023 17:25:25 +0800
Subject: [PATCH] crm获取aps项目模块信息

---
 service/serviceFollowup.go |   48 ++++++++++++++++++++++++++----------------------
 1 files changed, 26 insertions(+), 22 deletions(-)

diff --git a/service/serviceFollowup.go b/service/serviceFollowup.go
index 83ea5f5..fede335 100644
--- a/service/serviceFollowup.go
+++ b/service/serviceFollowup.go
@@ -1,6 +1,7 @@
 package service
 
 import (
+	"aps_crm/constvar"
 	"aps_crm/model"
 	"aps_crm/pkg/ecode"
 )
@@ -16,28 +17,6 @@
 	return ecode.OK
 }
 
-func (FollowupService) DeleteServiceFollowup(id int) int {
-	_, err := model.NewServiceFollowupSearch().SetId(id).Find()
-	if err != nil {
-		return ecode.ServiceFollowupNotExist
-	}
-
-	err = model.NewServiceFollowupSearch().SetId(id).Delete()
-	if err != nil {
-		return ecode.ServiceFollowupNotExist
-	}
-	return ecode.OK
-}
-
-func (FollowupService) GetServiceFollowupList() ([]*model.ServiceFollowup, int) {
-	list, err := model.NewServiceFollowupSearch().FindAll()
-	if err != nil {
-		return nil, ecode.ServiceFollowupListErr
-	}
-
-	return list, ecode.OK
-}
-
 func (FollowupService) UpdateServiceFollowup(serviceFollowup *model.ServiceFollowup) int {
 	// check serviceFollowup exist
 	_, err := model.NewServiceFollowupSearch().SetId(serviceFollowup.Id).Find()
@@ -52,3 +31,28 @@
 
 	return ecode.OK
 }
+
+func (FollowupService) DeleteServiceFollowup(ids []int) int {
+	// delete client
+	err := model.NewServiceFollowupSearch().SetIds(ids).Delete()
+	if err != nil {
+		return ecode.ServiceFollowupDeleteErr
+	}
+	return ecode.OK
+}
+
+func (FollowupService) GetServiceFollowupList(page, pageSize int, keywordType constvar.ServiceFollowupKeywordType, keyword string, serviceOrderId int, memberIds []int) ([]*model.ServiceFollowup, int64, int) {
+	// get contact list
+	contacts, total, err := model.NewServiceFollowupSearch().
+		SetKeywordType(keywordType).
+		SetKeyword(keyword).
+		SetPage(page, pageSize).
+		SetPreload(true).
+		SetServiceOrderId(serviceOrderId).
+		SetMemberIds(memberIds).
+		FindAll()
+	if err != nil {
+		return nil, 0, ecode.ServiceFollowupListErr
+	}
+	return contacts, total, ecode.OK
+}

--
Gitblit v1.8.0