| | |
| | | ctx.Ok() |
| | | } |
| | | |
| | | // List |
| | | // |
| | | // @Tags ServiceContract |
| | | // @Summary 服务合同列表 |
| | | // @Produce application/json |
| | | // @Success 200 {object} contextx.Response{data=response.ServiceContractsResponse} |
| | | // @Router /api/serviceContract/list [get] |
| | | func (s *ServiceContractApi) List(c *gin.Context) { |
| | | ctx, ok := contextx.NewContext(c, nil) |
| | | if !ok { |
| | | return |
| | | } |
| | | |
| | | serviceContracts, errCode := serviceContractService.GetServiceContractList() |
| | | if errCode != ecode.OK { |
| | | ctx.Fail(errCode) |
| | | return |
| | | } |
| | | |
| | | ctx.OkWithDetailed(response.ServiceContractsResponse{ |
| | | List: serviceContracts, |
| | | }) |
| | | } |
| | | |
| | | // check params |
| | | func checkServiceContractParams(serviceContract request.ServiceContract) (errCode int, result model.ServiceContract) { |
| | | //if serviceContract.SignTime == "" { |
| | |
| | | |
| | | return ecode.OK, result |
| | | } |
| | | |
| | | // List |
| | | // |
| | | // @Tags ServiceContract |
| | | // @Summary 生成计划列表 |
| | | // @Produce application/json |
| | | // @Param object body request.GetServiceContractList true "参数" |
| | | // @Success 200 {object} contextx.Response{data=response.ServiceContractsResponse} |
| | | // @Router /api/serviceContract/list [post] |
| | | func (con *ServiceContractApi) List(c *gin.Context) { |
| | | var params request.GetServiceContractList |
| | | ctx, ok := contextx.NewContext(c, ¶ms) |
| | | if !ok { |
| | | return |
| | | } |
| | | |
| | | serviceContracts, errCode := serviceContractService.GetServiceContractList(params.Page, params.PageSize, params.Keyword) |
| | | if errCode != ecode.OK { |
| | | ctx.Fail(errCode) |
| | | return |
| | | } |
| | | |
| | | ctx.OkWithDetailed(response.ServiceContractsResponse{ |
| | | List: serviceContracts, |
| | | Count: len(serviceContracts), |
| | | }) |
| | | } |