From 530fed8ec225453572d57b15c200ab062c335457 Mon Sep 17 00:00:00 2001
From: zhangqian <zhangqian@123.com>
Date: 星期三, 01 十一月 2023 19:20:21 +0800
Subject: [PATCH] 公海member_id使用0

---
 service/serviceCollectionPlan.go |   11 ++++++-----
 1 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/service/serviceCollectionPlan.go b/service/serviceCollectionPlan.go
index fdaa235..81638c2 100644
--- a/service/serviceCollectionPlan.go
+++ b/service/serviceCollectionPlan.go
@@ -1,6 +1,7 @@
 package service
 
 import (
+	"aps_crm/constvar"
 	"aps_crm/model"
 	"aps_crm/model/request"
 	"aps_crm/pkg/ecode"
@@ -17,9 +18,9 @@
 	if len(serviceCollectionPlan) == 0 {
 		return ecode.ParamsErr
 	}
-	contractId := serviceCollectionPlan[0].ServiceContractId
+	sourceId := serviceCollectionPlan[0].SourceId
 	err := model.WithTransaction(func(db *gorm.DB) error {
-		err := model.NewServiceCollectionPlanSearch().SetOrm(db).SetServiceContractId(contractId).Delete()
+		err := model.NewServiceCollectionPlanSearch().SetOrm(db).SetSourceId(sourceId).Delete()
 		if err != nil {
 			return err
 		}
@@ -45,8 +46,8 @@
 	return ecode.OK
 }
 
-func (ServiceCollectionPlanService) GetServiceCollectionPlanList(contractId int) ([]*model.ServiceCollectionPlan, int64, int) {
-	list, total, err := model.NewServiceCollectionPlanSearch().SetServiceContractId(contractId).Find()
+func (ServiceCollectionPlanService) GetServiceCollectionPlanList(sourceType constvar.CollectionSourceType, sourceId int) ([]*model.ServiceCollectionPlan, int64, int) {
+	list, total, err := model.NewServiceCollectionPlanSearch().SetSourceType(sourceType).SetSourceId(sourceId).Find()
 	if err != nil {
 		return nil, 0, ecode.DBErr
 	}
@@ -72,7 +73,7 @@
 }
 
 func (ServiceCollectionPlanService) UpdateServiceCollectionPlan(serviceCollectionPlan *model.ServiceCollectionPlan) int {
-	err := model.NewServiceCollectionPlanSearch().SetId(serviceCollectionPlan.Id).Save(serviceCollectionPlan)
+	err := model.NewServiceCollectionPlanSearch().SetId(serviceCollectionPlan.Id).Update(serviceCollectionPlan)
 	if err != nil {
 		return ecode.DBErr
 	}

--
Gitblit v1.8.0