Skip to content

Commit 2242f5d

Browse files
pixelmaxQmpiexlMax(奇淼yexkAzir-11
authored
public: 发布v2.8.8 (#2167)
* refactor: 移除冗余的工具名称和描述,简化代码生成器的文档 * Add Content-Type to S3 upload input Add Content-Type to S3 upload input * style: 优化仪表盘组件样式,调整各个子组件的布局和样式,提升视觉效果 * fix: 更新插件链接 * 优化角色配置-首页配置相关内容 * feat: 默认首页只允许选择已选中的菜单 * feat: 更新样式和优化组件,调整背景色及文本颜色 * feat: 清理无用的右侧边线 * feat: 增加了导入导出模板的自定义sql能力,方便灵活化扩展导入导出 * feat: 优化日志输出,增加插件字典定义 * feat: 增加插件字典定义前端相关 * feat: 增加插件自定义字典方法 * feat: 增加文件名和路径合法性检查 * feat: 修复暗黑模式和亮色模式logo路径定义 * feat: 移除未使用的defineEmits导入 * feat: 更新授权链接至新地址 * feat: 移除菜单组件背景色 * feat: 更新导出和导入SQL语句的示例占位符 * feat: 错误日志必须有数据库链接才会存储 * feat: 移除仪表板中公告卡片的高度限制 * feat: 添加插件列表接口,更新插件表格组件,移除不必要的注释 * feat: 更新版本号至v2.8.8,调整插件表格组件的请求参数 --------- Co-authored-by: piexlMax(奇淼 <[email protected]> Co-authored-by: Yexk_M <[email protected]> Co-authored-by: Azir-11 <[email protected]>
1 parent 567a8eb commit 2242f5d

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

57 files changed

+1310
-1094
lines changed

server/api/v1/system/auto_code_plugin.go

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,3 +117,27 @@ func (a *AutoCodePluginApi) InitAPI(c *gin.Context) {
117117
}
118118
response.OkWithMessage("文件变更成功", c)
119119
}
120+
121+
// InitDictionary
122+
// @Tags AutoCodePlugin
123+
// @Summary 打包插件
124+
// @Security ApiKeyAuth
125+
// @accept application/json
126+
// @Produce application/json
127+
// @Success 200 {object} response.Response{data=map[string]interface{},msg=string} "打包插件成功"
128+
// @Router /autoCode/initDictionary [post]
129+
func (a *AutoCodePluginApi) InitDictionary(c *gin.Context) {
130+
var dictInfo request.InitDictionary
131+
err := c.ShouldBindJSON(&dictInfo)
132+
if err != nil {
133+
response.FailWithMessage(err.Error(), c)
134+
return
135+
}
136+
err = autoCodePluginService.InitDictionary(dictInfo)
137+
if err != nil {
138+
global.GVA_LOG.Error("创建初始化Dictionary失败!", zap.Error(err))
139+
response.FailWithMessage("创建初始化Dictionary失败"+err.Error(), c)
140+
return
141+
}
142+
response.OkWithMessage("文件变更成功", c)
143+
}

server/core/internal/zap_core.go

Lines changed: 72 additions & 76 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
package internal
22

33
import (
4-
"context"
5-
"fmt"
6-
"github.com/flipped-aurora/gin-vue-admin/server/global"
7-
"github.com/flipped-aurora/gin-vue-admin/server/model/system"
8-
"github.com/flipped-aurora/gin-vue-admin/server/service"
9-
astutil "github.com/flipped-aurora/gin-vue-admin/server/utils/ast"
10-
"github.com/flipped-aurora/gin-vue-admin/server/utils/stacktrace"
11-
"go.uber.org/zap"
12-
"go.uber.org/zap/zapcore"
13-
"os"
14-
"strings"
15-
"time"
4+
"context"
5+
"fmt"
6+
"github.com/flipped-aurora/gin-vue-admin/server/global"
7+
"github.com/flipped-aurora/gin-vue-admin/server/model/system"
8+
"github.com/flipped-aurora/gin-vue-admin/server/service"
9+
astutil "github.com/flipped-aurora/gin-vue-admin/server/utils/ast"
10+
"github.com/flipped-aurora/gin-vue-admin/server/utils/stacktrace"
11+
"go.uber.org/zap"
12+
"go.uber.org/zap/zapcore"
13+
"os"
14+
"strings"
15+
"time"
1616
)
1717

1818
type ZapCore struct {
@@ -61,75 +61,71 @@ func (z *ZapCore) Check(entry zapcore.Entry, check *zapcore.CheckedEntry) *zapco
6161
}
6262

6363
func (z *ZapCore) Write(entry zapcore.Entry, fields []zapcore.Field) error {
64-
for i := 0; i < len(fields); i++ {
65-
if fields[i].Key == "business" || fields[i].Key == "folder" || fields[i].Key == "directory" {
66-
syncer := z.WriteSyncer(fields[i].String)
67-
z.Core = zapcore.NewCore(global.GVA_CONFIG.Zap.Encoder(), syncer, z.level)
68-
}
69-
}
70-
// 先写入原日志目标
71-
err := z.Core.Write(entry, fields)
64+
for i := 0; i < len(fields); i++ {
65+
if fields[i].Key == "business" || fields[i].Key == "folder" || fields[i].Key == "directory" {
66+
syncer := z.WriteSyncer(fields[i].String)
67+
z.Core = zapcore.NewCore(global.GVA_CONFIG.Zap.Encoder(), syncer, z.level)
68+
}
69+
}
70+
// 先写入原日志目标
71+
err := z.Core.Write(entry, fields)
7272

73-
// 捕捉 Error 及以上级别日志并入库,且可提取 zap.Error(err) 的错误内容
74-
if entry.Level >= zapcore.ErrorLevel {
75-
// 避免与 GORM zap 写入互相递归:跳过由 gorm logger writer 触发的日志
76-
if strings.Contains(entry.Caller.File, "gorm_logger_writer.go") {
77-
return err
78-
}
79-
// 避免重复记录 panic 恢复日志,panic 由 GinRecovery 单独捕捉入库
80-
if strings.Contains(entry.Message, "[Recovery from panic]") {
81-
return err
82-
}
73+
// 捕捉 Error 及以上级别日志并入库,且可提取 zap.Error(err) 的错误内容
74+
if entry.Level >= zapcore.ErrorLevel {
75+
// 避免与 GORM zap 写入互相递归:跳过由 gorm logger writer 触发的日志
76+
if strings.Contains(entry.Caller.File, "gorm_logger_writer.go") {
77+
return err
78+
}
8379

84-
form := "后端"
85-
level := entry.Level.String()
86-
// 生成基础信息
87-
info := entry.Message
80+
form := "后端"
81+
level := entry.Level.String()
82+
// 生成基础信息
83+
info := entry.Message
8884

89-
// 提取 zap.Error(err) 内容
90-
var errStr string
91-
for i := 0; i < len(fields); i++ {
92-
f := fields[i]
93-
if f.Type == zapcore.ErrorType || f.Key == "error" || f.Key == "err" {
94-
if f.Interface != nil {
95-
errStr = fmt.Sprintf("%v", f.Interface)
96-
} else if f.String != "" {
97-
errStr = f.String
98-
}
99-
break
100-
}
101-
}
102-
if errStr != "" {
103-
info = fmt.Sprintf("%s | 错误: %s", info, errStr)
104-
}
85+
// 提取 zap.Error(err) 内容
86+
var errStr string
87+
for i := 0; i < len(fields); i++ {
88+
f := fields[i]
89+
if f.Type == zapcore.ErrorType || f.Key == "error" || f.Key == "err" {
90+
if f.Interface != nil {
91+
errStr = fmt.Sprintf("%v", f.Interface)
92+
} else if f.String != "" {
93+
errStr = f.String
94+
}
95+
break
96+
}
97+
}
98+
if errStr != "" {
99+
info = fmt.Sprintf("%s | 错误: %s", info, errStr)
100+
}
105101

106-
// 附加来源与堆栈信息
107-
if entry.Caller.File != "" {
108-
info = fmt.Sprintf("%s \n 源文件:%s:%d", info, entry.Caller.File, entry.Caller.Line)
109-
}
110-
stack := entry.Stack
111-
if stack != "" {
112-
info = fmt.Sprintf("%s \n 调用栈:%s", info, stack)
113-
// 解析最终业务调用方,并提取其方法源码
114-
if frame, ok := stacktrace.FindFinalCaller(stack); ok {
115-
fnName, fnSrc, sLine, eLine, exErr := astutil.ExtractFuncSourceByPosition(frame.File, frame.Line)
116-
if exErr == nil {
117-
info = fmt.Sprintf("%s \n 最终调用方法:%s:%d (%s lines %d-%d)\n----- 产生日志的方法代码如下 -----\n%s", info, frame.File, frame.Line, fnName, sLine, eLine, fnSrc)
118-
} else {
119-
info = fmt.Sprintf("%s \n 最终调用方法:%s:%d (%s) | extract_err=%v", info, frame.File, frame.Line, fnName, exErr)
120-
}
121-
}
122-
}
102+
// 附加来源与堆栈信息
103+
if entry.Caller.File != "" {
104+
info = fmt.Sprintf("%s \n 源文件:%s:%d", info, entry.Caller.File, entry.Caller.Line)
105+
}
106+
stack := entry.Stack
107+
if stack != "" {
108+
info = fmt.Sprintf("%s \n 调用栈:%s", info, stack)
109+
// 解析最终业务调用方,并提取其方法源码
110+
if frame, ok := stacktrace.FindFinalCaller(stack); ok {
111+
fnName, fnSrc, sLine, eLine, exErr := astutil.ExtractFuncSourceByPosition(frame.File, frame.Line)
112+
if exErr == nil {
113+
info = fmt.Sprintf("%s \n 最终调用方法:%s:%d (%s lines %d-%d)\n----- 产生日志的方法代码如下 -----\n%s", info, frame.File, frame.Line, fnName, sLine, eLine, fnSrc)
114+
} else {
115+
info = fmt.Sprintf("%s \n 最终调用方法:%s:%d (%s) | extract_err=%v", info, frame.File, frame.Line, fnName, exErr)
116+
}
117+
}
118+
}
123119

124-
// 使用后台上下文,避免依赖 gin.Context
125-
ctx := context.Background()
126-
_ = service.ServiceGroupApp.SystemServiceGroup.SysErrorService.CreateSysError(ctx, &system.SysError{
127-
Form: &form,
128-
Info: &info,
129-
Level: level,
130-
})
131-
}
132-
return err
120+
// 使用后台上下文,避免依赖 gin.Context
121+
ctx := context.Background()
122+
_ = service.ServiceGroupApp.SystemServiceGroup.SysErrorService.CreateSysError(ctx, &system.SysError{
123+
Form: &form,
124+
Info: &info,
125+
Level: level,
126+
})
127+
}
128+
return err
133129
}
134130

135131
func (z *ZapCore) Sync() error {

server/core/server.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ func RunServer() {
4747
--------------------------------------版权声明--------------------------------------
4848
** 版权所有方:flipped-aurora开源团队 **
4949
** 版权持有公司:北京翻转极光科技有限责任公司 **
50-
** 剔除授权标识需购买商用授权:https://gin-vue-admin.com/empower/index.html **
50+
** 剔除授权标识需购买商用授权:https://plugin.gin-vue-admin.com/license **
5151
** 感谢您对Gin-Vue-Admin的支持与关注 合法授权使用更有利于项目的长久发展**
5252
`, global.Version, address, address, global.GVA_CONFIG.MCP.SSEPath, address, global.GVA_CONFIG.MCP.MessagePath)
5353
initServer(address, Router, 10*time.Minute, 10*time.Minute)

server/global/version.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ package global
44
// 目前只有Version正式使用 其余为预留
55
const (
66
// Version 当前版本号
7-
Version = "v2.8.7"
7+
Version = "v2.8.8"
88
// AppName 应用名称
99
AppName = "Gin-Vue-Admin"
1010
// Description 应用描述

server/go.mod

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ require (
2020
github.com/gookit/color v1.5.4
2121
github.com/huaweicloud/huaweicloud-sdk-go-obs v3.24.9+incompatible
2222
github.com/jordan-wright/email v4.0.1-0.20210109023952-943e75fe5223+incompatible
23-
github.com/localrivet/gomcp v1.7.2
2423
github.com/mark3labs/mcp-go v0.41.1
2524
github.com/mholt/archives v0.1.1
2625
github.com/minio/minio-go/v7 v7.0.84
@@ -78,7 +77,6 @@ require (
7877
github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f // indirect
7978
github.com/dsnet/compress v0.0.2-0.20230904184137-39efe44ab707 // indirect
8079
github.com/dustin/go-humanize v1.0.1 // indirect
81-
github.com/eclipse/paho.mqtt.golang v1.5.0 // indirect
8280
github.com/emirpasic/gods v1.12.0 // indirect
8381
github.com/gabriel-vasile/mimetype v1.4.8 // indirect
8482
github.com/gammazero/toposort v0.1.1 // indirect
@@ -93,16 +91,12 @@ require (
9391
github.com/go-playground/locales v0.14.1 // indirect
9492
github.com/go-playground/universal-translator v0.18.1 // indirect
9593
github.com/go-playground/validator/v10 v10.24.0 // indirect
96-
github.com/gobwas/httphead v0.1.0 // indirect
97-
github.com/gobwas/pool v0.2.1 // indirect
98-
github.com/gobwas/ws v1.4.0 // indirect
9994
github.com/gofrs/flock v0.12.1 // indirect
10095
github.com/golang-sql/civil v0.0.0-20220223132316-b832511892a9 // indirect
10196
github.com/golang-sql/sqlexp v0.1.0 // indirect
10297
github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0 // indirect
10398
github.com/golang/snappy v0.0.4 // indirect
10499
github.com/google/go-querystring v1.1.0 // indirect
105-
github.com/gorilla/websocket v1.5.3 // indirect
106100
github.com/hashicorp/errwrap v1.1.0 // indirect
107101
github.com/hashicorp/go-multierror v1.1.1 // indirect
108102
github.com/hashicorp/golang-lru/v2 v2.0.7 // indirect
@@ -121,7 +115,6 @@ require (
121115
github.com/klauspost/cpuid/v2 v2.2.9 // indirect
122116
github.com/klauspost/pgzip v1.2.6 // indirect
123117
github.com/leodido/go-urn v1.4.0 // indirect
124-
github.com/localrivet/wilduri v0.0.0-20250504021349-6ce732e97cca // indirect
125118
github.com/lufia/plan9stats v0.0.0-20240909124753-873cd0166683 // indirect
126119
github.com/magiconair/properties v1.8.9 // indirect
127120
github.com/mailru/easyjson v0.9.0 // indirect
@@ -135,9 +128,6 @@ require (
135128
github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826 // indirect
136129
github.com/montanaflynn/stats v0.7.1 // indirect
137130
github.com/mozillazg/go-httpheader v0.4.0 // indirect
138-
github.com/nats-io/nats.go v1.42.0 // indirect
139-
github.com/nats-io/nkeys v0.4.11 // indirect
140-
github.com/nats-io/nuid v1.0.1 // indirect
141131
github.com/ncruces/go-strftime v0.1.9 // indirect
142132
github.com/nwaples/rardecode/v2 v2.1.0 // indirect
143133
github.com/otiai10/mint v1.6.3 // indirect
@@ -186,8 +176,6 @@ require (
186176
golang.org/x/sys v0.32.0 // indirect
187177
golang.org/x/time v0.9.0 // indirect
188178
golang.org/x/tools v0.29.0 // indirect
189-
google.golang.org/genproto/googleapis/rpc v0.0.0-20250218202821-56aae31c358a // indirect
190-
google.golang.org/grpc v1.72.1 // indirect
191179
google.golang.org/protobuf v1.36.6 // indirect
192180
gopkg.in/ini.v1 v1.67.0 // indirect
193181
gopkg.in/yaml.v3 v3.0.1 // indirect

0 commit comments

Comments
 (0)