| | |
| | | return ecode.OK |
| | | } |
| | | |
| | | |
| | | func (ContactService) UpdateContact(contact *model.Contact) int { |
| | | // check contact exist |
| | | _, err := model.NewContactSearch(nil).SetId(contact.Id).First() |
| | |
| | | return contacts, total, ecode.OK |
| | | } |
| | | |
| | | func (ContactService) DeleteContact (ids []int) int { |
| | | func (ContactService) DeleteContact(ids []int) int { |
| | | // delete client |
| | | err := model.NewContactSearch(nil).SetIds(ids).Delete() |
| | | if err != nil { |
| | | return ecode.ContactDeleteErr |
| | | } |
| | | return ecode.OK |
| | | } |
| | | } |
| | | |
| | | func (ContactService) Assign(ids []int, memberId int) int { |
| | | // check contact exist |
| | | //errCode := CheckContactExist(id) |
| | | //if errCode != ecode.OK { |
| | | // return errCode |
| | | //} |
| | | |
| | | // assign contact |
| | | err := model.NewContactSearch(nil).SetIds(ids).UpdateByMap(map[string]interface{}{ |
| | | "member_id": memberId, |
| | | }) |
| | | if err != nil { |
| | | return ecode.ContactAssignErr |
| | | } |
| | | |
| | | return ecode.OK |
| | | } |