From 67cf4fc49fdea5dcdd8007a94227f8486881c6bb Mon Sep 17 00:00:00 2001
From: liujiandao <274878379@qq.com>
Date: 星期二, 26 九月 2023 19:25:42 +0800
Subject: [PATCH] 部分功能修改

---
 api/v1/test/product.go |   13 +++++++++++++
 1 files changed, 13 insertions(+), 0 deletions(-)

diff --git a/api/v1/test/product.go b/api/v1/test/product.go
index ca47df4..dfb82c9 100644
--- a/api/v1/test/product.go
+++ b/api/v1/test/product.go
@@ -36,6 +36,19 @@
 		response.FailWithMessage(err.Error(), c)
 		return
 	}
+	for _, t := range p.List {
+		var num int64
+		db := global.GVA_DB.Model(&test.Product{})
+		err := db.Where("number = ?", t.Number).Where("supplier_id = ?", t.SupplierId).Count(&num).Error
+		if err != nil {
+			response.FailWithMessage(err.Error(), c)
+			return
+		}
+		if num > 0 {
+			response.FailWithMessage("褰撳墠渚涘簲鍟嗗凡缁忔彁渚涙浜у搧", c)
+			return
+		}
+	}
 	if err := pService.CreateProduct(p.List); err != nil {
 		global.GVA_LOG.Error("鍒涘缓澶辫触!", zap.Error(err))
 		response.FailWithMessage("鍒涘缓澶辫触", c)

--
Gitblit v1.8.0