| | |
| | | return ecode.OK |
| | | } |
| | | |
| | | func (ContactService) DeleteContact(id int) int { |
| | | // check contact exist |
| | | _, err := model.NewContactSearch(nil).SetId(id).First() |
| | | if err != nil { |
| | | return ecode.ContactNotExist |
| | | } |
| | | |
| | | // delete contact |
| | | err = model.NewContactSearch(nil).SetId(id).Delete() |
| | | if err != nil { |
| | | return ecode.ContactDeleteErr |
| | | } |
| | | return ecode.OK |
| | | } |
| | | |
| | | func (ContactService) UpdateContact(contact *model.Contact) int { |
| | | // check contact exist |
| | |
| | | } |
| | | return contacts, total, ecode.OK |
| | | } |
| | | |
| | | func (ContactService) DeleteContact (ids []int) int { |
| | | // delete client |
| | | err := model.NewContactSearch(nil).SetIds(ids).Delete() |
| | | if err != nil { |
| | | return ecode.ContactDeleteErr |
| | | } |
| | | return ecode.OK |
| | | } |