From 115bd9b51f5d8eade4658f844de37516486c60e7 Mon Sep 17 00:00:00 2001
From: liujiandao <274878379@qq.com>
Date: 星期六, 18 十一月 2023 17:25:25 +0800
Subject: [PATCH] crm获取aps项目模块信息

---
 api/v1/code.go |   42 ++++++++++++++++++++----------------------
 1 files changed, 20 insertions(+), 22 deletions(-)

diff --git a/api/v1/code.go b/api/v1/code.go
index a94cb5a..941623b 100644
--- a/api/v1/code.go
+++ b/api/v1/code.go
@@ -1,9 +1,9 @@
 package v1
 
 import (
-	"aps_crm/conf"
 	"aps_crm/constvar"
 	"aps_crm/model"
+	"aps_crm/model/grpc_init"
 	"aps_crm/model/request"
 	"aps_crm/model/response"
 	"aps_crm/pkg/contextx"
@@ -12,30 +12,28 @@
 	"aps_crm/proto/code"
 	"github.com/gin-gonic/gin"
 	"github.com/spf13/cast"
-	"google.golang.org/grpc"
-	"google.golang.org/grpc/credentials/insecure"
 )
 
 type CodeApi struct{}
 
-var (
-	codeServiceConn *grpc.ClientConn
-)
-
-func InitCodeServiceConn() {
-	var err error
-	codeServiceConn, err = grpc.Dial(conf.Conf.GrpcServiceAddr.Aps, grpc.WithTransportCredentials(insecure.NewCredentials()))
-	if err != nil {
-		logx.Errorf("grpc dial product service error: %v", err.Error())
-		return
-	}
-}
-
-func CloseCodeServiceConn() {
-	if codeServiceConn != nil {
-		codeServiceConn.Close()
-	}
-}
+//var (
+//	codeServiceConn *grpc.ClientConn
+//)
+//
+//func InitCodeServiceConn() {
+//	var err error
+//	codeServiceConn, err = grpc.Dial(conf.Conf.GrpcServiceAddr.Aps, grpc.WithTransportCredentials(insecure.NewCredentials()))
+//	if err != nil {
+//		logx.Errorf("grpc dial product service error: %v", err.Error())
+//		return
+//	}
+//}
+//
+//func CloseCodeServiceConn() {
+//	if codeServiceConn != nil {
+//		codeServiceConn.Close()
+//	}
+//}
 
 // GetCodeList
 //
@@ -55,7 +53,7 @@
 	params.CodeStandID = c.Query("codeStandID")
 	params.Name = c.Query("name")
 	params.Type = c.Query("type")
-	client := code.NewCodeServiceClient(codeServiceConn)
+	client := code.NewCodeServiceClient(grpc_init.CrmApsGrpcServiceConn)
 	list, err := client.GetCodeList(ctx.GetCtx(), &code.GetCodeListRequest{
 		Page:        cast.ToInt32(params.Page),
 		PageSize:    cast.ToInt32(params.PageSize),

--
Gitblit v1.8.0