| | |
| | | return ecode.OK |
| | | } |
| | | |
| | | func (ClientService) DeleteClient(id int) int { |
| | | // check client exist |
| | | _, err := model.NewClientSearch(nil).SetId(id).First() |
| | | if err != nil { |
| | | return ecode.ClientNotExist |
| | | } |
| | | |
| | | // delete client |
| | | err = model.NewClientSearch(nil).SetId(id).Delete() |
| | | if err != nil { |
| | | return ecode.ClientDeleteErr |
| | | } |
| | | return ecode.OK |
| | | } |
| | | |
| | | // CheckClientExist check client exist |
| | | func CheckClientExist(id int) int { |
| | |
| | | |
| | | return ecode.OK |
| | | } |
| | | |
| | | func (ClientService) DeleteClient (ids []int) int { |
| | | // delete client |
| | | err := model.NewClientSearch(nil).SetIds(ids).Delete() |
| | | if err != nil { |
| | | return ecode.ClientDeleteErr |
| | | } |
| | | return ecode.OK |
| | | } |