From 34ef7217a034599217a7fdd1e28e1ae6910e1b4b Mon Sep 17 00:00:00 2001
From: liujiandao <274878379@qq.com>
Date: 星期三, 11 十月 2023 20:15:21 +0800
Subject: [PATCH] 菜单获取编码规则
---
service/saleChance.go | 54 +++++++++++++++++++++++++++++++++++-------------------
1 files changed, 35 insertions(+), 19 deletions(-)
diff --git a/service/saleChance.go b/service/saleChance.go
index 03b01c3..1610c07 100644
--- a/service/saleChance.go
+++ b/service/saleChance.go
@@ -15,21 +15,6 @@
return ecode.OK
}
-func (SaleChanceService) DeleteSaleChance(id int) int {
- // check saleChange exist
- _, err := model.NewSaleChanceSearch().SetId(id).Find()
- if err != nil {
- return ecode.SaleChanceNotExist
- }
-
- // delete saleChange
- err = model.NewSaleChanceSearch().SetId(id).Delete()
- if err != nil {
- return ecode.SaleChanceDeleteErr
- }
- return ecode.OK
-}
-
func (SaleChanceService) UpdateSaleChance(saleChange *model.SaleChance) int {
// update saleChange
err := model.NewSaleChanceSearch().SetId(saleChange.Id).Update(saleChange)
@@ -54,11 +39,42 @@
return ecode.OK
}
-func (SaleChanceService) GetSaleChanceList(page, pageSize int, keyword string) ([]*model.SaleChance, int) {
+func (SaleChanceService) GetSaleChanceList(page, pageSize int, data map[string]interface{}) ([]*model.SaleChance, int64, int) {
// get contact list
- contacts, 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, ecode.SaleChanceListErr
+ return nil, 0, ecode.SaleChanceListErr
}
- return contacts, ecode.OK
+ 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
+}
+
+func (SaleChanceService) DeleteSaleChance(ids []int) int {
+ // delete client
+ err := model.NewSaleChanceSearch().SetIds(ids).Delete()
+ if err != nil {
+ return ecode.SaleChanceDeleteErr
+ }
+ return ecode.OK
}
--
Gitblit v1.8.0