wangpengfei
2023-08-14 f84d9c46574a2cd663105859035bc17891270923
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
}