From 0409a5d0235f4a87ecf08b12baa9149279a90447 Mon Sep 17 00:00:00 2001
From: wangpengfei <274878379@qq.com>
Date: 星期五, 18 八月 2023 22:25:58 +0800
Subject: [PATCH] fix
---
main.go | 18 ++++++++++++++++--
1 files changed, 16 insertions(+), 2 deletions(-)
diff --git a/main.go b/main.go
index 50300fc..35a40b7 100644
--- a/main.go
+++ b/main.go
@@ -1,12 +1,15 @@
package main
import (
+ v1 "aps_crm/api/v1"
"aps_crm/conf"
"aps_crm/initialize"
"aps_crm/model"
"aps_crm/pkg/logx"
"aps_crm/router"
+ "aps_crm/service"
"fmt"
+ "github.com/robfig/cron/v3"
"net/http"
"os"
"os/signal"
@@ -36,13 +39,21 @@
}
go shutdown()
- logx.Infof("aps-admin start serve...")
+ logx.Infof("aps-crm start serve...")
server := &http.Server{
Addr: fmt.Sprintf(":%d", conf.Conf.System.Port),
Handler: router.InitRouter(),
ReadTimeout: 5 * time.Second,
WriteTimeout: 5 * time.Second,
}
+
+ go v1.InitProductServiceConn()
+ go service.InitUserConn()
+
+ c := cron.New()
+ c.AddFunc("@every 15s", service.SyncUserInfo) // 姣�15绉掑悓姝ヤ竴娆�
+ c.Start()
+
logx.Error(server.ListenAndServe().Error())
}
@@ -51,6 +62,9 @@
signal.Notify(quit, syscall.SIGKILL, syscall.SIGQUIT, syscall.SIGINT, syscall.SIGTERM)
<-quit
- logx.Infof("aps-admin exited...")
+ v1.CloseProductServiceConn()
+ service.CloseUserConn()
+
+ logx.Infof("aps-crm exited...")
os.Exit(0)
}
--
Gitblit v1.8.0