| | |
| | | return ecode.OK |
| | | } |
| | | |
| | | func (ClientService) GetClientList() (int, []*model.Client) { |
| | | // get client list |
| | | clients, err := model.NewClientSearch(nil).Find() |
| | | if err != nil { |
| | | return ecode.ClientListErr, nil |
| | | } |
| | | |
| | | return ecode.OK, clients |
| | | } |
| | | |
| | | // CheckClientExist check client exist |
| | | func CheckClientExist(id int) int { |
| | | _, err := model.NewClientSearch(nil).SetId(id).First() |
| | |
| | | |
| | | return ecode.OK |
| | | } |
| | | |
| | | func (ClientService) GetClientList(page, pageSize int, keyword string) ([]*model.Client, int) { |
| | | // get contact list |
| | | contacts, err := model.NewClientSearch(nil).SetKeyword(keyword).SetPage(page, pageSize).Find() |
| | | if err != nil { |
| | | return nil, ecode.ClientListErr |
| | | } |
| | | return contacts, ecode.OK |
| | | } |