|  | @@ -40,7 +40,7 @@ type ContractService interface {
 | 
	
		
			
				|  |  |  	MoveDepth(sectionData *viewmodels.TreeSectionContract) error
 | 
	
		
			
				|  |  |  	MoveSerial(sectionData *viewmodels.TreeSectionContract) error
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -	SaveUpload(Location string, Filename string, id int, ext string) error
 | 
	
		
			
				|  |  | +	SaveUpload(Location string, Filename string, ext string) (int, error)
 | 
	
		
			
				|  |  |  }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  //返回service操作类
 | 
	
	
		
			
				|  | @@ -51,6 +51,7 @@ type contractService struct {
 | 
	
		
			
				|  |  |  	contractPaidDao   *dao.ContractPaidDao
 | 
	
		
			
				|  |  |  	treeDao           *dao.TreeDao
 | 
	
		
			
				|  |  |  	annexDao          *dao.AnnexDao
 | 
	
		
			
				|  |  | +	uploadDao         *dao.UploadDao
 | 
	
		
			
				|  |  |  }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  //创建项目用户service
 | 
	
	
		
			
				|  | @@ -62,6 +63,7 @@ func NewContractService() ContractService {
 | 
	
		
			
				|  |  |  		contractPaidDao:   dao.NewContractPaidDao(datasource.InstanceDbMaster()),
 | 
	
		
			
				|  |  |  		treeDao:           dao.NewTreeDao(datasource.InstanceDbMaster()),
 | 
	
		
			
				|  |  |  		annexDao:          dao.NewAnnexDao(datasource.InstanceDbMaster()),
 | 
	
		
			
				|  |  | +		uploadDao:         dao.NewUploadDao(datasource.InstanceDbMaster()),
 | 
	
		
			
				|  |  |  	}
 | 
	
		
			
				|  |  |  }
 | 
	
		
			
				|  |  |  
 | 
	
	
		
			
				|  | @@ -247,14 +249,18 @@ func (s *contractService) Add(contractData *viewmodels.Contracts, treeId int) er
 | 
	
		
			
				|  |  |  }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  // 保存上传文件
 | 
	
		
			
				|  |  | -func (s *contractService) SaveUpload(Location string, Filename string, id int, ext string) error {
 | 
	
		
			
				|  |  | +func (s *contractService) SaveUpload(Location string, Filename string, ext string) (int, error) {
 | 
	
		
			
				|  |  |  	// 文件保存
 | 
	
		
			
				|  |  | +	uploadCm := &models.CmUpload{}
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -	// 绑定项目节
 | 
	
		
			
				|  |  | -	contractsCm := &models.CmTreeContracts{}
 | 
	
		
			
				|  |  | -	contractsCm.Id = id
 | 
	
		
			
				|  |  | -	// contractsCm.ContractId=
 | 
	
		
			
				|  |  | -	contractsCm.ContractName = ext
 | 
	
		
			
				|  |  | -	s.treeContractDao.Save(contractsCm, []string{"contract_id", "contract_name"})
 | 
	
		
			
				|  |  | -	return nil
 | 
	
		
			
				|  |  | +	uploadCm.Name = Filename
 | 
	
		
			
				|  |  | +	uploadCm.Path = Location
 | 
	
		
			
				|  |  | +	uploadCm.Ext = ext
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +	_, err := s.uploadDao.Add(uploadCm)
 | 
	
		
			
				|  |  | +	if err != nil {
 | 
	
		
			
				|  |  | +		return 0, err
 | 
	
		
			
				|  |  | +	}
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +	return uploadCm.Id, nil
 | 
	
		
			
				|  |  |  }
 |