| | |
| | | package v1 |
| | | |
| | | import ( |
| | | "aps_crm/constvar" |
| | | "aps_crm/model" |
| | | "aps_crm/model/request" |
| | | "aps_crm/model/response" |
| | | "aps_crm/pkg/contextx" |
| | | "aps_crm/pkg/ecode" |
| | | "aps_crm/pkg/structx" |
| | | "aps_crm/utils" |
| | | "github.com/gin-gonic/gin" |
| | | ) |
| | | |
| | |
| | | ctx.Ok() |
| | | } |
| | | |
| | | // check params |
| | | func checkServiceContractParams(serviceContract request.ServiceContract) (errCode int, result model.ServiceContract) { |
| | | result.Number = serviceContract.Number |
| | | result.MemberId = serviceContract.MemberId |
| | | result.Remark = serviceContract.Remark |
| | | result.ClientId = serviceContract.ClientId |
| | | result.SalesDetailsId = serviceContract.SalesDetailsId |
| | | result.SaleChanceId = serviceContract.SaleChanceId |
| | | result.QuotationId = serviceContract.QuotationId |
| | | result.ServiceContractTypeId = serviceContract.TypeId |
| | | result.ServiceContractStatusId = serviceContract.StatusId |
| | | result.ServiceTimes = serviceContract.ServiceTimes |
| | | result.Terms = serviceContract.Terms |
| | | result.Products = serviceContract.Products |
| | | result.SignTime = serviceContract.SignTime |
| | | result.StartTime = serviceContract.StartTime |
| | | result.EndTime = serviceContract.EndTime |
| | | |
| | | return ecode.OK, result |
| | | } |
| | | |
| | | // List |
| | | // |
| | | // @Tags ServiceContract |
| | |
| | | return |
| | | } |
| | | |
| | | serviceContracts, total, errCode := serviceContractService.GetServiceContractList(params.Page, params.PageSize, params.QueryClass, params.KeywordType, params.Keyword) |
| | | var memberIds []int |
| | | userInfo := utils.GetUserInfo(c) |
| | | if userInfo.UserType == constvar.UserTypeSub { |
| | | memberIds = []int{userInfo.CrmUserId} |
| | | } |
| | | |
| | | serviceContracts, total, errCode := serviceContractService.GetServiceContractList(params.Page, params.PageSize, params.QueryClass, params.KeywordType, params.Keyword, memberIds) |
| | | if errCode != ecode.OK { |
| | | ctx.Fail(errCode) |
| | | return |