From 581cb45bb6a5cb928dfa920abf9c51652aae2da5 Mon Sep 17 00:00:00 2001
From: zhangqian <zhangqian@123.com>
Date: 星期五, 13 十月 2023 16:39:27 +0800
Subject: [PATCH] 接口白名单

---
 middleware/user.go |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/middleware/user.go b/middleware/user.go
index c6df3f9..e852ac9 100644
--- a/middleware/user.go
+++ b/middleware/user.go
@@ -32,7 +32,15 @@
 	}
 }
 
+var whiteList = map[string]struct{}{ //鐧藉悕鍗曞湴鍧�鍒楄〃
+	"/api/code/getCodeList": {},
+	"/api/data/getAllData":  {},
+}
+
 func CheckAuth(apiPath string, token string) bool {
+	if _, ok := whiteList[apiPath]; ok {
+		return true
+	}
 	cli := user.NewUserServiceClient(userConn)
 	ctx, cancel := context.WithTimeout(context.Background(), time.Second)
 	defer cancel()

--
Gitblit v1.8.0