From f65ce9c19568745003b22e82060fb38c2885c701 Mon Sep 17 00:00:00 2001 From: liujiandao <274878379@qq.com> Date: 星期五, 13 十月 2023 15:36:30 +0800 Subject: [PATCH] Merge branch 'master' of http://192.168.5.5:10010/r/aps/crm --- api/v1/client.go | 26 ++++++++++++++++++++++++++ 1 files changed, 26 insertions(+), 0 deletions(-) diff --git a/api/v1/client.go b/api/v1/client.go index b354d14..40375c9 100644 --- a/api/v1/client.go +++ b/api/v1/client.go @@ -1,11 +1,13 @@ package v1 import ( + "aps_crm/constvar" "aps_crm/model" "aps_crm/model/request" "aps_crm/model/response" "aps_crm/pkg/contextx" "aps_crm/pkg/ecode" + "aps_crm/utils" "github.com/gin-gonic/gin" ) @@ -32,10 +34,25 @@ return } + //CreatorId, b := c.Get("claims") + //if !b { + // ctx.Fail(ecode.JWTParseErr) + // return + //} + // + //client.CreatorId = CreatorId.(int) + 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() @@ -98,6 +115,7 @@ client.Business.EnterpriseNatureId = params.EnterpriseNatureId client.Business.EnterpriseScaleId = params.EnterpriseScaleId client.MemberId = params.MemberId + client.CodeStandID = params.CodeStandID //if params.Contact.Name != "" { // assign the client's member id to contact when adding @@ -190,6 +208,14 @@ return } + userInfo := utils.GetUserInfo(c) + if userInfo.UserType == constvar.UserTypeSub { + if params.SearchMap == nil { + params.SearchMap = make(map[string]interface{}, 0) + } + params.SearchMap["member_id"] = userInfo.CrmUserId + } + clients, total, errCode := clientService.GetClientList(params.Page, params.PageSize, params.SearchMap) if errCode != ecode.OK { ctx.Fail(errCode) -- Gitblit v1.8.0