| | |
| | | "aps_crm/model/response" |
| | | "aps_crm/pkg/contextx" |
| | | "aps_crm/pkg/ecode" |
| | | "aps_crm/service" |
| | | "github.com/gin-gonic/gin" |
| | | "strconv" |
| | | "time" |
| | |
| | | func checkFollowRecordParams(followRecord request.FollowRecord) (int, *model.FollowRecord) { |
| | | var followRecordModel model.FollowRecord |
| | | |
| | | if followRecord.ClientId != 0 { |
| | | // check client exist |
| | | if service.CheckClientExist(followRecord.ClientId) != ecode.OK { |
| | | return ecode.ClientNotExist, &followRecordModel |
| | | } |
| | | } |
| | | |
| | | if followRecord.ContactId != 0 { |
| | | // check contact exist |
| | | if service.CheckContactExist(followRecord.ContactId) != ecode.OK { |
| | | return ecode.ContactNotExist, &followRecordModel |
| | | } |
| | | } |
| | | |
| | | if followRecord.SalesLeadsId != 0 { |
| | | // check sales leads exist |
| | | if service.CheckSalesLeadsExist(followRecord.SalesLeadsId) != ecode.OK { |
| | | return ecode.SalesLeadsNotExist, &followRecordModel |
| | | } |
| | | } |
| | | |
| | | // check member id |
| | | if followRecord.MemberId == 0 { |
| | | // todo check member exist |
| | | return ecode.InvalidParams, &followRecordModel |
| | | } |
| | | |
| | | // check number |
| | | if followRecord.Number == "" { |
| | | return ecode.InvalidParams, &followRecordModel |
| | | } |
| | | |
| | | // check follow content |
| | | if followRecord.Content == "" { |
| | | return ecode.InvalidParams, &followRecordModel |
| | | } |
| | | //if followRecord.ClientId != 0 { |
| | | // // check client exist |
| | | // if service.CheckClientExist(followRecord.ClientId) != ecode.OK { |
| | | // return ecode.ClientNotExist, &followRecordModel |
| | | // } |
| | | //} |
| | | // |
| | | //if followRecord.ContactId != 0 { |
| | | // // check contact exist |
| | | // if service.CheckContactExist(followRecord.ContactId) != ecode.OK { |
| | | // return ecode.ContactNotExist, &followRecordModel |
| | | // } |
| | | //} |
| | | // |
| | | //if followRecord.SalesLeadsId != 0 { |
| | | // // check sales leads exist |
| | | // if service.CheckSalesLeadsExist(followRecord.SalesLeadsId) != ecode.OK { |
| | | // return ecode.SalesLeadsNotExist, &followRecordModel |
| | | // } |
| | | //} |
| | | // |
| | | //// check member id |
| | | //if followRecord.MemberId == 0 { |
| | | // // todo check member exist |
| | | // return ecode.InvalidParams, &followRecordModel |
| | | //} |
| | | // |
| | | //// check number |
| | | //if followRecord.Number == "" { |
| | | // return ecode.InvalidParams, &followRecordModel |
| | | //} |
| | | // |
| | | //// check follow content |
| | | //if followRecord.Content == "" { |
| | | // return ecode.InvalidParams, &followRecordModel |
| | | //} |
| | | |
| | | // check follow time |
| | | t, err := checkTimeFormat(followRecord.FollowTime) |