diff --git a/doc/src/.vuepress/sidebar.ts b/doc/src/.vuepress/sidebar.ts
index 69f1b09..b97f452 100644
--- a/doc/src/.vuepress/sidebar.ts
+++ b/doc/src/.vuepress/sidebar.ts
@@ -5,7 +5,7 @@ export default sidebar({
"",
{
text: "拓展",
- icon: "laptop-code",
+ icon: "rainbow",
prefix: "expansion/",
link: "expansion/",
children: "structure",
diff --git a/doc/src/enhance/README.md b/doc/src/enhance/README.md
index 4271a5d..3d6074b 100644
--- a/doc/src/enhance/README.md
+++ b/doc/src/enhance/README.md
@@ -2,7 +2,6 @@
title: 译文
index: false
icon: laptop-code
-
---
::: warning AI生成
diff --git a/doc/src/expansion/readme.md b/doc/src/expansion/readme.md
index c448923..83c5bcb 100644
--- a/doc/src/expansion/readme.md
+++ b/doc/src/expansion/readme.md
@@ -2,6 +2,7 @@
title: 拓展
order: 1
index: false
+icon: rainbow
---
\ No newline at end of file
diff --git a/doc/src/origin/readme.md b/doc/src/origin/readme.md
index 9a48ad8..b71b07c 100644
--- a/doc/src/origin/readme.md
+++ b/doc/src/origin/readme.md
@@ -1,6 +1,7 @@
---
title: 原文
index: false
+icon: book
---
\ No newline at end of file
diff --git a/gateway/handlers/static.go b/gateway/handlers/static.go
index c84e74c..5ce956a 100644
--- a/gateway/handlers/static.go
+++ b/gateway/handlers/static.go
@@ -44,8 +44,8 @@ func ServeIndex(db *gorm.DB) gin.HandlerFunc {
// 处理静态文件请求
func ServeStatic(db *gorm.DB) gin.HandlerFunc {
return func(c *gin.Context) {
- userInfo := getUserInfo(c, db)
- utils.LogAccess(c.ClientIP(), c.Request.URL.Path, c.Request.Method, userInfo)
+ //userInfo := getUserInfo(c, db)
+ //utils.LogAccess(c.ClientIP(), c.Request.URL.Path, c.Request.Method, userInfo)
filePath := "./static" + c.Request.URL.Path
if _, err := os.Stat(filePath); err == nil {
http.ServeFile(c.Writer, c.Request, filePath)
diff --git a/gateway/utils/logger.go b/gateway/utils/logger.go
index 7d0b1a9..ce1c3fd 100644
--- a/gateway/utils/logger.go
+++ b/gateway/utils/logger.go
@@ -28,11 +28,23 @@ func InitLogger() {
}
func LogAccess(ip, path, method string, userInfo map[string]interface{}) {
+ // 设置东八区时区
+ loc, err := time.LoadLocation("Asia/Shanghai")
+ if err != nil {
+ Logger.WithError(err).Error("Failed to load timezone")
+ return
+ }
+
+ // 获取当前时间并格式化为东八区时间,使用中国人的习惯格式
+ now := time.Now().In(loc)
+ timestamp := now.Format("2006-01-02 15:04:05")
+
+ // 构建日志字段
fields := logrus.Fields{
"ip": ip,
"path": path,
"method": method,
- "timestamp": time.Now().Format(time.RFC3339),
+ "timestamp": timestamp,
}
// 合并用户信息到日志字段中
@@ -42,5 +54,6 @@ func LogAccess(ip, path, method string, userInfo map[string]interface{}) {
}
}
+ // 记录日志
Logger.WithFields(fields).Info("Page accessed")
}