| | |
| | | return ecode.OK |
| | | } |
| | | |
| | | |
| | | func (ContactService) UpdateContact(contact *model.Contact) int { |
| | | // check contact exist |
| | | _, err := model.NewContactSearch(nil).SetId(contact.Id).First() |
| | |
| | | return ecode.OK |
| | | } |
| | | |
| | | func (ContactService) GetContactList(page, pageSize int, keyword string) ([]*model.ContactDetail, int) { |
| | | func (ContactService) GetContactList(page, pageSize int, keyword string) ([]*model.ContactDetail, int64, int) { |
| | | // get contact list |
| | | contacts, err := model.NewContactSearch(nil).SetKeyword(keyword).SetPage(page, pageSize).FindAll() |
| | | contacts, total, err := model.NewContactSearch(nil).SetKeyword(keyword).SetPage(page, pageSize).FindAll() |
| | | if err != nil { |
| | | return nil, ecode.ContactListErr |
| | | return nil, 0, ecode.ContactListErr |
| | | } |
| | | return contacts, ecode.OK |
| | | return contacts, total, ecode.OK |
| | | } |