From 9a7e0a7da01a9f9625ceaca0c61a59c540c6438f Mon Sep 17 00:00:00 2001 From: wangpengfei <274878379@qq.com> Date: 星期五, 18 八月 2023 17:32:10 +0800 Subject: [PATCH] fix --- api/v1/contract.go | 18 ++++++++---------- 1 files changed, 8 insertions(+), 10 deletions(-) diff --git a/api/v1/contract.go b/api/v1/contract.go index e93ece3..ff42186 100644 --- a/api/v1/contract.go +++ b/api/v1/contract.go @@ -7,7 +7,6 @@ "aps_crm/pkg/contextx" "aps_crm/pkg/ecode" "github.com/gin-gonic/gin" - "strconv" ) type ContractApi struct{} @@ -47,17 +46,17 @@ // @Tags Contract // @Summary 鍒犻櫎鍚堝悓 // @Produce application/json -// @Param id path int true "鏌ヨ鍙傛暟" +// @Param object body request.DeleteContract true "鏌ヨ鍙傛暟" // @Success 200 {object} contextx.Response{} -// @Router /api/contract/delete/{id} [delete] +// @Router /api/contract/delete [delete] func (s *ContractApi) Delete(c *gin.Context) { - ctx, ok := contextx.NewContext(c, nil) + var params request.DeleteContract + ctx, ok := contextx.NewContext(c, ¶ms) if !ok { return } - id, _ := strconv.Atoi(c.Param("id")) - errCode := contractService.DeleteContract(id) + errCode := contractService.DeleteContract(params.Ids) if errCode != ecode.OK { ctx.Fail(errCode) return @@ -98,7 +97,6 @@ ctx.Ok() } - func checkContractParams(contract request.Contract) (errCode int, contractModel model.Contract) { //if contract.Number == "" { // return ecode.InvalidParams, contractModel @@ -135,14 +133,14 @@ return } - contracts, errCode := contractService.GetContractList(params.Page, params.PageSize, params.Keyword) + contracts, total, errCode := contractService.GetContractList(params.Page, params.PageSize, params.SearchMap) if errCode != ecode.OK { ctx.Fail(errCode) return } ctx.OkWithDetailed(response.ContractResponse{ - List: contracts, - Count: len(contracts), + List: contracts, + Count: int(total), }) } -- Gitblit v1.8.0