From 8be40ffd79c4dcdb4dc00bef359ccf48a6b031f3 Mon Sep 17 00:00:00 2001 From: zhangqian <zhangqian@123.com> Date: 星期六, 28 十月 2023 15:56:26 +0800 Subject: [PATCH] 若干接口支持查看下属数据 --- api/v1/client.go | 30 +++++++++++++++--------------- 1 files changed, 15 insertions(+), 15 deletions(-) diff --git a/api/v1/client.go b/api/v1/client.go index bac72a8..d7dc42e 100644 --- a/api/v1/client.go +++ b/api/v1/client.go @@ -41,25 +41,20 @@ return } - //CreatorId, b := c.Get("claims") - //if !b { - // ctx.Fail(ecode.JWTParseErr) - // return - //} - // - //client.CreatorId = CreatorId.(int) + count, err := model.NewClientSearch(nil).SetNumber(client.Number).Count() + if err != nil { + ctx.FailWithMsg(ecode.UnknownErr, "缂栫爜楠岃瘉澶辫触") + return + } + if count > 0 { + ctx.FailWithMsg(ecode.UnknownErr, "缂栫爜宸插瓨鍦�") + return + } errCode = clientService.AddClient(client, params.SalesLeadsId) if errCode != ecode.OK { ctx.Fail(errCode) return - } - if params.CodeRule.Method == 1 { - autoCode := model.GetAutoCode(client.Id, ¶ms.CodeRule) - m := map[string]interface{}{ - "number": autoCode, - } - _ = model.NewClientSearch(nil).SetId(client.Id).UpdateByMap(m) } ctx.Ok() @@ -121,7 +116,12 @@ client.Business.IndustryId = params.IndustryId client.Business.EnterpriseNatureId = params.EnterpriseNatureId client.Business.EnterpriseScaleId = params.EnterpriseScaleId - client.MemberId = params.MemberId + //閿�鍞礋璐d汉涓虹┖鏃朵负鍏捣瀹㈡埛 + if params.MemberId == 0 { + client.MemberId = 1 + } else { + client.MemberId = params.MemberId + } client.CodeStandID = params.CodeStandID //if params.Contact.Name != "" { -- Gitblit v1.8.0