From b45b8ce8051e2ad9c80aafa42d1a5892f6a36bce Mon Sep 17 00:00:00 2001 From: zhangqian <zhangqian@123.com> Date: 星期二, 17 十月 2023 15:27:44 +0800 Subject: [PATCH] 初始化一些表shuju --- api/v1/quotation.go | 27 +++++++++++++++++++++++++++ 1 files changed, 27 insertions(+), 0 deletions(-) diff --git a/api/v1/quotation.go b/api/v1/quotation.go index a99f69a..7beeb3b 100644 --- a/api/v1/quotation.go +++ b/api/v1/quotation.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 } + if quotation.MemberId == 0 { + userInfo := utils.GetUserInfo(c) + if userInfo.UserType == constvar.UserTypeSub { + quotation.MemberId = userInfo.CrmUserId + } + } + errCode = quotationService.AddQuotation("ation) if errCode != ecode.OK { ctx.Fail(errCode) return + } + + if params.CodeRule.Method == 1 { + autoCode := model.GetAutoCode(quotation.Id, ¶ms.CodeRule) + m := map[string]interface{}{ + "number": autoCode, + } + _ = model.NewQuotationSearch(nil).SetId(quotation.Id).Updates(m) } ctx.Ok() @@ -140,6 +157,8 @@ quotationModel.Conditions = quotation.Conditions quotationModel.File = quotation.File quotationModel.Products = quotation.Products + quotationModel.CodeStandID = quotation.CodeStandID + quotationModel.QuotationName = quotation.QuotationName return ecode.OK, quotationModel @@ -160,6 +179,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 + } + quotations, total, errCode := quotationService.GetQuotationList(params.Page, params.PageSize, params.SearchMap) if errCode != ecode.OK { ctx.Fail(errCode) -- Gitblit v1.8.0