From 3b474a056ea35196ce5d2a5f297eafa11295a95d Mon Sep 17 00:00:00 2001
From: liujiandao <274878379@qq.com>
Date: 星期三, 22 十一月 2023 14:23:13 +0800
Subject: [PATCH] 添加登录功能

---
 initialize/router.go |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/initialize/router.go b/initialize/router.go
index 4b390f7..584dbf3 100644
--- a/initialize/router.go
+++ b/initialize/router.go
@@ -2,6 +2,7 @@
 
 import (
 	"net/http"
+	"srm/middleware"
 	"srm/router/purchase"
 
 	"github.com/gin-gonic/gin"
@@ -25,16 +26,15 @@
 	global.GVA_LOG.Info("register swagger handler")
 	// 鏂逛究缁熶竴娣诲姞璺敱缁勫墠缂� 澶氭湇鍔″櫒涓婄嚎浣跨敤
 
-	PublicGroup := Router.Group(global.GVA_CONFIG.System.RouterPrefix)
+	PrivateGroup := Router.Group(global.GVA_CONFIG.System.RouterPrefix)
 	{
 		// 鍋ュ悍鐩戞祴
-		PublicGroup.GET("/health", func(c *gin.Context) {
+		PrivateGroup.GET("/health", func(c *gin.Context) {
 			c.JSON(http.StatusOK, "ok")
 		})
 		//systemRouter.InitInitRouter(PublicGroup) // 鑷姩鍒濆鍖栫浉鍏�
 	}
-
-	PrivateGroup := Router.Group(global.GVA_CONFIG.System.RouterPrefix)
+	PrivateGroup.Use(middleware.JWTAuth())
 	{
 		systemRouter.InitSystemRouter(PrivateGroup) // system鐩稿叧璺敱
 		//exampleRouter.InitFileUploadAndDownloadRouter(PrivateGroup) // 鏂囦欢涓婁紶涓嬭浇鍔熻兘璺敱

--
Gitblit v1.8.0