From 06c0b03df2955475fe39ff2a793a5f151f4da99f Mon Sep 17 00:00:00 2001 From: wangpengfei <274878379@qq.com> Date: 星期四, 17 八月 2023 19:25:30 +0800 Subject: [PATCH] Merge branch 'master' into fly --- api/v1/client.go | 42 +++++++++++++++++++++++++++++++++--------- 1 files changed, 33 insertions(+), 9 deletions(-) diff --git a/api/v1/client.go b/api/v1/client.go index 1162b78..b354d14 100644 --- a/api/v1/client.go +++ b/api/v1/client.go @@ -99,16 +99,16 @@ client.Business.EnterpriseScaleId = params.EnterpriseScaleId client.MemberId = params.MemberId - if params.Contact.Name != "" { - // assign the client's member id to contact when adding - params.Contact.MemberId = params.MemberId + //if params.Contact.Name != "" { + // assign the client's member id to contact when adding + params.Contact.MemberId = params.MemberId - errCode, contact := checkContactParams(params.Contact) - if errCode != ecode.OK { - return errCode, nil - } - client.Contacts = []model.Contact{contact} + errCode, contact := checkContactParams(params.Contact) + if errCode != ecode.OK { + return errCode, nil } + client.Contacts = []model.Contact{contact} + //} return ecode.OK, client } @@ -166,7 +166,7 @@ client.Id = params.Id - errCode = clientService.UpdateClient(client) + errCode = clientService.UpdateClient(client, params.ContactId) if errCode != ecode.OK { ctx.Fail(errCode) return @@ -201,3 +201,27 @@ Count: int(total), }) } + +// CheckName +// +// @Tags Client +// @Summary 妫�鏌ュ鎴峰悕绉版槸鍚﹂噸澶� +// @Produce application/json +// @Param object body request.CheckClientName true "鍙傛暟" +// @Success 200 {object} contextx.Response{} +// @Router /api/client/checkName [post] +func (cli *ClientApi) CheckName(c *gin.Context) { + var params request.CheckClientName + ctx, ok := contextx.NewContext(c, ¶ms) + if !ok { + return + } + + errCode := clientService.CheckName(params.Name) + if errCode != ecode.OK { + ctx.Fail(errCode) + return + } + + ctx.Ok() +} -- Gitblit v1.8.0