From 05582688724c78bc70a7bc860193c67677f6c8cf Mon Sep 17 00:00:00 2001
From: zhangqian <zhangqian@123.com>
Date: 星期六, 28 十月 2023 10:46:37 +0800
Subject: [PATCH] Merge branch 'master' of http://192.168.5.5:10010/r/aps/crm

---
 api/v1/quotation.go |   18 ++++++++++--------
 1 files changed, 10 insertions(+), 8 deletions(-)

diff --git a/api/v1/quotation.go b/api/v1/quotation.go
index 7beeb3b..3fd3552 100644
--- a/api/v1/quotation.go
+++ b/api/v1/quotation.go
@@ -34,6 +34,16 @@
 		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 {
@@ -45,14 +55,6 @@
 	if errCode != ecode.OK {
 		ctx.Fail(errCode)
 		return
-	}
-
-	if params.CodeRule.Method == 1 {
-		autoCode := model.GetAutoCode(quotation.Id, &params.CodeRule)
-		m := map[string]interface{}{
-			"number": autoCode,
-		}
-		_ = model.NewQuotationSearch(nil).SetId(quotation.Id).Updates(m)
 	}
 
 	ctx.Ok()

--
Gitblit v1.8.0