From 9c2489c0c360c8dda36d3cbe1dba79222096b2dd Mon Sep 17 00:00:00 2001 From: wangpengfei <274878379@qq.com> Date: 星期一, 07 八月 2023 10:16:39 +0800 Subject: [PATCH] Merge branch 'master' into fly --- service/serviceFollowup.go | 104 +++++++++++++++++++++++++++------------------------- 1 files changed, 54 insertions(+), 50 deletions(-) diff --git a/service/serviceFollowup.go b/service/serviceFollowup.go index 43f0a2c..bdcb710 100644 --- a/service/serviceFollowup.go +++ b/service/serviceFollowup.go @@ -1,50 +1,54 @@ -package service - -import ( - "aps_crm/model" - "aps_crm/pkg/ecode" -) - -type FollowupService struct{} - -func (FollowupService) AddServiceFollowup(serviceFollowup *model.ServiceFollowup) int { - err := model.NewServiceFollowupSearch().Create(serviceFollowup) - if err != nil { - return ecode.ServiceFollowupExist - } - - return ecode.OK -} - -func (FollowupService) UpdateServiceFollowup(serviceFollowup *model.ServiceFollowup) int { - // check serviceFollowup exist - _, err := model.NewServiceFollowupSearch().SetId(serviceFollowup.Id).Find() - if err != nil { - return ecode.ServiceFollowupNotExist - } - - err = model.NewServiceFollowupSearch().SetId(serviceFollowup.Id).Update(serviceFollowup) - if err != nil { - return ecode.ServiceFollowupSetErr - } - - return ecode.OK -} - -func (FollowupService) GetServiceFollowupList(page, pageSize int, keyword string) ([]*model.ServiceFollowup, int64, int) { - // get contact list - contacts, total, err := model.NewServiceFollowupSearch().SetKeyword(keyword).SetPage(page, pageSize).FindAll() - if err != nil { - return nil, 0, ecode.ServiceFollowupListErr - } - return contacts, total, 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 -} +package service + +import ( + "aps_crm/constvar" + "aps_crm/model" + "aps_crm/pkg/ecode" +) + +type FollowupService struct{} + +func (FollowupService) AddServiceFollowup(serviceFollowup *model.ServiceFollowup) int { + err := model.NewServiceFollowupSearch().Create(serviceFollowup) + if err != nil { + return ecode.ServiceFollowupExist + } + + return ecode.OK +} + +func (FollowupService) UpdateServiceFollowup(serviceFollowup *model.ServiceFollowup) int { + // check serviceFollowup exist + _, err := model.NewServiceFollowupSearch().SetId(serviceFollowup.Id).Find() + if err != nil { + return ecode.ServiceFollowupNotExist + } + + err = model.NewServiceFollowupSearch().SetId(serviceFollowup.Id).Update(serviceFollowup) + if err != nil { + return ecode.ServiceFollowupSetErr + } + + 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) ([]*model.ServiceFollowup, int64, int) { + // get contact list + contacts, total, err := model.NewServiceFollowupSearch(). + SetKeywordType(keywordType). + SetKeyword(keyword). + SetPage(page, pageSize).FindAll() + if err != nil { + return nil, 0, ecode.ServiceFollowupListErr + } + return contacts, total, ecode.OK +} -- Gitblit v1.8.0