| | |
| | | ctx.Ok() |
| | | } |
| | | |
| | | // List |
| | | // |
| | | // @Tags Contract |
| | | // @Summary 获取合同列表 |
| | | // @Produce application/json |
| | | // @Success 200 {object} contextx.Response{data=response.ContractResponse} |
| | | // @Router /api/contract/list [get] |
| | | func (s *ContractApi) List(c *gin.Context) { |
| | | ctx, ok := contextx.NewContext(c, nil) |
| | | if !ok { |
| | | return |
| | | } |
| | | |
| | | contractList, errCode := contractService.GetContractList() |
| | | if errCode != ecode.OK { |
| | | ctx.Fail(errCode) |
| | | return |
| | | } |
| | | |
| | | ctx.OkWithDetailed(response.ContractResponse{ |
| | | List: contractList, |
| | | }) |
| | | } |
| | | |
| | | func checkContractParams(contract request.Contract) (errCode int, contractModel model.Contract) { |
| | | //if contract.Number == "" { |
| | |
| | | |
| | | return ecode.OK, contractModel |
| | | } |
| | | |
| | | // List |
| | | // |
| | | // @Tags Contract |
| | | // @Summary 销售合同列表 |
| | | // @Produce application/json |
| | | // @Param object body request.GetContractList true "参数" |
| | | // @Success 200 {object} contextx.Response{data=response.ContractResponse} |
| | | // @Router /api/contract/list [post] |
| | | func (con *ContractApi) List(c *gin.Context) { |
| | | var params request.GetContractList |
| | | ctx, ok := contextx.NewContext(c, ¶ms) |
| | | if !ok { |
| | | return |
| | | } |
| | | |
| | | contracts, errCode := contractService.GetContractList(params.Page, params.PageSize, params.Keyword) |
| | | if errCode != ecode.OK { |
| | | ctx.Fail(errCode) |
| | | return |
| | | } |
| | | |
| | | ctx.OkWithDetailed(response.ContractResponse{ |
| | | List: contracts, |
| | | Count: len(contracts), |
| | | }) |
| | | } |