| | |
| | | return ecode.OK |
| | | } |
| | | |
| | | func (ContractService) DeleteContract(id int) int { |
| | | _, err := model.NewContractSearch().SetId(id).Find() |
| | | if err != nil { |
| | | return ecode.ContractNotExist |
| | | } |
| | | |
| | | err = model.NewContractSearch().SetId(id).Delete() |
| | | if err != nil { |
| | | return ecode.ContractNotExist |
| | | } |
| | | return ecode.OK |
| | | } |
| | | |
| | | func (ContractService) UpdateContract(contract *model.Contract) int { |
| | | // check contract exist |
| | | _, err := model.NewContractSearch().SetId(contract.Id).Find() |
| | |
| | | } |
| | | return contacts, total, ecode.OK |
| | | } |
| | | |
| | | func (ContractService) DeleteContract(ids []int) int { |
| | | // delete client |
| | | err := model.NewContractSearch().SetIds(ids).Delete() |
| | | if err != nil { |
| | | return ecode.ContractDeleteErr |
| | | } |
| | | return ecode.OK |
| | | } |