From 2030ec81f18f4ec9ea1800f13046acafff6d50f7 Mon Sep 17 00:00:00 2001 From: yinbentan <yinbentan@live.com> Date: 星期四, 26 九月 2024 00:48:59 +0800 Subject: [PATCH] 添加grpc方法:客户信息维护 --- api/v1/plan.go | 53 +++++++++++++++++++++++++++++------------------------ 1 files changed, 29 insertions(+), 24 deletions(-) diff --git a/api/v1/plan.go b/api/v1/plan.go index 7078033..2b59b8a 100644 --- a/api/v1/plan.go +++ b/api/v1/plan.go @@ -87,6 +87,8 @@ return } + plan.Id = params.Id + errCode = planService.UpdatePlan(&plan) if errCode != ecode.OK { ctx.Fail(errCode) @@ -94,30 +96,6 @@ } ctx.Ok() -} - -// List -// -// @Tags Plan -// @Summary 鑾峰彇璁″垝鍒楄〃 -// @Produce application/json -// @Success 200 {object} contextx.Response{data=response.PlanResponse} -// @Router /api/plan/list [get] -func (s *PlanApi) List(c *gin.Context) { - ctx, ok := contextx.NewContext(c, nil) - if !ok { - return - } - - list, errCode := planService.GetPlanList() - if errCode != ecode.OK { - ctx.Fail(errCode) - return - } - - ctx.OkWithDetailed(response.PlanResponse{ - List: list, - }) } func checkPlanParams(plan request.Plan) (errCode int, p model.Plan) { @@ -153,3 +131,30 @@ return ecode.OK, p } + +// List +// +// @Tags Plan +// @Summary 鐢熸垚璁″垝鍒楄〃 +// @Produce application/json +// @Param object body request.GetPlanList true "鍙傛暟" +// @Success 200 {object} contextx.Response{data=response.PlanResponse} +// @Router /api/plan/list [post] +func (con *PlanApi) List(c *gin.Context) { + var params request.GetPlanList + ctx, ok := contextx.NewContext(c, ¶ms) + if !ok { + return + } + + plans, total, errCode := planService.GetPlanList(params.Page, params.PageSize, params.Keyword) + if errCode != ecode.OK { + ctx.Fail(errCode) + return + } + + ctx.OkWithDetailed(response.PlanResponse{ + List: plans, + Count: int(total), + }) +} -- Gitblit v1.8.0