From f84d9c46574a2cd663105859035bc17891270923 Mon Sep 17 00:00:00 2001
From: wangpengfei <274878379@qq.com>
Date: 星期一, 14 八月 2023 10:41:54 +0800
Subject: [PATCH] Merge branch 'master' into fly

---
 service/saleChance.go |   26 ++++++++++++++++++++++++--
 1 files changed, 24 insertions(+), 2 deletions(-)

diff --git a/service/saleChance.go b/service/saleChance.go
index 4c42d23..2c62a4f 100644
--- a/service/saleChance.go
+++ b/service/saleChance.go
@@ -54,11 +54,33 @@
 	return ecode.OK
 }
 
-func (SaleChanceService) GetSaleChanceList(page, pageSize int, keyword string) ([]*model.SaleChance, int64, int) {
+func (SaleChanceService) GetSaleChanceList(page, pageSize int, data map[string]interface{}) ([]*model.SaleChance, int64, int) {
 	// get contact list
-	contacts, total, err := model.NewSaleChanceSearch().SetKeyword(keyword).SetPage(page, pageSize).FindAll()
+	contacts, total, err := model.NewSaleChanceSearch().SetPage(page, pageSize).SetSearchMap(data).FindAll()
 	if err != nil {
 		return nil, 0, ecode.SaleChanceListErr
 	}
 	return contacts, total, ecode.OK
 }
+
+// push
+func (SaleChanceService) PushSaleChance(id, step int) int {
+	// check saleChange exist
+	errCode := CheckSaleChangeExist(id)
+	if errCode != ecode.OK {
+		return errCode
+	}
+	// check step
+	_, err := model.NewSaleStageSearch().SetId(step).Find()
+	if err != nil {
+		return ecode.SaleStageNotExist
+	}
+
+	// push saleChange
+	err = model.NewSaleChanceSearch().SetId(id).Update(&model.SaleChance{SaleStageId: step})
+	if err != nil {
+		return ecode.SaleChanceUpdateErr
+	}
+
+	return ecode.OK
+}

--
Gitblit v1.8.0