From 4f526b034a6e13a521ad71dcbdbea97043d6ea19 Mon Sep 17 00:00:00 2001
From: zhangqian <zhangqian@123.com>
Date: 星期三, 20 三月 2024 19:21:20 +0800
Subject: [PATCH] 发货信息字段完善

---
 main.go |   24 +++++++++++++-----------
 1 files changed, 13 insertions(+), 11 deletions(-)

diff --git a/main.go b/main.go
index 18843c8..04c6993 100644
--- a/main.go
+++ b/main.go
@@ -1,12 +1,14 @@
 package main
 
 import (
-	v1 "aps_crm/api/v1"
 	"aps_crm/conf"
 	"aps_crm/initialize"
 	"aps_crm/middleware"
 	"aps_crm/model"
+	"aps_crm/model/grpc_init"
 	"aps_crm/pkg/logx"
+	"aps_crm/proto/client"
+	"aps_crm/proto/crm_aps"
 	"aps_crm/proto/product_inventory"
 	"aps_crm/router"
 	"fmt"
@@ -48,12 +50,10 @@
 		ReadTimeout:  5 * time.Second,
 		WriteTimeout: 5 * time.Second,
 	}
-
 	//鍚姩grpc瀹㈡埛绔�
-	go v1.InitProductServiceConn()
 	go middleware.InitUserConn()
-	go v1.InitCodeServiceConn()
-	go v1.InitProductInventoryServiceConn()
+	go grpc_init.InitProductInventoryServiceConn()
+	go grpc_init.InitCrmApsGrpcServiceConn()
 	//鍚姩grpc鏈嶅姟
 	go func() {
 		ln, err := net.Listen("tcp", ":"+conf.Conf.System.GrpcPort)
@@ -64,15 +64,17 @@
 		s := grpc.NewServer()
 		//todo 娣诲姞鍏蜂綋鏈嶅姟
 		product_inventory.RegisterProductInventoryServiceServer(s, &product_inventory.Server{})
+		crm_aps.RegisterCrmAndApsGrpcServiceServer(s, &crm_aps.Server{})
+		client.RegisterClientServiceServer(s, &client.Server{})
 		err = s.Serve(ln)
 		if err != nil {
 			logx.Errorf("grpc server init error: %v", err.Error())
 			panic(fmt.Sprintf("grpc server init error: %v", err.Error()))
 		}
 	}()
-	//c := cron.New()
-	//c.AddFunc("@every 15s", service.SyncUserInfo) // 姣�15绉掑悓姝ヤ竴娆�
-	//c.Start()
+
+	middleware.InitRefreshUserManager(5, 5, 3600)
+	middleware.RunRefreshUser() ///瀹氭椂瀵规椿璺冪敤鎴锋洿鏂扮敤鎴疯鎯�
 
 	logx.Error(server.ListenAndServe().Error())
 }
@@ -82,10 +84,10 @@
 	signal.Notify(quit, syscall.SIGKILL, syscall.SIGQUIT, syscall.SIGINT, syscall.SIGTERM)
 	<-quit
 
-	v1.CloseProductServiceConn()
-	v1.CloseCodeServiceConn()
-	v1.CloseProductInventoryServiceConn()
+	middleware.StopRefreshUser()
+	grpc_init.CloseProductInventoryServiceConn()
 	middleware.CloseUserConn()
+	grpc_init.CloseCrmApsGrpcServiceConn()
 
 	logx.Infof("aps-crm exited...")
 	os.Exit(0)

--
Gitblit v1.8.0