Browse Source

fix_服务商邀请

Ethan 3 tháng trước cách đây
mục cha
commit
a9c7d1f6bb

+ 11 - 0
app/controller/common_controller.go

@@ -18,3 +18,14 @@ func (t CommonController) CooperationPlatform(c *gin.Context) {
 	}
 	returnSuccess(c, 20000, result)
 }
+
+// 获取商品类目
+func (t CommonController) ProductCategory(c *gin.Context) {
+	result, err := service.ProductService{}.GetProductCategorys()
+	if err != nil {
+		logrus.Errorf("[ProductCategory] call Show err:%+v\n", err)
+		returnError(c, 40000, err.Error())
+		return
+	}
+	returnSuccess(c, 20000, result)
+}

+ 8 - 2
app/controller/cooperation_controller.go

@@ -3,6 +3,7 @@ package controller
 import (
 	"github.com/gin-gonic/gin"
 	"github.com/sirupsen/logrus"
+	"strings"
 	"youngee_b_api/app/service"
 	"youngee_b_api/app/vo"
 )
@@ -46,8 +47,13 @@ func (o CooperationController) InviteSupplier(c *gin.Context) {
 	}
 	err1 := service.CooperationService{}.InviteSupplier(param)
 	if err1 != nil {
-		logrus.Errorf("[InviteSupplier] call Show err:%+v\n", err)
-		returnError(c, 40000, err.Error())
+		if strings.Contains(err1.Error(), "Duplicate entry") {
+			logrus.Errorf("[InviteSupplier] call Show err:%+v\n", err)
+			returnError(c, 40000, "请勿邀请已入库服务商")
+		} else {
+			logrus.Errorf("[InviteSupplier] call Show err:%+v\n", err)
+			returnError(c, 40000, err1.Error())
+		}
 		return
 	}
 	returnSuccess(c, 20000, nil)