From 163257e81abbf954ba140ce22098fa78a66aa682 Mon Sep 17 00:00:00 2001 From: wangpengfei <274878379@qq.com> Date: 星期二, 25 七月 2023 19:47:59 +0800 Subject: [PATCH] add --- api/v1/client.go | 49 +++++++++++++++++++++++++++---------------------- 1 files changed, 27 insertions(+), 22 deletions(-) diff --git a/api/v1/client.go b/api/v1/client.go index 96aa141..b691940 100644 --- a/api/v1/client.go +++ b/api/v1/client.go @@ -44,28 +44,6 @@ ctx.Ok() } -// List -// -// @Tags Client -// @Summary 鑾峰彇瀹㈡埛鍒楄〃 -// @Produce application/json -// @Success 200 {object} contextx.Response{data=response.ClientResponse} -// @Router /api/client/list [get] -func (cli *ClientApi) List(c *gin.Context) { - ctx, ok := contextx.NewContext(c, nil) - if !ok { - return - } - - errCode, clients := clientService.GetClientList() - if errCode != ecode.OK { - ctx.Fail(errCode) - return - } - - ctx.OkWithDetailed(response.ClientResponse{List: clients}) -} - func checkClientParams(params request.Client) (int, *model.Client) { client := new(model.Client) //if params.Name == "" { @@ -198,3 +176,30 @@ ctx.Ok() } + +// List +// +// @Tags Client +// @Summary 瀹㈡埛鍒楄〃 +// @Produce application/json +// @Param object body request.GetClientList true "鍙傛暟" +// @Success 200 {object} contextx.Response{data=response.ClientResponse} +// @Router /api/client/list [post] +func (cli *ClientApi) List(c *gin.Context) { + var params request.GetClientList + ctx, ok := contextx.NewContext(c, ¶ms) + if !ok { + return + } + + clients, errCode := clientService.GetClientList(params.Page, params.PageSize, params.Keyword) + if errCode != ecode.OK { + ctx.Fail(errCode) + return + } + + ctx.OkWithDetailed(response.ClientResponse{ + List: clients, + Count: len(clients), + }) +} -- Gitblit v1.8.0