From 1e034f4568c5a54378a2c80447ade3c120e99295 Mon Sep 17 00:00:00 2001 From: zhangqian <zhangqian@123.com> Date: 星期一, 16 十月 2023 13:43:22 +0800 Subject: [PATCH] 销售机会列表返回联系人对象 --- api/v1/contract.go | 32 +++++++++++++++++++++++++------- 1 files changed, 25 insertions(+), 7 deletions(-) diff --git a/api/v1/contract.go b/api/v1/contract.go index 98b4ee9..8e05fa5 100644 --- a/api/v1/contract.go +++ b/api/v1/contract.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" ) @@ -30,6 +32,13 @@ if errCode != ecode.OK { ctx.Fail(errCode) return + } + + if contract.MemberId == 0 { + userInfo := utils.GetUserInfo(c) + if userInfo.UserType == constvar.UserTypeSub { + contract.MemberId = userInfo.CrmUserId + } } errCode = contractService.AddContract(&contract) @@ -115,13 +124,14 @@ //} contractModel = model.Contract{ - ClientId: contract.ClientId, - MemberId: contract.MemberId, - Number: contract.Number, - QuotationId: contract.QuotationId, - StatusId: contract.StatusId, - File: contract.File, - CodeStandID: contract.CodeStandID, + ClientId: contract.ClientId, + MemberId: contract.MemberId, + Number: contract.Number, + QuotationId: contract.QuotationId, + StatusId: contract.StatusId, + File: contract.File, + CodeStandID: contract.CodeStandID, + ContractName: contract.ContractName, } return ecode.OK, contractModel @@ -142,6 +152,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 + } + contracts, total, errCode := contractService.GetContractList(params.Page, params.PageSize, params.SearchMap) if errCode != ecode.OK { ctx.Fail(errCode) -- Gitblit v1.8.0