ziwen 2 years ago
parent
commit
ea62322575
2 changed files with 10 additions and 3 deletions
  1. 9 2
      controller/contract/pre_register.go
  2. 1 1
      models/fms/contract_register.go

+ 9 - 2
controller/contract/pre_register.go

@@ -213,14 +213,21 @@ func (rg *PreRegisterController) Add(c *gin.Context) {
 		resp.FailMsg("操作失败", "获取合同套餐详情失败, Err: "+e.Error(), c)
 		return
 	}
-	if e = fms.CreateContractRegisterAndServicesAndPayMent(ob, serviceList); e != nil {
-		resp.FailMsg("操作失败", "新增合同及套餐失败, Err: "+e.Error(), c)
+
+	if e = ob.Create(); e != nil {
+		resp.FailMsg("操作失败", "新增合同失败, Err: "+e.Error(), c)
 		return
 	}
 	if ob.ContractRegisterId == 0{
 		resp.FailMsg("操作失败", "新增合同失败,合同ID为0", c)
 		return
 	}
+
+	if e = fms.CreateContractRegisterAndServicesAndPayMent(ob, serviceList); e != nil {
+		resp.FailMsg("操作失败", "新增合同及套餐失败, Err: "+e.Error(), c)
+		return
+	}
+
 	for _, r := range req.List {
 		// 货币及汇率
 		rateList, e := fmsService.GetTodayCurrencyRateList()

+ 1 - 1
models/fms/contract_register.go

@@ -514,7 +514,7 @@ func CreateContractRegisterAndServicesAndPayMent(item *ContractRegister, service
 	}()
 
 	// 合同登记
-	tx.Create(item)
+	//tx.Create(item)
 
 	//nowTime := time.Now().Local()
 	for i := 0; i < len(serviceDetail); i++ {