From cc94e1f7427fa598f3e3758650554e97ef957034 Mon Sep 17 00:00:00 2001
From: zhangqian <zhangqian@123.com>
Date: 星期六, 28 十月 2023 16:53:32 +0800
Subject: [PATCH] 销售线索支持查看下属数据

---
 api/v1/quotation.go |   19 +++++++++++++++++++
 1 files changed, 19 insertions(+), 0 deletions(-)

diff --git a/api/v1/quotation.go b/api/v1/quotation.go
index edfb0ae..3fd3552 100644
--- a/api/v1/quotation.go
+++ b/api/v1/quotation.go
@@ -34,6 +34,23 @@
 		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(&quotation)
 	if errCode != ecode.OK {
 		ctx.Fail(errCode)
@@ -142,6 +159,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
 

--
Gitblit v1.8.0