From 530fed8ec225453572d57b15c200ab062c335457 Mon Sep 17 00:00:00 2001 From: zhangqian <zhangqian@123.com> Date: 星期三, 01 十一月 2023 19:20:21 +0800 Subject: [PATCH] 公海member_id使用0 --- api/v1/quotation.go | 28 +++++++++++++++++++--------- 1 files changed, 19 insertions(+), 9 deletions(-) diff --git a/api/v1/quotation.go b/api/v1/quotation.go index 4fd996c..d237955 100644 --- a/api/v1/quotation.go +++ b/api/v1/quotation.go @@ -34,18 +34,27 @@ return } + count, err := model.NewQuotationSearch(nil).SetNumber(params.Number).Count() + if err != nil { + ctx.FailWithMsg(ecode.UnknownErr, "缂栫爜楠岃瘉澶辫触") + return + } + if count > 0 { + ctx.FailWithMsg(ecode.UnknownErr, "缂栫爜宸插瓨鍦�") + 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() @@ -151,6 +160,7 @@ quotationModel.File = quotation.File quotationModel.Products = quotation.Products quotationModel.CodeStandID = quotation.CodeStandID + quotationModel.QuotationName = quotation.QuotationName return ecode.OK, quotationModel @@ -176,7 +186,7 @@ if params.SearchMap == nil { params.SearchMap = make(map[string]interface{}, 0) } - params.SearchMap["member_id"] = userInfo.CrmUserId + params.SearchMap["member_ids"] = userInfo.SubUserIds } quotations, total, errCode := quotationService.GetQuotationList(params.Page, params.PageSize, params.SearchMap) -- Gitblit v1.8.0