caipin hace 4 años
padre
commit
88bb2e48fd
Se han modificado 3 ficheros con 7 adiciones y 15 borrados
  1. 4 10
      dao/contract_dao.go
  2. 2 4
      dao/contract_return_dao.go
  3. 1 1
      services/contract_service.go

+ 4 - 10
dao/contract_dao.go

@@ -360,28 +360,22 @@ func (d *ContractDao) Unlock(projectId int, bidsectionId int, treeId int, id int
 	// 1.解锁合同
 	contractsCm := models.CmContracts{}
 	contractsCm.Locking = 0
-	successNum, err := session.Where("id = ? and project_id = ? and bidsection_id = ? ", id, projectId, bidsectionId).Cols("locking").Update(contractsCm)
+	contractsCm.Status = 1
+	_, err = session.Where("id = ? and project_id = ? and bidsection_id = ? ", id, projectId, bidsectionId).Cols("locking,Status").Update(contractsCm)
 	if err != nil {
 		session.Rollback()
 		return errors.New("解锁合同出错")
 	}
-	if successNum == 0 {
-		session.Rollback()
-		return errors.New("解锁合同异常")
-	}
 
 	// 2.更新项目节上合同锁状态
 	treeContractsCm := models.CmTreeContracts{}
 	treeContractsCm.ContractLocking = 0
-	successNum, err = session.Where("tree_id = ? and project_id = ? and bidsection_id = ? ", treeId, projectId, bidsectionId).Cols("contract_locking").Update(treeContractsCm)
+	treeContractsCm.ContractStatus = 1
+	_, err = session.Where("tree_id = ? and project_id = ? and bidsection_id = ? ", treeId, projectId, bidsectionId).Cols("contract_locking,contract_status").Update(treeContractsCm)
 	if err != nil {
 		session.Rollback()
 		return errors.New("解锁合同出错-项目节")
 	}
-	if successNum == 0 {
-		session.Rollback()
-		return errors.New("解锁合同异常-项目节")
-	}
 
 	err = session.Commit()
 	if err != nil {

+ 2 - 4
dao/contract_return_dao.go

@@ -80,10 +80,8 @@ func (d *ContractReturnDao) Add(contractsReturn *models.CmContractsReturn) error
 // 更新回款
 func (d *ContractReturnDao) Update(contractsReturn *models.CmContractsReturn, contracts_id int, bidsectionId int) error {
 
-	is, err := d.engine.Where("id = ? and contracts_id = ? and bidsection_id=? ", contractsReturn.Id, contracts_id, bidsectionId).Update(contractsReturn)
-	if is == 0 {
-		return errors.New("未找到回款信息")
-	}
+	_, err := d.engine.Where("id = ? and contracts_id = ? and bidsection_id=? ", contractsReturn.Id, contracts_id, bidsectionId).Update(contractsReturn)
+
 	return err
 }
 

+ 1 - 1
services/contract_service.go

@@ -285,7 +285,7 @@ func (s *contractService) ValidRuleContractDel(ctx iris.Context) (*viewmodels.Co
 	// 创建一个存放前端传过来参数
 	contractsVaild := &viewmodels.Contracts{}
 	// 存放raw的值,放入到contractsVaild
-	err := ctx.ReadForm(contractsVaild)
+	err := ctx.ReadJSON(contractsVaild)
 	if err != nil {
 		log.Println("folder-ValidRule-ReadForm转换异常, error=", err)
 		return contractsVaild, err