fix
wangpengfei
2023-07-25 1109d0c6565e3413e54d9f28e68dda8ca26b99c4
service/serviceFeeManage.go
@@ -3,15 +3,29 @@
import (
   "aps_crm/model"
   "aps_crm/pkg/ecode"
   "aps_crm/pkg/mysqlx"
)
type FeeManageService struct{}
func (FeeManageService) AddServiceFeeManage(serviceFeeManage *model.ServiceFeeManage) int {
   err := model.NewServiceFeeManageSearch(nil).Create(serviceFeeManage)
   tx := mysqlx.GetDB().Begin()
   err := model.NewClientSearch(tx).Create(serviceFeeManage.Client)
   if err != nil {
      tx.Rollback()
      return ecode.ClientExist
   }
   serviceFeeManage.ClientId = serviceFeeManage.Client.Id
   err = model.NewServiceFeeManageSearch(tx).Create(serviceFeeManage)
   if err != nil {
      tx.Rollback()
      return ecode.ServiceFeeManageExist
   }
   tx.Commit()
   return ecode.OK
}
@@ -45,7 +59,7 @@
      return ecode.ServiceFeeManageNotExist
   }
   tx := model.NewContactSearch().Orm.Begin()
   tx := mysqlx.GetDB().Begin()
   err = model.NewServiceFeeManageSearch(tx).SetId(serviceFeeManage.Id).Update(serviceFeeManage)
   if err != nil {