Compare commits

...
883 Commits
Author SHA1 Message Date
PiexlMax(奇淼 a6882210a8 Merge pull request #2235 from kobihikri/ci/pin-github-push-action
ci: pin ad-m/github-push-action to a full commit SHA
2026-07-14 15:56:15 +08:00
kobihikri 005a7b747f ci: pin ad-m/github-push-action to a full commit SHA
The release-pr job passes GITHUB_TOKEN to ad-m/github-push-action, which
is referenced by the mutable `@master` branch. A mutable ref means the
exact code that runs with the token can change without any change in this
repository. Pinning to a full commit SHA makes the action immutable while
keeping the current behaviour.

881a6320fdb16eb5318c5054f31c218aec2b324c is the commit `@master` resolves
to today, which is also tagged v1.3.0, so this changes nothing about what
runs now — it just fixes the version in place. The trailing `# v1.3.0`
comment keeps the human-readable version visible for future updates.

This mirrors GitHub's own hardening guidance for third-party actions.
2026-07-14 10:53:57 +03:00
PiexlMax(奇淼 4445d0e583 Merge pull request #2225 from estel-li/codex/fix-select-image-max-update-count
fix: respect SelectImage maxUpdateCount in media library
2026-06-30 17:34:09 +08:00
PiexlMax(奇淼 e04452c99e Merge pull request #2218 from AbbyJL/codex/fix-db-migrate-exit-code-clean
gorm.go: fix migrate failure exit code
2026-06-30 17:33:42 +08:00
李觉 06f859c13a fix select image max update count 2026-06-30 17:28:00 +08:00
PiexlMax(奇淼 87f6838a08 Merge pull request #2219 from 1220lanxi-glitch/main
fix:MCP生成代码创建字典失败bug
2026-06-30 15:42:28 +08:00
lanxi 463f6b7dfe fix:MCP生成代码创建字典失败bug 2026-06-16 13:46:37 +08:00
PiexlMax(奇淼 7d3f0c7564 clear: 清理对用户无意义的ai记忆 2026-06-15 10:35:05 +08:00
PiexlMax(奇淼 086fbdae04 clear: 清理无用的docs文件 2026-06-15 10:33:17 +08:00
Codex 07f1beb4b3 gorm.go: fix migrate failure exit code 2026-06-08 16:08:08 +08:00
PiexlMax(奇淼 78b3bd0c67 docs: 更新README.md,简化章节标题和图片描述 2026-05-28 11:43:04 +08:00
PiexlMax(奇淼 53e72c9660 Merge branch 'main' of github.com:flipped-aurora/gin-vue-admin 2026-05-28 11:42:36 +08:00
PiexlMax(奇淼andCopilot a333332e6c docs: 更新README.md,优化格式和内容,增加文档可读性
Co-authored-by: Copilot <copilot@github.com>
2026-05-28 11:41:43 +08:00
PiexlMax(奇淼 d1e6d9c642 Update README.md 2026-05-28 11:34:43 +08:00
PiexlMax(奇淼 7c8b623ab2 Update README.md 2026-05-28 10:46:00 +08:00
Zmzblink e4b76383ef Preload Authorities when fetching user by ID (#2215)
修复多角色时,签发其他角色token失败的问题
2026-05-28 09:31:56 +08:00
PiexlMax(奇淼 cdfd2a1901 docs: 更新许可证信息为BSL 1.1,明确非商用和商用使用要求 2026-05-28 09:29:41 +08:00
PiexlMax(奇淼 03f4daf5d2 docs: add BSL migration design 2026-05-27 16:13:43 +08:00
PiexlMax(奇淼 0094f677a1 fix: 更新记忆管理规则,确保长期记忆与业务记忆独立维护 2026-05-26 13:52:29 +08:00
PiexlMax(奇淼 3fda90acac Merge branch 'main' of github.com:flipped-aurora/gin-vue-admin 2026-05-26 12:32:19 +08:00
Robert SilénandCursor ee2de98fab docs: mention MariaDB in README (zh) (#2213)
Note MySQL or MariaDB 5.7+ in the tech stack database line; the server
already detects MariaDB versions in basetypes.go.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-05-26 12:03:14 +08:00
PiexlMax(奇淼andCopilot fcb10a9b6e feat: 添加构建设置项检查脚本,优化主题样式变量
Co-authored-by: Copilot <copilot@github.com>
2026-05-26 12:01:38 +08:00
PiexlMax(奇淼 f4fa0b7a40 fix: 更新预览脚本以支持开发模式 2026-05-26 11:22:25 +08:00
PiexlMax(奇淼 e77e0603db fix: 更新 @vueuse/core 和 @vueuse/integrations 依赖版本 2026-05-26 11:21:55 +08:00
15e6e7685c update:发布2.9.2版本 (#2211)
* feat: 调整AI工作模式,更符合harness基准

* feat: 添加BusinessDB字段到PluginInitializeGorm结构体,并增加相关测试用例

* [middleware/jwt.go]: fix #2192 issues bug

* docs: add auto plugin design spec

* chore: ignore worktrees directory

* feat: 调整代码辅助能力至插件

* feat: 添加警告条组件,提示授权用户访问限制

* fix: 修正商业用途版权声明链接

* feat: 调整agent.md 更加节省token

* fix: 修改casbin版本为v3

* feat: 更新JSONMap和JSONSlice类型,优化GORM数据类型处理

* feat: 添加数据库就绪通知机制,优化插件注册流程

* feat: 重构API路径和描述,优化代码生成器和模板配置分组

* feat: 优化 person 页面的 css 作用域限制

* feat: 更新 vite 至 vite8

* 新增:MCP工具为指定URL的角色ID授权

* fix: 增加文件名合法性检查,拒绝包含非法字符的文件写入

* chore: 更新CI配置,升级Node.js和Go版本,调整checkout和setup动作版本

* feat: 为数据库连接增加最大复用时间配置

* feat: 为各数据库连接配置增加最大连接生命周期设置

* feat: 更新插件注册逻辑并优化API和菜单组件的标签显示

* feat: 更新版本号至v2.9.2并添加新插件路径信息

---------

Co-authored-by: taincheng <zhangtc@gmail.com>
Co-authored-by: Azir-11 <2075125282@qq.com>
Co-authored-by: lanxi <1220lanxi@gmail.com>
2026-05-11 13:48:18 +08:00
PiexlMax(奇淼 699817becc Merge pull request #2204 from Azir-11/main
feat: 提高对深色主题的适配
2026-05-05 15:44:54 +08:00
Azir-11 fbd742ae03 feat: 提高对深色主题的适配 2026-04-30 14:20:05 +08:00
pixelmaxQM 0025a1a002 fix: 修正商业用途版权声明链接 2026-04-28 14:25:04 +08:00
pixelmaxQM 36c7f0bdd7 feat: 添加警告条组件,提示授权用户访问限制 2026-04-26 11:22:16 +08:00
pixelmaxQM 51b4ea284e feat: 添加获取 MCP 路由列表的接口 2026-04-16 10:08:21 +08:00
pixelmaxQM 60c1ec12b9 feat: 添加获取和设置API及菜单关联角色的接口 2026-04-16 10:05:11 +08:00
pixelmaxQM 61a3f8297c feat: 更新版本号至v2.9.1 2026-03-27 05:46:07 +01:00
PiexlMax(奇淼 375b21c222 发布2.9.1版本 (#2189)
* feat: mcp能力调整为 streamhttp的独立服务 不再依赖gva本体

* feat: 增加MCP启动能力,增加AI工作流需求整理能力。

* feat: 增加需求梳理能力

* feat: 清理无用日志

* feat: 移除无用的Dify Chatflow文本和代码生成器按钮
2026-03-27 12:14:13 +08:00
pixelmaxQM 324aaa3057 feat: 优化图片路径处理,使用getUrl函数替代硬编码路径 2026-03-21 07:32:55 +01:00
pixelmaxQM 24c2013caf feat: 修复错误的预览路径 2026-03-21 05:43:06 +01:00
pixelmaxQM 708a568427 feat:修复自动化代码导致注释位置错乱的bug 2026-03-21 05:25:17 +01:00
PiexlMax(奇淼 a75ab546ee Update README.md 2026-03-10 22:22:10 +08:00
PiexlMax(奇淼 f8c40b5b21 Update README.md 2026-03-10 22:21:21 +08:00
pixelmaxQM 98ccdc6295 feat: 更新版本号至2.9.0 2026-03-09 03:47:30 +01:00
PiexlMax(奇淼 d143b326b4 v2.9.0Beta版本发布
- 优化了AI规则,更利于大家规范化使用VibeCoding
- skills增加了在线板块,可以直接下载在线的skills。
- skill增加了一键打包能力
- 角色页面可以把角色可以直接分配给用户
- 菜单页面可以直接把菜单分配给角色
- API页面可以直接把API分配给角色
- 升级了AWS S3的版本
- 修复了富文本组件样式缺失的bug
- dashboard页面样式调整
- 优化了插件市场的UI,增加了分享和点赞能力
- 优化了vite环境变量的使用规则
2026-03-06 18:14:46 +08:00
piexlMax(奇淼 556b4431a2 fix: 修复获取x-token的方式,确保正确获取用户token 2026-02-10 16:15:40 +08:00
piexlMax(奇淼 9fea067931 feat: 更新富文本编辑器样式和结构,增强可读性 2026-02-10 11:44:10 +08:00
piexlMax(奇淼 fa9957c43c feat: 调整自动化插件的注册逻辑 2026-02-05 14:08:13 +08:00
piexlMax(奇淼 00224efd24 fix: 字典搜索bug 2026-02-05 13:50:33 +08:00
piexlMax(奇淼 506c9ea7a6 feat: 自动生成插件不再添加到注册功能 2026-02-05 13:44:26 +08:00
piexlMax(奇淼 05872354b8 feat: 补充丢失的自动迁移结构 2026-02-04 13:49:24 +08:00
piexlMax(奇淼 b71cc443c0 refactor: 调整ai工具rules 2026-02-03 10:18:34 +08:00
piexlMax(奇淼 1317e9504e feat: 增加技能配置界面的填写指引和模板功能 2026-02-02 18:06:19 +08:00
piexlMax(奇淼 670aff79cc feat: 增加技能参考和模板的创建、获取及保存功能 2026-02-02 18:06:11 +08:00
pixelmaxQM 52cd5e72ab feat: 更新版本号至v2.8.9 2026-02-01 23:42:20 +08:00
pixelmaxQM 68d6d3660b feat: 更新版本号至2.8.9 2026-02-01 22:26:03 +08:00
876017115c feat:发布2.8.9版本 (#2175)
* feat: ai相关调用调整

* feat: ai请求模式变更

* feat: ai自动化完善

* feat: 添加环境变量支持,条件渲染开发环境特定元素

* feat: 2.5版本插件,不再冗余进主项目,可以做到完全自动安装。

* feat: 添加插件管理功能,包括获取插件列表和删除插件的API接口

* feat: 同步测试插件的id调整

* feat: 增加插件相关初始化api

* feat: 增加登录日志

* feat: 增加签发token功能

* feat: 更安全的目录清理功能,确保仅在无Go文件时删除目录

* feat: 增加skills定义能力

* feat: 优化技能管理界面,增强用户体验和视觉效果

* feat: 更新授权链接,确保用户获取最新的授权信息

* feat: 修改技能定义器名称为“Skills管理”,并重命名文件为sys_skills.go

* feat: 增加全局约束的获取和保存功能,更新相关API和前端实现

* feat: 增加skills全局约束管理

* feat: 添加 vite-check-multiple-dom 插件,支持路由多根检测 (#2173)

---------

Co-authored-by: piexlMax(奇淼 <qimiaojiangjizhao@gmail.com>
Co-authored-by: Azir-11 <2075125282@qq.com>
Co-authored-by: 青菜白玉汤 <79054161+Azir-11@users.noreply.github.com>
2026-01-30 14:33:57 +08:00
piexlMax(奇淼 755373468c feat: 为mcp增加字段示例 2026-01-16 16:19:22 +08:00
piexlMax(奇淼 d2e64e618e fix: 重新实现组件缓存处理逻辑 2026-01-12 15:27:41 +08:00
piexlMax(奇淼 fd2a6f45fd fixed: 增加错误设置首页的补救措施 2026-01-12 15:11:59 +08:00
2242f5d6e1 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(奇淼 <qimiaojiangjizhao@gmail.com>
Co-authored-by: Yexk_M <yexk@yexk.cn>
Co-authored-by: Azir-11 <2075125282@qq.com>
2026-01-11 14:41:19 +08:00
PiexlMax(奇淼 567a8eb9bb fixed: 文件句柄泄露问题
文件句柄泄露问题
2026-01-11 14:34:21 +08:00
PiexlMax(奇淼 2ebeec8765 fixed: MD5 碰撞可能导致不同内容被误判为同一文件
MD5 碰撞可能导致不同内容被误判为同一文件
2026-01-11 14:33:47 +08:00
wike2019 70ee13e10c 文件句柄泄露问题 2026-01-11 13:13:59 +08:00
wike2019 ed65e31cd8 MD5 碰撞可能导致不同内容被误判为同一文件 2026-01-11 13:11:38 +08:00
PiexlMax(奇淼 f693f29326 feat: 优化unzip逻辑
io.Copy 后立即调用 Unzip,但 out 由 defer 关闭,可能在解压时尚未关闭
2026-01-11 12:40:34 +08:00
wike2019 2fda961643 io.Copy 后立即调用 Unzip,但 out 由 defer 关闭,可能在解压时尚未关闭 2026-01-10 16:00:10 +08:00
PiexlMax(奇淼 fd9883e035 Merge pull request #2158 from wike2019/pr/fix-cutter
fix bug 当日志文件删除失败时不阻塞日志写入
2026-01-06 11:18:58 +08:00
wike2019 f41f068b8b fix bug 当日志文件删除失败时不阻塞日志写入 2026-01-05 22:18:41 +08:00
PiexlMax(奇淼 799f411c73 Merge pull request #2150 from zayn-code/user-dialog
用户管理的侧边栏优化体验
2026-01-04 11:45:10 +08:00
PiexlMax(奇淼 97e7be9d3c Merge pull request #2157 from morya/main
FIX: code too complicated
2026-01-04 11:43:37 +08:00
morya 5cfe04e5f5 FIX: code too complicated 2026-01-03 23:56:05 +08:00
zayn 5f0d59a02b 其他页面都可以通过点击外层关闭侧边栏,用户界面不可以,养成习惯后体验不太好,故允许点击外层关闭侧边栏 2025-12-09 15:27:22 +08:00
pixelmaxQM 805f319578 fix: 优化文件上传时的数据库查询条件 2025-12-06 15:46:15 +08:00
piexlMax(奇淼 f23df92c18 feat: 调整获取logo的方式 2025-12-05 17:51:18 +08:00
piexlMax(奇淼 41d9453110 fix: 修复初始化没有创建SysError表的问题 2025-12-01 17:29:30 +08:00
piexlMax(奇淼 48d0cae58b Merge remote-tracking branch 'origin/main' 2025-12-01 17:26:55 +08:00
PiexlMax(奇淼 49af9439dc update: 2.8.7-beta发布
update: 2.8.7-beta发布
2025-12-01 17:21:02 +08:00
piexlMax(奇淼 1994497ad4 fix: 调整 gva-search-box 的内边距 2025-12-01 17:07:31 +08:00
piexlMax(奇淼 4ce191cdfa fix: 修复分片上传任意文件删除问题 2025-12-01 16:56:31 +08:00
piexlMax(奇淼 ee8d8d7e04 fix: 添加路径穿越拦截,禁止非法路径删除切片 2025-12-01 16:44:32 +08:00
PiexlMax(奇淼 cf022f492c Merge pull request #2146 from Azir-11/dev-287
添加全局组件大小配置和相关主题配置项,优化主题配置栏
2025-12-01 16:17:51 +08:00
piexlMax(奇淼 96019e8a9b feat: 版本号调整 2025-11-28 17:34:37 +08:00
piexlMax(奇淼 9ff1d4ca77 fix: 修复 vueDevTools 插件的缩进问题 2025-11-28 16:45:00 +08:00
Azir-11 8bc631ece9 feat: 重构优化系统配置相关 css 代码,优化了部分 UI 样式 2025-11-27 19:12:41 +08:00
Azir-11 0edb567ded feat: 添加全局组件大小配置和相关主题配置项 2025-11-27 18:40:22 +08:00
piexlMax(奇淼 d404fcf746 feat: 优化字典管理界面,增加按钮提示和调整按钮样式 2025-11-27 15:15:24 +08:00
piexlMax(奇淼 8af78e3af7 feat: 增加图片上传和粘贴识别功能,支持通过图片生成字典描述 2025-11-27 15:11:14 +08:00
piexlMax(奇淼 3722a8e7f3 feat: 增加AI生成字典功能,支持用户输入描述生成字典 2025-11-27 14:43:50 +08:00
piexlMax(奇淼 b86f7412d1 feat: 添加项目规则文档,详细描述功能、架构及开发规范 2025-11-27 14:04:13 +08:00
piexlMax(奇淼 ad52418f99 feat: 优化前端页面展示 2025-11-26 17:24:41 +08:00
piexlMax(奇淼 08ae44158f feat: 增加字典的json导出和导入 2025-11-26 16:40:48 +08:00
piexlMax(奇淼 a1f18e1386 feat: 增加字典的json导出和导入 2025-11-26 15:54:18 +08:00
PiexlMax(奇淼 c028ea3d15 Merge pull request #2145 from bypanghu/main
fix: 更新优化插件注册 api 和注册 menus 逻辑。
2025-11-24 18:34:54 +08:00
bypanghu f357c676bb fix: 更新优化插件注册 api 和注册 menus 逻辑。 2025-11-24 09:13:57 +08:00
piexlMax(奇淼 8022c662e0 fix(layout): 将Iframe路由名称更新为gvaLayoutIframe 2025-11-18 14:06:05 +08:00
piexlMax(奇淼 aa84605c4d fix(deps): 修复自动划代码字典查询条件失效问题 2025-11-17 17:49:50 +08:00
piexlMax(奇淼 287cb6ec9c feat: 优化error样式 2025-11-14 14:41:11 +08:00
piexlMax(奇淼 b9788e9b2a feat(错误日志): 添加异步处理错误日志功能 2025-11-12 18:02:50 +08:00
piexlMax(奇淼 a469ea23f4 refactor(zap): 重构日志信息格式以提高可读性 2025-11-11 18:21:14 +08:00
piexlMax(奇淼 c5f81d64c8 fix(错误处理): 统一前端错误类型显示为中文并优化错误详情布局 2025-11-11 18:18:23 +08:00
piexlMax(奇淼 78d135c6bf feat(日志): 增强日志功能以显示调用方源码 2025-11-11 18:11:32 +08:00
PiexlMax(奇淼 ff06aca146 Merge pull request #2138 from feitianbubu/pr/fix-cookie-duration
fix: correct cookie maxAge using seconds instead of minutes
2025-11-11 17:12:44 +08:00
PiexlMax(奇淼 849d5760da Merge pull request #2139 from feitianbubu/pr/fix-repeat-migrate-alter
fix: repeat alter gorm autoMigrate due to incorrect comments
2025-11-11 17:12:18 +08:00
piexlMax(奇淼 8cce9edbde feat(错误日志): 实现错误日志记录功能并修复拼写错误
添加错误日志记录功能,包括API、路由、服务和前端接口
修复sysError相关变量名的拼写错误
更新依赖版本至go 1.24
使用自定义Recovery中间件记录panic信息
添加zap日志钩子将错误日志写入数据库
2025-11-11 16:33:26 +08:00
piexlMax(奇淼 6bea7bc524 feat(导出模板): 添加SQL预览功能并优化模板展示界面 2025-11-10 11:05:03 +08:00
PiexlMax(奇淼 b6c0138dd2 feat: 统一配置命名 2025-11-09 16:15:22 +08:00
PiexlMax(奇淼 7658ff46c3 Update config.js 2025-11-09 16:10:40 +08:00
PiexlMax(奇淼 bd1aa1f559 Merge pull request #2140 from xue-ding-e/patch-7
bugfix:用户管理界面无法分配 / 查看角色
2025-11-09 16:09:29 +08:00
Qing Liang 27fb85f630 bugfix:用户管理界面无法分配 / 查看角色 2025-11-07 22:50:01 +08:00
feitianbubu 0be88bb442 fix: repeat alter gorm autoMigrate due to incorrect comments 2025-11-07 14:44:06 +08:00
feitianbubuandClaude a8642f4582 fix: correct cookie maxAge calculation by using seconds instead of minutes
The SetToken function expects maxAge in seconds (standard for HTTP cookies), but the code was incorrectly dividing by 60, causing cookies to expire 60 times faster than intended.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-07 10:54:11 +08:00
piexlMax(奇淼 5d67fc95d2 Merge branch 'main' into dev-287 2025-11-06 17:59:24 +08:00
piexlMax(奇淼 057ad2eeeb fix: 添加占位符字段防止json schema校验失败 2025-11-06 17:50:23 +08:00
piexlMax(奇淼 ca0a1250cd refactor(mcp): 修改execute定义 2025-11-06 17:50:23 +08:00
piexlMax(奇淼 6c82b34e8b fix: 添加占位符字段防止json schema校验失败 2025-11-06 17:43:09 +08:00
piexlMax(奇淼 fdc5e3cbf6 Merge branch 'dev-287' of github.com:flipped-aurora/gin-vue-admin into dev-287 2025-11-06 17:28:30 +08:00
piexlMax(奇淼 a0643d8ded refactor(mcp): 修改execute定义 2025-11-06 17:25:36 +08:00
PiexlMax(奇淼 83fb5d5921 Merge pull request #2107 from feitianbubu/pr/fix--dup-key-upload
feat: add check for existing file key before upload
2025-11-05 11:49:57 +08:00
PiexlMax(奇淼 a1070a64e7 Merge pull request #2132 from andrewbytecoder/main
fix(jwt):修正令牌过期时间计算错误
2025-11-03 13:28:47 +08:00
PiexlMax(奇淼 709cdef050 Merge pull request #2134 from frank-515/main
doc: 翻译了README-en.md 中的中文
2025-11-03 13:27:24 +08:00
PiexlMax(奇淼 c95ece3fe2 Merge pull request #2136 from Azir-11/dev-287
style(版本管理): 优化导出和导入版本抽屉的样式,支持暗色模式
2025-11-03 13:05:15 +08:00
Azir-11 d5befa1900 style(版本管理): 优化导出和导入版本抽屉的样式,支持暗色模式 2025-11-03 02:13:58 +08:00
frank515 89ea284cc6 doc: 翻译了README-en.md 中的中文 2025-10-30 21:46:10 +08:00
piexlMax(奇淼 ffe1844ba6 fix(mcp): 递归检查包文件夹中是否存在.go文件 2025-10-28 17:47:29 +08:00
piexlMax(奇淼 d36eeb5134 feat(错误日志): 实现前后端错误日志收集与管理功能 2025-10-28 16:19:25 +08:00
wangyazhou b9009bbd48 fix(jwt):修正令牌过期时间计算错误
- 调整了SetToken函数中的过期时间单位,从秒转换为分钟
- 确保新令牌的过期时间与配置保持一致- 修复了因时间单位不匹配导致的令牌提前失效问题
2025-10-28 15:14:26 +08:00
pixelmaxQM 5be32930f8 Merge branch 'main' of github.com:flipped-aurora/gin-vue-admin 2025-10-25 12:05:34 +08:00
pixelmaxQM 296c71290c fix(autocode): 修复插件包检测逻辑并清理无效数据库记录
改进插件包目录结构检测逻辑,当缺少必要目录时生成警告描述
添加清理数据库中不存在对应实体文件的包记录功能
2025-10-25 12:05:25 +08:00
PiexlMax(奇淼 2378971c8c Merge pull request #2129 from Azir-11/main
typo: 优化注释说明
2025-10-25 11:43:21 +08:00
piexlMax(奇淼 5a30df558c fix(登录): 修正验证码长度计算逻辑 2025-10-24 15:50:53 +08:00
青菜白玉汤 2c21f3cd75 typo: 优化注释说明 2025-10-24 10:52:16 +08:00
7d3e7b5b7a public:发布2.8.6版本 (#2126)
* feat(mcp): 新增gva_review工具并优化字典和代码生成逻辑

* fix: 调整mcp整体逻辑

* chore: 更新.gitignore,添加对本地配置文件的忽略

* feat(logo): 新增Logo组件并在多个页面中替换原有logo实现

* fix: 修复菜单 Logo 部分删除文本后显示异常的问题

* fix:添加字典列表搜索,支持中英文搜索.添加字典详情搜索

* style: 优化部分视觉样式

* feat: 增强错误预览组件的暗黑模式支持

* feat: 优化请求错误消息获取逻辑,增加状态文本优先级

* feat: 添加前端登录验证码静态验证逻辑

* feat: 添加开发环境启动脚本

* feat: 更新 SvgIcon 组件,支持本地图标和 Iconify 图标、移除未使用的 unocss 依赖

* fix:字典支持 tree 结构

* feat: 优化动态路由注册方式

* feat: 添加配置控制标签页keep-alive功能

* feat: 添加全局错误处理机制,捕获 Vue 和 JS 错误

* refactor: 移除API和菜单创建结果中的权限分配提醒,优化输出信息

* feat: 更新 reset.scss,优化全局样式重置,增强兼容性和可读性

* refactor(字典详情): 优化字典详情查询逻辑,移除预加载改为按需加载

* refactor(路由管理): 优化路由添加逻辑,增强路径处理和顶级路由注册

* refactor(系统配置): 将auto-migrate修改为disable-auto-migrate,保证用户升级的兼容性

* feat(utils): 优化字典数据递归查找功能并替换select为tree-select

* fix(deps): 修复在字段类型为file生成搜索条件无法运行的bug

* fix: 修复header的tools中icon不展示的问题

---------

Co-authored-by: piexlMax(奇淼 <qimiaojiangjizhao@gmail.com>
Co-authored-by: Azir-11 <2075125282@qq.com>
Co-authored-by: bypanghu <bypanghu@163.com>
Co-authored-by: feitianbubu <feitianbubu@qq.com>
Co-authored-by: 青菜白玉汤 <79054161+Azir-11@users.noreply.github.com>
Co-authored-by: krank <emosick@qq.com>
2025-10-19 13:27:48 +08:00
PiexlMax(奇淼 b01b27f1eb Merge pull request #2111 from zayn-code/dict
修复字典值分页bug
2025-10-09 13:59:00 +08:00
zayn d40b1ba823 修复字典值分页bug
当字典值有多页,且sort值一样时,分页返回的数据有问题,导致有些数据一直加载不出来
2025-09-30 16:38:55 +08:00
piexlMax(奇淼 a1dfc360fc feat(路由): 添加配置控制标签页keep-alive功能 2025-09-30 13:46:33 +08:00
青菜白玉汤 6da17433f2 优化动态路由注册方式
feat: 优化动态路由注册方式
2025-09-30 13:29:12 +08:00
feitianbubu 32f21d8555 feat: add check for existing file key before upload 2025-09-30 12:59:26 +08:00
PiexlMax(奇淼 c59a0504ad Merge pull request #2095 from xue-ding-e/patch-6
Update response.go
2025-09-21 17:32:07 +08:00
Qing Liang 182af9a1b6 Update response.go
删除多余注释
2025-09-11 11:20:52 +08:00
piexlMax(奇淼 424c5b23b4 style(layout): 修复绝对定位类名缺少重要修饰符的问题 2025-09-09 11:18:11 +08:00
piexlMax(奇淼 86b420ce67 docs: 更新项目规则文档和调整代码格式 2025-09-08 10:54:44 +08:00
piexlMax(奇淼 ea5709e5b6 style(菜单组件): 调整级联选择器宽度样式为全宽 2025-09-08 10:51:13 +08:00
PiexlMax(奇淼 4e9e3570ed fix: VersionData数据类型改为text 2025-09-07 23:58:05 +08:00
pixelmaxQM 78cdc287c5 docs: 更新项目规则文档中的角色描述为全栈专家 2025-09-07 12:46:59 +08:00
piexlMax(奇淼 58b123d316 fix: VersionData 默认使用text 考虑兼容性 2025-09-05 17:38:46 +08:00
piexlMax(奇淼 fb199aeedc fix: 修复多出来的一个/ 2025-09-04 15:16:31 +08:00
piexlMax(奇淼 364dddb70a Merge branch 'main' of github.com:flipped-aurora/gin-vue-admin 2025-09-03 16:32:46 +08:00
piexlMax(奇淼 6bf848d53f style: 统一使用!前缀替代方括号的宽度类名
修改模板文件中的宽度类名,从w-[380px]和w-40统一改为!w-380px和!w-40
修复模板中条件判断的语法格式问题
2025-09-03 16:29:52 +08:00
青菜白玉汤 3e429f4091 feat: 增加依赖,提高 unocss 相关兼容性 (#2088)
* fix: 补充部分运行时依赖

* optimize: 优化class mark.
2025-09-02 15:03:48 +08:00
piexlMax(奇淼 daabca4768 Merge branch 'main' of github.com:flipped-aurora/gin-vue-admin 2025-09-01 15:19:22 +08:00
piexlMax(奇淼 9e688c65d3 fix(richtext): 为富文本编辑器上传图片添加token认证头
添加用户token到图片上传请求头中,确保有权限的用户才能上传文件
2025-09-01 15:17:58 +08:00
pixelmaxQM 2e8f5870d8 refactor(model): 调整版本数据字段的数据库类型注释
为VersionData字段添加postgres和sqlite数据库特定的类型注释,提高跨数据库兼容性
2025-08-31 00:16:32 +08:00
Qing Liang 8b0a00b98a Update project_rules.md (#2083) 2025-08-29 11:44:59 +08:00
piexlMax(奇淼 1ce3e11d52 fix(selectFile): 修复未初始化时fileList为undefined的问题 2025-08-28 15:34:35 +08:00
piexlMax(奇淼 11aa8c5cc2 feat(version): 添加字典数据支持到版本管理功能 2025-08-28 15:11:52 +08:00
piexlMax(奇淼 d8e6f2f5f4 fix: 同步 go.mod 2025-08-28 13:58:29 +08:00
piexlMax(奇淼 9d5c93b4c3 refactor(version): 统一版本号管理并更新至v2.8.5
将版本号从硬编码改为统一管理,使用package.json和全局变量维护版本信息
2025-08-28 13:51:54 +08:00
Qing Liang 2f7f3e5ac6 other:注释 重置用户密码 (#2081) 2025-08-28 13:37:04 +08:00
PiexlMax(奇淼 cb97d3832d Merge pull request #2080 from flipped-aurora/v2.8.5
发布v2.8.5 beta 版本
2025-08-28 11:45:01 +08:00
piexlMax(奇淼 dd34d6e3be fix: mcp字段统一样式限制 2025-08-26 18:43:55 +08:00
PiexlMax(奇淼 1d700ad5b6 Update README.md 2025-08-19 18:26:17 +08:00
PiexlMax(奇淼 3648df9522 Merge pull request #2070 from dzwvip/main
修改gorm-oracle的驱动包为go-ora,不再依赖cgo和oracle instant  client
2025-08-14 15:33:51 +08:00
dzwvip eb2925829f 修改gorm-oracle的驱动包为go-ora,不再依赖cgo和oracle client 2025-08-12 15:05:38 +08:00
piexlMax(奇淼 1e3c968277 refactor(mcp): 更新默认值描述并移除无用工具 2025-08-11 10:52:15 +08:00
piexlMax(奇淼 339db778c3 chore: 优化引入svg方式 2025-08-08 11:46:08 +08:00
piexlMax(奇淼 8b8ae7b692 refactor(auth): 简化权限指令中的类型检查逻辑 2025-08-07 16:18:04 +08:00
piexlMax(奇淼 52be26eb43 fix: 修正未配置默认路由时的错误提示信息 2025-08-06 15:55:38 +08:00
piexlMax(奇淼 9f958addc8 fix(verify): 移除登录验证中的Captcha字段校验
refactor(validation): 强制字段名首字母大写并更新文档
2025-08-06 15:18:03 +08:00
piexlMax(奇淼 7a69b88885 refactor(config): 更新配置文件格式并添加新配置项 2025-08-06 13:47:09 +08:00
pixelmaxQM 76fe71a8dd docs(mcp): 完善工具描述并添加重要限制说明 2025-08-05 20:35:12 +08:00
piexlMax(奇淼 3f21d7f8dd docs(mcp): 更新字段类型的支持说明文档 2025-08-05 18:56:57 +08:00
PiexlMax(奇淼 1fce169616 Merge pull request #2065 from flipped-aurora/2.8.5
支持多模块mcp,精细化api和menu的创建规则。
2025-08-05 18:43:21 +08:00
piexlMax(奇淼 0d900293eb docs: 更新文档中字段类型描述并优化工具说明
更新多个文档和工具描述文件,统一字段类型的详细说明格式
优化菜单创建工具和API创建工具的描述,明确使用场景
补充执行计划schema中字段类型的详细说明

(cherry picked from commit d9448aa25cca717e01a00aec2c38a24da7b28f6f)
2025-08-05 18:39:13 +08:00
piexlMax(奇淼 b71ad7b6f4 docs(mcp): 完善模块关联配置的文档和示例
(cherry picked from commit e042d0464c47ab8441f363df1a1242e26a9c13f7)
2025-08-05 18:39:13 +08:00
PiexlMax(奇淼 2139e38147 refactor: optimize and simplify login captcha validation flow (#2063)
* Optimize captcha related fields verification

- Add `Captcha` field validation to `LoginVerify` rules, ensuring that the captcha isn't empty while prechecking the data.
- Remove redundant checks for empty values for `Captcha` and `CaptchaId`, as they are already validated in the `LoginVerify` struct.
- Move client IP key retrieval after input validation for better flow.

* refactor: simplify login captcha validation flow for cleaner code
2025-08-04 18:35:28 +08:00
Feng.YJ a033ab9abe refactor: simplify login captcha validation flow for cleaner code 2025-08-04 13:43:03 +08:00
Feng.YJ 311e1ddb9f Optimize captcha related fields verification
- Add `Captcha` field validation to `LoginVerify` rules, ensuring that the captcha isn't empty while prechecking the data.
- Remove redundant checks for empty values for `Captcha` and `CaptchaId`, as they are already validated in the `LoginVerify` struct.
- Move client IP key retrieval after input validation for better flow.
2025-08-04 13:39:51 +08:00
pixelmaxQM 31e6316916 feat(mcp): 实现需求分析工具并支持批量创建模块
1. 新增requirement_analyzer工具,用于将用户需求转换为结构化提示词
2. 修改gva_auto_generate工具支持批量创建多个模块
3. 更新文档示例和schema以反映批量创建功能
4. 优化执行计划验证逻辑,支持模块数组校验
5. 改进字典创建流程,避免重复创建相同字典类型
2025-08-03 23:58:47 +08:00
PiexlMax(奇淼 9260111312 Update README.md 2025-08-01 13:31:50 +08:00
PiexlMax(奇淼andpiexlMax(奇淼 877f8f4fcf feat(autoCode): 添加空包检测与自动清理功能 (#2061)
refactor(analyzer): 重构模块分析逻辑,增加空包检测

Co-authored-by: piexlMax(奇淼 <qimiaojiangjizhao@gmail.com>
2025-08-01 13:22:40 +08:00
273d7bd50e V2.8.4Beta 极致融合AI编辑器 让开发速度更进一步 (#2060)
* fix(style): 修复 border 额外的 reset 导致 tailwind border 属性生效异常的问题

* feat: 添加错误预览组件并优化请求错误处理逻辑

* optimize: select and update necessary fields in `ChangePassword` method

- Simplify `ChangePassword` method signature by removing unnecessary return type.
- Use `Select()` to fetch only the necessary fields (`id` and `password`) from the database.
- Replace `Save()` with `Update()` for more efficient password update operation.

Note: use `Save(&user)` to update the whole user record, which will cover other unchanged fields as well, causing data inconsistency when data race conditions.

* feat(menu): 版本更新为2.8.4,给菜单增加按钮和参数的预制打包

* feat(menu): 恢复空白的配置文件

* Remove unused `SideMode` field from `ChangeUserInfo` struct

Remove unused and deprecated `SideMode` field from user request model.

* feat(automation): 增加可以自动生成CURD和续写方法的MCP

* fix(mcp): 确保始终返回目录结构信息

* fix(mcp): 当不需要创建模块时提前返回目录结构信息

* feat(automation): 增加可以自动生成CURD和续写方法的MCP

* feat(mcp): 添加GAG工具用户确认流程和自动字典创建功能

实现三步工作流程:分析、确认、执行
新增自动字典创建功能,当字段使用字典类型时自动检查并创建字典
添加用户确认机制,确保创建操作前获得用户明确确认

* feat(version): 新增版本管理功能,支持创建、导入、导出和下载版本数据

新增版本管理模块,包含以下功能:
1. 版本数据的增删改查
2. 版本创建功能,可选择关联菜单和API
3. 版本导入导出功能
4. 版本JSON数据下载
5. 相关前端页面和接口实现

* refactor(version): 简化版本管理删除逻辑并移除无用字段

移除版本管理中的状态、创建者、更新者和删除者字段
简化删除和批量删除方法的实现,去除事务和用户ID参数
更新自动生成配置的默认值说明

* feat(版本管理): 新增版本管理功能模块

* fix(menu): 修复递归创建菜单时关联数据未正确处理的问题

* feat(mcp): 添加预设计模块扫描功能以支持代码自动生成

在自动化模块分析器中添加对预设计模块的扫描功能,包括:
- 新增PredesignedModuleInfo结构体存储模块信息
- 实现scanPredesignedModules方法扫描plugin和model目录
- 在分析响应中添加predesignedModules字段
- 更新帮助文档说明预设计模块的使用方式

这些修改使系统能够识别并利用现有的预设计模块,提高代码生成效率并减少重复工作。

* feat(mcp): 新增API、菜单和字典生成工具并优化自动生成模块

* docs(mcp): 更新菜单和API创建工具的描述信息

* feat(mcp): 添加字典查询工具用于AI生成逻辑时了解可用字典选项

* feat: 在创建菜单/API/模块结果中添加权限分配提醒

为菜单创建、API创建和模块创建的结果消息添加权限分配提醒,帮助用户了解后续需要进行的权限配置步骤

* refactor(mcp): 统一使用WithBoolean替换WithBool并优化错误处理

* docs(mcp): 更新API创建工具的说明和错误处理日志

* feat(mcp): 添加插件意图检测功能并增强验证逻辑

---------

Co-authored-by: Azir <2075125282@qq.com>
Co-authored-by: Feng.YJ <jxfengyijie@gmail.com>
Co-authored-by: piexlMax(奇淼 <qimiaojiangjizhao@gmail.com>
2025-07-31 21:21:04 +08:00
PiexlMax(奇淼 39abc7b632 Update README.md 2025-07-16 14:46:50 +08:00
piexlMax(奇淼 e19ddf6600 public: 发布2.8.3版本 2025-07-15 18:22:04 +08:00
piexlMax(奇淼 9db3bcfac5 Merge branch 'main' of github.com:flipped-aurora/gin-vue-admin 2025-07-15 10:48:53 +08:00
piexlMax(奇淼 a6b6b5d4aa fix: 修正变量名拼写错误,将detailFrom统一改为detailForm 2025-07-15 10:45:58 +08:00
pixelmaxQM 23f9227da1 fix(table): 修复日期列的模板语法错误,确保正确渲染创建日期 2025-07-11 00:20:29 +08:00
pixelmaxQM 857ba194e5 fix(menu): 更新成功消息提示,添加角色管理页面权限分配说明;优化菜单添加逻辑,增加父菜单存在性和权限检查 2025-07-11 00:14:14 +08:00
pixelmaxQM 6e27e3a114 fix(menus): 在设置首页菜单以后保存当前菜单结构,防止把无权限菜单设置为首页导致系统死锁 2025-07-10 23:36:27 +08:00
piexlMax(奇淼 d5b4bbfa84 fix(autoCode): 删除不必要的路由参数监听 2025-07-10 16:11:51 +08:00
piexlMax(奇淼 72ee8fb6fc fix(router): 修复路由keep-alive逻辑并添加组件名称 2025-07-10 14:52:59 +08:00
gorsandPiexlMax(奇淼 2ec2e9a66e Update service.go.tpl (#2053)
fix 排序时错误获取失败:错误: 字段 "createdat" 不存在 (SQLSTATE 42703)

---------

Co-authored-by: PiexlMax(奇淼 <165128580+pixelmaxQm@users.noreply.github.com>
2025-07-03 13:19:44 +08:00
piexlMax(奇淼 bf095c38e9 fix(service): 表格排序ID变为小写 2025-07-03 11:50:14 +08:00
piexlMax(奇淼 cee3b54b4c fix(loading): 修复loading状态管理问题并添加超时处理 2025-07-03 11:42:39 +08:00
piexlMax(奇淼 ff7e002049 fix: 修复richtext的情况下gorm标签多一个"的bug 2025-07-02 10:36:50 +08:00
zayn a1c8f6bc55 逻辑错误调整 (#2052) 2025-06-30 16:04:18 +08:00
青菜白玉汤andPiexlMax(奇淼 ca24945af6 feat: 重构设置界面,添加主题模式、颜色选择和布局配置模块,移除冗余组件 (#2050)
* feat: 重构设置界面,添加主题模式、颜色选择和布局配置模块,移除冗余组件

---------

Co-authored-by: PiexlMax(奇淼 <165128580+pixelmaxQm@users.noreply.github.com>
2025-06-29 13:27:12 +08:00
我看谁不卷 ea7455e092 fix:修复查询条件无法添加问题 (#2047) 2025-06-28 22:30:45 +08:00
Joy a5e1170af0 web/src/utils/request.js: Fix Server 返回非 JSON 响应数据时导致错误弹窗 (#2049) 2025-06-28 22:29:02 +08:00
pixelmaxQM 44751357b4 feat: 添加超时中间件以处理请求超时 2025-06-28 17:45:53 +08:00
zayn e58d40ab83 头部导航栏里的菜单无法正常渲染出来的bug (#2046)
菜单循环中没有子菜单就直接返回,没有添加到arr列表中导致arr始终是空的
2025-06-20 13:36:43 +08:00
piexlMax(奇淼 f7c3d76d37 feat(菜单管理): 重构菜单表单界面并更新element-plus依赖 2025-06-19 15:33:05 +08:00
hzbnb~ 55bf69c810 fix: 修复不小心选择业务库后想删掉的问题 (#2042) 2025-06-12 13:13:02 +08:00
Shan Chenyu b4232a8f27 更新 captcha.go 注释拼写错误 (#2043) 2025-06-12 13:12:28 +08:00
Hu Haolong 8d6dcc6b07 sys_authority.go: Fix a potential nil pointer dereference in GetParentAuthorityID (#2044) 2025-06-12 13:12:08 +08:00
piexlMax(奇淼 e3a57bdc69 update: 同步go.sum 2025-06-11 15:42:16 +08:00
piexlMax(奇淼 0eee6a3cc2 update: 升级mcp-go依赖至v0.31.0 2025-06-10 10:54:06 +08:00
计乐心 174721bc55 新增支持LoginAuth认证方式适用于IBM、微软等部分邮箱服务 (#2041) 2025-06-05 11:31:25 +08:00
OPSTime ba63bf2371 修正导出execl中数字为文本类型问题 (#2039) 2025-06-05 11:29:35 +08:00
hzbnb~ 2f07e9271f fix: 修复在多库模式下生成代码时候用默认库用错的情况 (#2038) 2025-06-05 11:19:30 +08:00
shabby2333 3e9602ff7e fix: #2030 富文本编辑器全屏时部分内容会被其他表单项遮挡 (#2040) 2025-06-05 11:08:28 +08:00
K8sCat 30763b48de db_list.go: 移除不必要的case判断 (#2036) 2025-06-05 11:06:17 +08:00
bossa c3b75933b8 系统生成文件,当需要手动实现增加TODO标识 (#2037) 2025-06-05 11:05:29 +08:00
PiexlMax(奇淼 ff08d45f25 Revert "修正导出数字为文本格式问题 (#2033)" (#2034)
This reverts commit b916c7951b.
2025-05-28 17:15:39 +08:00
hzbnb~ be0e4e97f7 feat: 添加暂存成功提醒 (#2031) 2025-05-28 15:49:45 +08:00
OPSTimeandCai Meng 蔡猛 b916c7951b 修正导出数字为文本格式问题 (#2033)
Co-authored-by: Cai Meng 蔡猛 <caimeng@wisers.com>
2025-05-28 15:49:28 +08:00
piexlMax(奇淼 0ebb3d4195 update: 更新MCP为0.29.0,并且调节对应的方法。 2025-05-22 16:10:47 +08:00
piexlMax(奇淼 e7680c43ac fix: 处理SQL条件中IN和NOT IN操作符的格式化问题
在生成SQL查询条件时,当操作符为IN或NOT IN时,未正确格式化SQL语句。现已修复此问题,确保生成的SQL语句符合预期格式。
2025-05-21 17:41:54 +08:00
piexlMax(奇淼 2f80eaaf9c fix(exportTemplate): 添加IN和NOT IN操作符并修复参数解析问题
在导出模板功能中添加IN和NOT IN操作符,以支持更复杂的查询条件。同时修复了参数解析逻辑,确保从params参数中正确提取过滤条件、分页和排序等参数,避免直接使用values导致的解析错误。
2025-05-21 17:11:23 +08:00
hang666 2dfe9d7f4b fix: 修复代码生成中时间和富文本的搜索错误 (#2028)
* fix: 修复代码生成中时间和富文本的搜索错误
2025-05-19 15:30:27 +08:00
piexlMax(奇淼 cbc504cc0b fix(用户模块): 修正清理存储逻辑以正确删除cookie和localStorage项 2025-05-19 14:43:05 +08:00
piexlMax(奇淼 99550cbc37 feat: 图片选择功能增加拖拽 2025-05-19 13:58:20 +08:00
pixelmaxQM 4a53864738 fix:调整自动化MCP Tools模板 2025-05-18 11:45:36 +08:00
PiexlMax(奇淼andhang666 b731b9df78 fix: 修正搜索时间范围传入ISO8601字符串导致MySQL查询出错,并优化nil切片len检查(S1009) (#2027)
* fix: 修正搜索时间范围传入ISO8601字符串导致MySQL查询出错,并优化nil切片len检查(S1009) (#2026)

* fix:时间范围修改接受参数

---------

Co-authored-by: hang666 <44329474+hang666@users.noreply.github.com>
2025-05-17 15:41:37 +08:00
piexlMax(奇淼 1f3a8ea2eb feat: 不再对查询条件时间范围进行检测 2025-05-15 18:42:58 +08:00
piexlMax(奇淼 2bd82ead97 refactor(搜索功能): 优化时间范围搜索逻辑,使用createdAtRange替代startCreatedAt和endCreatedAt
将时间范围搜索逻辑从`startCreatedAt`和`endCreatedAt`改为`createdAtRange`,简化代码并提高可维护性。同时更新了相关模板文件和验证规则,确保前后端一致性和用户体验的连贯性。
2025-05-15 18:40:57 +08:00
piexlMax(奇淼 9f1f72fce5 update: 修正前端版本号 2025-05-14 16:25:57 +08:00
piexlMax(奇淼 38ed8bb399 feat: 删除多余的服务初始化 2025-05-14 14:36:43 +08:00
piexlMax(奇淼 2d98fdf321 feat: tool卡片页面优化 2025-05-14 12:47:59 +08:00
piexlMax(奇淼 214e108591 feat(mcpTest): 添加复制MCP配置功能 2025-05-14 12:41:52 +08:00
piexlMax(奇淼 b197a84ef7 feat:提交并优化mcp配置 2025-05-14 12:39:20 +08:00
piexlMax(奇淼 09603c436e feat: 增加 mcp Tools 自动测试工具 2025-05-14 10:51:52 +08:00
pixelmaxQM d4c883535b fix:mcp tools 编译不通过的bug 2025-05-13 21:58:21 +08:00
6323688fca 发布dev2.8.2版本 (#2025)
* refactor(server): 重构服务器启动和重载逻辑

将服务器启动和重载逻辑进行重构,提取初始化系统为单独函数,优化代码结构。删除冗余的服务器初始化文件,统一使用新的 `server_run.go` 实现优雅关闭和重载功能。同时,将“重启服务”改为“重载服务”以更准确地描述功能。

* refactor: 重构系统事件处理、JWT和Casbin相关逻辑

- 将系统重载逻辑提取到独立的`system_events.go`文件中,并引入全局事件管理器
- 将JWT相关操作从`service`层移动到`utils`层,减少服务层依赖
- 将Casbin实例管理逻辑提取到`utils`层,统一管理Casbin实例的初始化和获取
- 删除冗余的`CreateSysOperationRecord`方法,优化操作记录中间件逻辑

* refactor(server): 重构服务初始化和关闭逻辑

将 `RunServer` 函数重命名为 `initServer`,并调整其调用方式以简化代码。同时,在系统初始化时添加 `SetupHandlers` 函数以注册全局处理函数,提升代码可维护性。

* fix: 修复自动化代码enum查询条件的bug

* fix: 修复组合模式下,顶部菜单重复bug

* refactor: 修改名称 RunWindowsServer ==> RunServer

* 新增mcp

* feat: 支持mcp服务

* feat:调整mcp结构,增加客户端和测试用例

* feat:更换mcp基础包和结构

* feat:提交客户端工具测试用例

* feat: 增加自动创建 mcp Tool模板 功能

* fix: 增加默认值属性

* feat: 调整初始化menu的逻辑

* feat: 调整初始config.yaml

* feat: 增加全局GVA_MCP_SERVER属性,方便灵活化开发。

* feat: 优化自动化mcp逻辑和成功展示

* feat: 优化mcp tool nickname工具

* feat: 发布2.8.2 Beta版本

---------

Co-authored-by: piexlMax(奇淼 <qimiaojiangjizhao@gmail.com>
Co-authored-by: Gor-c <creup@outlook.com>
Co-authored-by: QIN xiansheng <sjjlnaps@163.com>
2025-05-13 19:24:54 +08:00
PiexlMax(奇淼 7a7c811311 Update README.md 2025-05-13 19:22:50 +08:00
Shinji-Li 81e178b267 docs: update a new contributions charts (#2024) 2025-05-13 19:21:58 +08:00
PiexlMax(奇淼 70c9a715d4 Update README.md 2025-05-07 16:03:32 +08:00
qSeisCloud 28bd6fef7e auto_code_plugin.go: update deprecated lib mholt/archiver/v4 to mholt/archives (#2023)
* update deprecated lib mholt/archiver/v4 to mholt/archives
2025-05-07 09:59:37 +08:00
pixelmaxQM 35e3f820c0 fix: 搜索条件增加array的特殊处理 2025-05-05 14:21:23 +08:00
piexlMax(奇淼 e847aa9e75 fix: 修复顶栏菜单重复出现的bug 2025-04-30 09:56:36 +08:00
pixelmaxQM fcfa55b39a feat: 修复自动化代码插件form引用模板错误的问题 2025-04-29 22:33:09 +08:00
qSeisCloud 8be390b2cf 修复表格标题行首尾空不匹配或多余的标题导致的SQL语句错误问题
修复表格标题行首尾空不匹配或多余的标题导致的SQL语句错误问题
2025-04-29 13:21:22 +08:00
Gor-c 3ad83cbcd6 fix: 修复组合模式下,顶部菜单重复bug 2025-04-29 11:16:17 +08:00
piexlMax(奇淼 41826f5e5c fix: 优化Windows服务器启动时Redis初始化逻辑 2025-04-28 15:38:36 +08:00
pixelmaxQM 0ccd6dc750 fix: 修复顶栏多出一个...的问题 2025-04-24 21:47:47 +08:00
pixelmaxQM 8c2ce8587d feat: 修复自动化代码的bug 2025-04-24 21:18:31 +08:00
pixelmaxQM 5e35fcea58 fix: 修复菜单无ICON的展示问题 2025-04-21 23:49:38 +08:00
pixelmaxQM 54595d46e5 fix: 修复顶栏模式bug和侧栏无图标的bug 2025-04-21 23:15:08 +08:00
piexlMax(奇淼 09cb29da17 feat: VITE_EDITOR 默认值 调整为 code 2025-04-21 18:19:03 +08:00
piexlMax(奇淼 ecf1b5bc56 fix: 修复自动化代码enum查询条件的bug 2025-04-21 15:08:05 +08:00
piexlMax(奇淼 da71231be9 Merge branch 'main' of github.com:flipped-aurora/gin-vue-admin 2025-04-18 11:43:19 +08:00
piexlMax(奇淼 63feecf4aa update: 发布2.8.1版本 2025-04-18 11:41:57 +08:00
a6255557ee 发布2.8.1 beta版本 (#2014)
AI: 增加了AI前端绘制功能,可以根据描述生成客户端页面【授权用户专属】

自动化: 自动化模板采用了function模式,更加方便用户二次开发和自定义改动

自动化: 默认携带ID和CreatedAt排序

自动化: 所有自动化Select模板默认支持select搜索

优化:http交互报错信息增加防止多次弹出错误遮罩机制

ICON: 优化ICON逻辑,防止多次加载svg

布局:增加侧边分栏模式
布局: 顶栏模式样式优化和高亮逻辑调整
优化: 个人配置不再需要手动点击保存,会根据变化自动保存

BUG: 修复了菜单点击设为主页勾选被取消的bug
安全: 更新了jwt版本,修复CVE-2025-30204
导出: 默认支持软删除过滤
代码: 优化了部分代码逻辑
本次更新需要重新执行 npm i

---------

Signed-off-by: joohwan <zhouhuan.chen@yunqutech.com >
Co-authored-by: huiyifyj <jxfengyijie@gmail.com>
Co-authored-by: piexlMax(奇淼 <qimiaojiangjizhao@gmail.com>
Co-authored-by: okppop <okppop@protonmail.com>
Co-authored-by: joohwan <zhouhuan.chen@yunqutech.com >
Co-authored-by: xuedinge <781408517@qq.com>
2025-04-18 11:40:03 +08:00
piexlMax(奇淼 84a3c3ba7c fix: 修复redirect跳转的bug 2025-04-15 18:01:01 +08:00
piexlMax(奇淼 90c8a240a1 Merge branch 'main' of github.com:flipped-aurora/gin-vue-admin 2025-04-15 16:46:09 +08:00
piexlMax(奇淼 07c694e24d fix: 修复点击分配按钮,勾选的菜单消失的bug 2025-04-15 16:43:22 +08:00
pixelmaxQM 7c1c392710 feat: 固定svg导入版本为1.1.0 2025-04-12 19:12:30 +08:00
piexlMax(奇淼 379f5fe841 Merge remote-tracking branch 'refs/remotes/origin/dev-281' 2025-04-09 09:51:04 +08:00
piexlMax(奇淼 0ab15cc5e2 feat: 模板方法抽离 不在模板中做逻辑 2025-04-08 18:48:39 +08:00
PiexlMax(奇淼 8f7a8a9e6d Update bug_report.yaml 2025-04-08 17:53:27 +08:00
PiexlMax(奇淼 d5dc42c71e Update feature_request.yaml 2025-04-08 17:53:09 +08:00
pixelmaxQM 6ae5b2384e feat: 增加默认AI绘制功能页面 2025-04-07 17:34:59 +08:00
pixelmaxQM 07c9e97bf5 feat: 增加复制功能 2025-04-07 17:31:31 +08:00
pixelmaxQM 5a53da62e3 feat: 调整AI基础路径 2025-04-07 17:25:09 +08:00
pixelmaxQM 11748da7a9 feat: 调整提示语 2025-04-07 17:20:53 +08:00
pixelmaxQM b0e15b86f5 Merge remote-tracking branch 'origin/main' into dev-281 2025-04-07 17:11:32 +08:00
pixelmaxQM 1d1ad23bc0 feat: 页面可以拖动选择 2025-04-07 17:08:20 +08:00
pixelmaxQM ac54446769 feat: 增加AI生成页面功能。 2025-04-07 17:03:24 +08:00
pixelmaxQM 5fe5caaf2b feat: 增加AI生成页面功能。 2025-04-07 17:03:18 +08:00
pixelmaxQM e111b01f16 feat: 调整重置配置属性,增加自动出页面功能 2025-04-07 13:15:53 +08:00
pixelmaxQM fd2ac3f7f1 Merge remote-tracking branch 'refs/remotes/origin/autoCode-picture' into dev-281 2025-04-07 13:12:50 +08:00
pixelmaxQM 4e57b75640 Merge remote-tracking branch 'origin/dev-281' 2025-04-07 13:03:50 +08:00
pixelmaxQM e439bff2bc feat: 调整个人配置功能,每次改变自动保存,右上角保存修改为重置。 2025-04-07 13:00:14 +08:00
PiexlMax(奇淼 e210002bff Merge pull request #2003 from huiyifyj/ctx-nil-and-others
fix: check for nil and return explicit type for `UseWithCtx` method
2025-04-07 12:46:03 +08:00
pixelmaxQM 4e735beb2f fix: 组合模式下 获取左侧菜单栏 2025-04-07 12:38:26 +08:00
pixelmaxQM d747edc1f3 fix: 禁止浏览器的默认游标行为 2025-04-07 12:17:38 +08:00
huiyifyj 8bec94336b test: fix missing isPackage argument called method 2025-04-01 16:46:36 +08:00
huiyifyj 83eb193f1b fix UseWithCtx method to check for nil context
- Add nil check for context parameter.
- UseWithCtx method return explicit type rather than interface.

Replace base64Captcha.Store return type with *RedisStore for better type safety.
2025-04-01 16:26:31 +08:00
piexlMax(奇淼 9806f72ca6 fix: 设为首页按钮防止事件穿透 2025-04-01 14:23:46 +08:00
pixelmaxQM 7e7ec52290 feat: 防止npm i 报错 2025-03-27 22:24:20 +08:00
pixelmaxQM 98746fbca5 feat: 更新前端依赖 2025-03-26 20:35:10 +08:00
PiexlMax(奇淼 c0f65386bd Merge pull request #2000 from ByteZhou-2018/m_20250318_gorm_logic
GORM初始化数据库优化,通过抽取重复的逻辑避免代码冗余。
2025-03-26 13:31:23 +08:00
pixelmaxQM cef6fce2c9 feat: 菜单增加单独的动画选择机制 2025-03-20 22:32:20 +08:00
ByteZhou-2018 4964518486 fix pgsql return error to panic 2025-03-18 21:57:51 +08:00
ByteZhou-2018 06ec433b4e Optimize GORM database initialization by extracting duplicate logic 2025-03-18 21:35:10 +08:00
pixelmaxQM 85681af8b8 feat: 默认注册表增加 info表和图库分类表 2025-03-16 12:09:14 +08:00
Qing Liang 4b12ecdf4b bugfix:mongodb没有密码无法连接 (#1999) 2025-03-16 12:00:22 +08:00
pixelmaxQM e8eacb02d6 feat: 未登录情况下防止进入路由死循环 2025-03-16 11:53:44 +08:00
pixelmaxQM e9dd55f4f9 feat: 修复未登录情况下死循环的bug 2025-03-15 16:42:36 +08:00
pixelmaxQM a79df727c9 feat: 给扫码上传添加客户端标记 2025-03-15 14:06:17 +08:00
pixelmaxQM ca47b1c4f5 feat: 在登录状态下进入白名单页面强制拉取到当前角色的默认页面 2025-03-15 14:05:58 +08:00
ab75bc7f59 public: 发布2.8.0版本 (#1998)
* feat:修改token获取优先级,优先从header获取

* feat: 增加业务ctx的传递

* fix文件选择问题,
有公共函数onDownloadFile,去掉downloadFile

* 没问题

* feat: 增加context引入

* fix: 修复图片多选的情况下点击确定抽屉无法收起的bug

* feat: 提高header的token优先级,优化导出表格逻辑,不再依赖于cookie鉴权

---------

Co-authored-by: piexlMax(奇淼 <qimiaojiangjizhao@gmail.com>
Co-authored-by: task <121913992@qq.com>
2025-03-15 13:31:33 +08:00
PiexlMax(奇淼 f776a061ce Update README.md 2025-03-13 11:05:33 +08:00
krank 1456f95b2c Update README.md 2025-03-08 13:34:23 +08:00
krank c5767f6ad5 Update README.md 2025-03-08 13:32:41 +08:00
haimait 3f8dedba80 fix: 修改导入excel模板数据注释 (#1995) 2025-03-05 10:15:49 +08:00
pixelmaxQM 121d62f20f fix: 修复图片多选的情况下点击确定抽屉无法收起的bug 2025-03-03 20:05:48 +08:00
pixelmaxQM 2c08265210 fix: 修复个人样式配置情况下false无法生效的问题 2025-02-25 20:43:58 +08:00
PiexlMax(奇淼 82e397f136 fix:修复mssql中getDB失败的bug 2025-02-20 15:29:46 +08:00
taskandtask 730ee0205e 媒体库增加裁剪上传,扫码上传 (#1994)
Co-authored-by: task <121913992@qq.com>
2025-02-19 18:08:31 +08:00
pixelmaxQM a4716d5db0 fix: 修复iframe url传入不识别的bug 2025-02-16 12:28:34 +08:00
pixelmaxQM 06f166b70a feat: 发布2.7.9版本 2025-02-16 11:52:41 +08:00
pixelmaxQM f2ea36ac0d feat: 调整初始化数据 2025-02-15 16:58:33 +08:00
piexlMax(奇淼 a8e706a395 feat: 调整自动化代码富文本模式下的可选查询条件 2025-02-13 16:20:52 +08:00
bypanghu f608bfa191 fix:设置添加页面切换动画 2025-02-13 15:39:09 +08:00
piexlMax(奇淼 e494e22c07 feat: 调整版本为v2.7.9-beta 2025-02-13 15:33:01 +08:00
d40c815760 2.7.9beta (#1993)
* 媒体库增加分类,图库多选择时优化。

* 重构 JWT token 生成,使用 `New()` 函数代替直接创建实例

* 上传组件支持查看大图 (#1982)

* 将参数缓存,媒体库增加分类,图库多选择时优化。 (#1978)

* 媒体库增加分类,图库多选择时优化。

*修复文件上传进度显示bug&按钮样式优化 (#1986)

* fix:添加内部 iframe 展示网页,优化 permission 代码

* 俩个uuid库合并一个,更新库到当前版本。

* 优化关于我们界面

* feat: 个人中心头像调整,媒体库兼容性调整。

* feat: 自动化代码前端页面美化,多余按钮收入专家模式

* feat: 增加单独生成server功能

* feat: 限制单独生成前后端的情况下的细节配置

* feat: 修复全选失败报错的问题

---------

Co-authored-by: task <121913992@qq.com>
Co-authored-by: Feng.YJ <32027253+huiyifyj@users.noreply.github.com>
Co-authored-by: will0523 <dygsunshine@163.com>
Co-authored-by: task <ms.yangdan@gmail.com>
Co-authored-by: sslee <57312216+GIS142857@users.noreply.github.com>
Co-authored-by: bypanghu <bypanghu@163.com>
Co-authored-by: Azir <2075125282@qq.com>
Co-authored-by: piexlMax(奇淼 <qimiaojiangjizhao@gmail.com>
Co-authored-by: krank <emosick@qq.com>
2025-02-13 15:25:10 +08:00
PiexlMax(奇淼 ea39d83907 Update README.md 2025-02-10 16:44:35 +08:00
pixelmaxQM dae38d9b18 fix:菜单复合模式下,点击一级菜单会自动选择首位子菜单,不含子菜单则定位为顶栏本体。 2025-02-09 19:56:51 +08:00
krank 1e7cf9e65d feat: AI识图前端页面 2025-01-10 16:33:59 +08:00
药要吃 831bd61e02 更新个人信息页样式 这个头 得开 (#1977)
* 更新个人信息页样式
2025-01-09 17:14:39 +08:00
pixelmaxQM fe2b846dbc feat: 提交发布2.7.8版本 2025-01-01 14:49:27 +08:00
pixelmaxQM 8c47d2b179 feat: 提交发布2.7.8版本 2025-01-01 14:49:27 +08:00
Leslie afe6b234cf fixed: 修复递归获取角色列表数据缺失问题 (#1974) 2024-12-31 11:38:04 +08:00
piexlMax(奇淼 1743c763d2 feat: gorm的debug日志无论是否开启了zap都需要输出到控制台 2024-12-31 10:51:33 +08:00
Feng.YJ 21237f8be1 模板文件文档注释修改 (#1973)
* 模板文件文档注释修改

* 补充模板相关修改
2024-12-30 17:08:17 +08:00
piexlMax(奇淼 d19e446416 fixed: 修复无法创建新内容的bug 2024-12-26 15:16:58 +08:00
piexlMax(奇淼 8b93ede959 fixed: 修复sql日志无法加入统一zap输出的bug 2024-12-25 13:51:02 +08:00
PiexlMax(奇淼 cb23254152 给自动化代码增加视觉功能 (#1970)
* update:增加视觉能力。

* feat: 自动化代码增加视觉识别功能
2024-12-22 00:14:03 +08:00
Feng.YJ 601aa6e245 代码优化及错误返回改进 (#1969)
* Makefile: 使用 '?=' 替代 if-else 的判断

* 移除多余的类型转换

* 移除多余的nil判断

* map 使用简化以及错误处理优化
2024-12-22 00:13:22 +08:00
Feng.YJ 532d282509 修复生成的结构体 tag 字段错误以及其它注释和尾部空格问题 (#1968)
* 修复生成的结构体 tag 字段错误

* 移除字段注释多余尾部空格

* 文件模板注释 `@accept` 保持规范
2024-12-20 16:50:45 +08:00
Feng.YJ 93c0525ea5 生成模板中注释文档 query 修改 (#1967)
* 生成模板中注释文档 query 修改
2024-12-19 17:21:22 +08:00
Feng.YJ 2bf423b42f 修复可能的 context 泄露以及遗漏的错误处理 (#1965)
* 修复结构体 tag 字段的错误使用
2024-12-17 16:59:06 +08:00
Brandon-lz f6c2ce45c1 修复限流不返回报错信息的bug (#1966) 2024-12-17 16:57:28 +08:00
Feng.YJ d24eeefc86 添加 swagger 文档接口排序的 @Tag 设置说明 (#1964)
* fix: 修复欢迎信息中的 tab 缩进格式

* 添加 swagger 文档生成

* 添加 swagger 文档接口排序的 `@Tag` 设置说明
2024-12-16 14:25:38 +08:00
pixelmaxQM 876d4187d9 fixed: 过滤条件添加富文本 2024-12-15 13:34:14 +08:00
pixelmaxQM 2412e7151f fixed: 修复富文本组件 查看详情没有正确展示的bug 2024-12-15 13:31:33 +08:00
Isaacedvr1003andzsc 07c21caf8d fixed:修复表名是大写字母开头时,自动化代码异常问题。 (#1961)
Co-authored-by: zsc <zhangshuncheng@dhcc.com.cn>
2024-12-13 17:51:00 +08:00
青菜白玉汤 69ddb2ddff fix: 修复自动化代码管理侧边栏自动展开的问题 (#1959) 2024-12-11 17:51:10 +08:00
283143e1bf 发布v2.7.8Beta1 (#1957)
* beta:2.7.8-a 增加自动化创建树形结构 (#1941)

* feat: 支持创建树形结构

---------

Co-authored-by: piexlMax(奇淼 <qimiaojiangjizhao@gmail.com>

* 优化user store部分写法

* Update user.js

* feat: 升级版本号

* Dev 278 beta2 (#1954)

* 在关闭详情弹窗后 detailFrom为空对象,arr为undefined 使用slice控制台会报错

* 查询不重置pageSize

* 优化主题模式相关内容

* 优化弹窗手机端显示

* bugfix:PostgreSQL initdb (#1953)

* bugfix:postgresql增加显示指定template

---------

Co-authored-by: PiexlMax(奇淼 <165128580+pixelmaxQm@users.noreply.github.com>

---------

Co-authored-by: zayn <972858472@qq.com>
Co-authored-by: Azir <2075125282@qq.com>
Co-authored-by: Qing Liang <106448173+xue-ding-e@users.noreply.github.com>

* docs:调整部分代码注释以及代码格式

* feat: 自动化代码字典支持多选

* fix:调整值接收器和指针接收器

* feat: 支持导出表格复制,优化增加方法页面。

* chore:初始化代码规范化。

---------

Co-authored-by: piexlMax(奇淼 <qimiaojiangjizhao@gmail.com>
Co-authored-by: Azir <2075125282@qq.com>
Co-authored-by: zayn <972858472@qq.com>
Co-authored-by: Qing Liang <106448173+xue-ding-e@users.noreply.github.com>
Co-authored-by: cjb <75364055@qq.com>
2024-12-08 21:17:21 +08:00
PiexlMax(奇淼 80c54ad890 Merge pull request #1946 from neo-6/neo-6-patch-1
解决Invalid vnode type when creating vnode的警告问题
2024-12-04 20:29:35 +08:00
天梦 3272f3c8cc 修复长度验证中数字验证 2024-12-02 18:47:28 +08:00
天梦 6bfbfc4762 解决传参时提示错误警告 2024-12-02 18:29:44 +08:00
天梦 8d2735f6e9 解决Invalid vnode type when creating vnode的警告问题 2024-12-02 15:59:25 +08:00
ipanghu d72984be7e 修复 dockerfile 添加缓存层 (#1943) 2024-11-25 15:41:08 +08:00
pixelmaxQM 39212666c5 feat: 修复导出在baseApi配置为/时候的路径拼接错误 2024-11-21 20:00:27 +08:00
PiexlMax(奇淼 c909d32c56 fix: 无法自动化新增字段的bug 2024-11-19 16:31:43 +08:00
zayn 8073e989f5 查询不重置pageSize (#1940)
* 查询不重置pageSize
2024-11-18 18:07:38 +08:00
pixelmaxQM 4671013ea6 fix: 自动化代码回滚后不可复用的bug 2024-11-17 11:59:09 +08:00
task b954457ae4 Update date.js (#1937)
替换被弃用的RegExp.$1、substr
2024-11-16 13:24:19 +08:00
zayn f7889b9709 Update format.js (#1935)
在关闭详情弹窗后 detailFrom为空对象,arr为undefined 使用slice控制台会报错
2024-11-15 10:38:53 +08:00
pixelmaxQM a9894acd51 feat: 允许清除关联关系 2024-11-14 23:16:10 +08:00
Mr·Zhaoandadmin 51e1c62ee6 web/src/view/superAdmin/menu/icon.vue: 后台菜单管理中选择图标时增加可选自定义图标 (#1933)
Co-authored-by: admin <admin@example.com>
2024-11-12 22:52:30 +08:00
pixelmaxQM fbd0f4b9c6 fix: 自动化代码需检测简称,简称不可以重复。 2024-11-11 22:40:41 +08:00
PiexlMax(奇淼 58204373aa Update README.md 2024-11-10 23:35:30 +08:00
pixelmaxQM 710257da65 delete: 删除开发模式docker-compose环境 2024-11-10 22:37:18 +08:00
青菜白玉汤 f63803529a perf(projects): 增强文件校验的兼容性 (#1931) 2024-11-10 17:02:31 +08:00
piexlMax(奇淼 7d9af64f6d feat: 使用prettierrc对代码进行格式化 2024-11-09 10:32:26 +08:00
piexlMax(奇淼 87a4ce17e1 feat: 根据eslint 对项目进行规范化处理 2024-11-09 10:17:57 +08:00
Raindrop-YL fae6f413a5 fix: 适配 eslint v9 更新, 兼容低版本 node (#1930)
* fix: eslint v9 版本配置文件更新
2024-11-09 09:48:21 +08:00
piexlMax(奇淼 d8e36ab0f8 feat: 新增方法默认窗口关闭 2024-11-09 09:45:56 +08:00
piexlMax(奇淼 35fd5c8d65 feat: 更新dockerfile的node版本 2024-11-08 16:17:52 +08:00
PiexlMax(奇淼 5604424e6f Merge pull request #1924 from zayn-code/main
表单提交按钮增添loading,防连点
2024-11-08 13:54:23 +08:00
pixelmaxQM c4c5f01ee5 feat: 增加包ace-builds 2024-11-07 21:47:24 +08:00
pixelmaxQM e6d203d567 fix: AI生成代码强制处理首字母大写,提高容错 2024-11-07 20:15:09 +08:00
piexlMax(奇淼 e75fa0bd84 feat: 更换代码编辑器,增加不同node的兼容性。 2024-11-07 18:33:33 +08:00
piexlMax(奇淼 b2cfbb95b6 fix: 在导出表格之前取消掉用户自行添加的""和`` 2024-11-06 11:19:17 +08:00
zayn 0d84ea9523 Update form.vue.tpl
表单提交的时候按钮添加loading状态,防止手滑连点后重复创建
2024-11-04 19:39:52 -08:00
zayn e99fe70164 Update table.vue.tpl
表单提交的时候按钮添加loading状态,防止手滑连点后重复创建
2024-11-04 19:28:24 -08:00
pixelmaxQM 8bd337e08f fix: 字符串情况下搜索条件为空不再参与搜索筛选 2024-11-03 22:09:02 +08:00
pixelmaxQM 12124eb1aa feat: 完善自动化代码填充方法逻辑,增加成功率 2024-11-03 13:15:52 +08:00
pixelmaxQM e036395d18 fix: #1918 在包含delete_at的情况下,数据源自动过滤软删除数据 2024-10-31 20:24:18 +08:00
pixelmaxQM 41ba7ad6a5 fix: #1918 在包含delete_at的情况下,数据源自动过滤软删除数据 2024-10-31 20:10:06 +08:00
pixelmaxQM 3452eafe4f feat: 模板配置将自动同步本地有的模板和插件 2024-10-30 20:41:10 +08:00
pixelmaxQM e515ad3074 feat: UI细节优化 2024-10-30 20:32:39 +08:00
pixelmaxQM 255f138bdb feat: 模板配置可以读取系统原生携带的文件模板 2024-10-30 20:32:04 +08:00
PiexlMax(奇淼 08496c2c61 Merge pull request #1922 from cangqiaoyuzhuo/main
chore: fix function name in comment
2024-10-30 10:07:40 +08:00
piexlMax(奇淼 25a996fe51 fix: 新增字段在没有选择gvaModel的情况下,防止出现空指针 2024-10-30 09:48:40 +08:00
piexlMax(奇淼 9ba39f2eda fix: 新增字段在没有选择gvaModel的情况下,防止出现空指针 2024-10-30 09:46:38 +08:00
piexlMax(奇淼 4a70b38a99 fix: 修复关联模式下的sql语句bug 2024-10-30 09:42:37 +08:00
pixelmaxQM 0dc66adc0d feat: 参数管理功能示例代码动态化 2024-10-29 22:18:13 +08:00
bypanghu c2c11b29a7 fix:修复运行时 saas 报错 2024-10-29 22:08:17 +08:00
pixelmaxQM 071f48c3ca feat: 表格模板更名为导出模板 2024-10-29 22:05:03 +08:00
pixelmaxQM 65cef0b40f feat: 导入导出功能将可以直接看到代码模板。 2024-10-29 21:56:30 +08:00
pixelmaxQM f30912e02f fix: 不再自动对导出key进行处理,如遇到关键字需要使用对应数据库的字符串表达式包裹 2024-10-29 20:46:31 +08:00
cangqiaoyuzhuo 1b74dc8afd chore: fix function name in comment 2024-10-28 22:24:45 +08:00
pixelmaxQM 1840b343b2 feat: 自动化代码不允许创建与模板同名的的字段JSON。 2024-10-28 22:05:24 +08:00
pixelmaxQM 4f8030ecae fix: 修复LIKE查询下的模板bug
fix: 在模板模式下对AI进行disabled
2024-10-28 21:39:40 +08:00
PiexlMax(奇淼 bb6c0be9de Merge pull request #1921 from flipped-aurora/dev2.7.7
beta:2.7.7 AI版本发布
2024-10-27 10:36:40 +08:00
pixel(奇淼 a2d4c43047 feat: 插件模板搜索功能按照数组提供索引条件 2024-10-27 10:35:43 +08:00
pixel(奇淼 60184f12bd feat: 菜单主菜单css样式调整 2024-10-27 10:26:35 +08:00
pixel(奇淼 4ffa30e31a feat: 增加AI生成之前的确认行为 2024-10-27 10:21:48 +08:00
pixel(奇淼 7fff2833c3 feat: ai生成页面功能屏蔽 2024-10-26 12:37:27 +08:00
pixel(奇淼 d1da92d040 Merge branch 'main' into dev2.7.7
# Conflicts:
#	web/src/pathInfo.json
#	web/vitePlugin/componentName/index.js
2024-10-26 12:30:41 +08:00
pixel(奇淼 6bb8f8a030 fix: 修复空菜单无法切换为手动输入的bug,修复没有vueName无法读取到pathinfo.json中的bug 2024-10-26 12:17:54 +08:00
pixelmaxQM dcd0eb20e1 feat: 调整自动引入组件,新增html展示页面。 2024-10-25 22:19:13 +08:00
pixelMax(奇淼 7d6270079a feat: 增加ai绘制页面功能 2024-10-25 18:22:11 +08:00
pixelMax(奇淼 05242c0ad7 feat: 完善AI帮写内容 2024-10-25 10:35:14 +08:00
pixelMax(奇淼 30fb3a97d7 feat: 增加方法可以根据方法介绍自动补全 2024-10-25 10:22:09 +08:00
pixelMax(奇淼 4dec8cfb17 Merge branch 'dev2.7.7' of github.com:flipped-aurora/gin-vue-admin into dev2.7.7 2024-10-25 09:47:36 +08:00
pixelmaxQM bb8210b88e feat: autoFunc可以ai添加代码。 2024-10-24 22:55:15 +08:00
pixelMax(奇淼 b69858b6f7 feat: AddFunc在ai生成后支持页面编辑 2024-10-24 18:44:07 +08:00
pixelMax(奇淼 f191601ab4 feat: 增加AddFunc自动填充方法逻辑功能 2024-10-24 18:01:40 +08:00
PiexlMax(奇淼 7d62a55a92 Merge pull request #1917 from Brandon-lz/dev2.7.7
Dev2.7.7 新增支持minio分片上传大文件
2024-10-23 11:22:17 +08:00
Brandon lz eadcda4e30 modified: server/go.mod
modified:   server/go.sum
2024-10-22 07:05:18 +00:00
Brandon lz 45382d1446 支持大文件分片上传minio 2024-10-22 07:00:51 +00:00
PiexlMax(奇淼 0fd4f0bd7c Merge pull request #1911 from zyw0605688/dev2.7.7
修改模板文件table.vue.tpl
2024-10-22 13:29:18 +08:00
pixelmaxQM c3fd7b9077 fixed: 修复一对一一对多编辑时候,kv丢失的bug。 2024-10-21 20:16:59 +08:00
zyw0605688 0f6aa3df83 feat:'1.查询条件字段,如果关联业务表下拉查询,则参考form使用下拉框。2.新增和添加统一,变更好修改统一,查看详情弹框增加标题' 2024-10-19 11:32:14 +08:00
pixelmaxQM 48333c2ad2 Merge remote-tracking branch 'origin/main' into dev2.7.7 2024-10-18 21:25:27 +08:00
pixelmaxQM 9786886c3f feat: 在存在enum的情况下自动化代码时候会校验其赋值并且在错误时候自动包裹 2024-10-18 21:23:43 +08:00
pixelMax(奇淼 b0eedfd6f1 fix: AI导出需要必须选择表 2024-10-18 18:07:23 +08:00
pixelMax(奇淼 1753bf96a8 fix: AI导出表格模板获取表格信息错误的bug 2024-10-18 17:41:58 +08:00
pixelMax(奇淼 67315bf88e feat: 自动化代码string调整为指针类型 2024-10-18 13:53:48 +08:00
PiexlMax(奇淼 4a3dcf24e1 Merge pull request #1906 from Brandon-lz/main
新增支持minio oss
2024-10-18 10:35:44 +08:00
PiexlMax(奇淼 c1b18fe478 Merge branch 'dev2.7.7' into main 2024-10-18 10:35:35 +08:00
chenlianghong e918af0a0c adjust sys_user.go message when del logined self (#1909) 2024-10-18 10:34:24 +08:00
pixelmaxQM a847ad292f feat: 自动化代码可自行配置mod 2024-10-17 23:15:59 +08:00
pixelmaxQM efac72ecbb feat: 增加添加字段功能,方便用户粘贴赋值字段到对应代码位置 2024-10-17 22:29:52 +08:00
pixelMax(奇淼 ed5611810f feat: 自动化代码部分输入框样式调节 2024-10-17 10:03:44 +08:00
pixelMax(奇淼 b8d5e79c03 fixed: 修复无法直接设置router-view的bug 2024-10-16 15:26:09 +08:00
pixelMax(奇淼 3e72ea0650 delete: 去除无用的引用包 2024-10-16 13:17:03 +08:00
pixelMax(奇淼 8b8a0b61af delete: 剔除ws插件 2024-10-16 13:13:15 +08:00
pixelmaxQM f237ac981e feat: 增加自动化代码增加字段的可控参数 2024-10-15 23:28:47 +08:00
PiexlMax(奇淼andAzir 0ce5a63c1d update: 发布dev2.7.6Beta版本 (#1908)
* feat: 优化菜单管理的路径选择框

* fixed: 修复错误的文件命名

* feat: 增加参数管理功能,调整菜单选择组件。

* feat: 恢复config.yaml

* feat: 更新AI功能

* feat: 增加API自动填充功能

* feat: 增加AI自动填充表格导出模板

* feat: 增加AI自动填充表格导出模板和AI自动模板填充

* feat: 新增方法支持选择是否鉴权

---------

Co-authored-by: Azir <2075125282@qq.com>
2024-10-15 21:58:17 +08:00
Brandon-lz a483ac9174 minio 完善 2024-10-14 11:46:39 +00:00
Brandon-lz 91e4c89962 新增minio oss 功能 2024-10-14 10:03:28 +00:00
PiexlMax(奇淼 c34e3b4282 Update README.md 2024-10-11 17:36:25 +08:00
chenlianghong 6e38eb1d70 fix: support pluginPath svg file as component show list when dev mode (#1902) 2024-10-09 10:30:27 +08:00
piexlMax(奇淼 5d227d8d72 feat: 配置保存按钮移动到顶部 2024-10-08 13:14:43 +08:00
piexlMax(奇淼 ccdf725957 fixed: 修复暗夜模式失效的bug 2024-10-08 13:06:18 +08:00
86cffba4aa Beta:发布v2.7.5测试版本 (#1896)
* 生产环境时移除console

* 更新第三方库道最新版本,修正导致的兼容问题

* feat: 版本号变更,修复自动化历史的结构体描述

* feat: 放弃element的按需引用,增加自定义表单组件,替换原始的iframe引入模式。

* feat: 放开表单生成器的key输入

* feat: 自动化代码关联属性支持跨数据库关联

* fixed: 修复跨库关联模板

* feat: 允许清空跨数据关联的业务库选项

* feat: 增加用户搜索功能

* feat: 允许单条API同步
---------

Co-authored-by: task <121913992@qq.com>
Co-authored-by: task <ms.yangdan@gmail.com>
2024-09-30 21:27:16 +08:00
pixelMax(奇淼 2086a73557 feat: 兼容不同版本数据库的json操作 2024-09-30 16:05:45 +08:00
piexlMax(奇淼 a5e8980b23 fix: 消除swag init的不兼容bug 2024-09-29 10:17:59 +08:00
piexlMax(奇淼 360af93d8d fix: 增加图片选择器兼容性 2024-09-29 10:14:26 +08:00
3vilive 4c46bdaa7f feat: 上传文件到 oss 遇到错误时,应该返回错误,避免 panic (#1890) 2024-09-27 20:54:44 +08:00
pixelmaxQM b98094ceee feat: 修复文件选择组件的bug 2024-09-25 21:08:06 +08:00
pixelmaxQM 03330537fc feat: 优化图片选择器 2024-09-22 23:18:33 +08:00
task 2c7809b134 生产环境时移除console 2024-09-21 13:21:30 +08:00
task af287dcdce 生产环境时移除console 2024-09-21 13:21:30 +08:00
chenlianghong ed840a96e6 clean: Update global.js clean console.log svg component name 2024-09-21 13:21:30 +08:00
chenlianghong 04cfd0eb38 feat: edit global.js support plugin svg 2024-09-21 13:21:30 +08:00
pixelmaxQM 6386034c65 feat: 调整icon功能的绑定形式 升级vue和svg插件 2024-09-21 12:54:58 +08:00
chenlianghong 9b26d6c504 server: same Author "yourname" for gen Code (#1887) 2024-09-21 12:28:05 +08:00
chenlianghong 3529297fa4 clean: clean header index.vue repeat flex class (#1888) 2024-09-21 12:27:20 +08:00
pixelmaxQM ad699fa23c fixed: 方法名 ==> 方法介绍 2024-09-18 22:51:27 +08:00
pixelmaxQM 0fd9e951b9 fixed: 对JSONMap进行多数据库不同断言兼容 2024-09-18 22:48:41 +08:00
PiexlMax(奇淼 66bcd32ae7 Merge pull request #1886 from flipped-aurora/revert-1884-main
Revert "Update basetypes.go, fixed origin_setting column read error"
2024-09-18 22:41:24 +08:00
PiexlMax(奇淼 f0d91b0058 Revert "Update basetypes.go, fixed origin_setting column read error" 2024-09-18 22:41:06 +08:00
PiexlMax(奇淼 3d58213f0b Merge pull request #1884 from juneyx/main
Update basetypes.go, fixed origin_setting column read error
2024-09-18 22:37:12 +08:00
Juneyx 528d7411e1 Update basetypes.go, fixed origin_setting column read error 2024-09-18 14:53:13 +08:00
pixelmaxQM a6651ffe48 fixed: 字典页面默认值调整为拉回字典列表的第一个 2024-09-17 21:13:42 +08:00
pixelmaxQM a8e6dc3a3a fixed: 修复复用代码高级模式不展示可选项的bug 2024-09-17 09:43:19 +08:00
pixelmaxQM 8733b2463c fixed: 清理自动化方法的swagger入参 2024-09-16 20:01:45 +08:00
pixelmaxQM 37b0ef4599 fixed: 修复文件监听错误的bug 2024-09-14 18:16:17 +08:00
pixelmaxQM c72ed970fb feature: 增加basetype 兼容低版本数据库的json不兼容问题 2024-09-13 21:02:15 +08:00
pixelMax(奇淼 e9e42be139 fixed: 修复RedisList不受控制创建的bug 2024-09-13 16:39:43 +08:00
piexlMax(奇淼 b55ecd2808 fixed: api.js模板调整 2024-09-13 16:13:48 +08:00
pixelmaxQM f2a8829d1d feature: 版本号v2.7.3升级为v2.7.4 2024-09-12 21:03:35 +08:00
c20ea7e030 publish: 发布2.7.4版本Beta (#1880)
* 媒体库增加批量导入URL

* fix 描述错误

* feature: 自动化代码方法支持增加方法描述

* update: 更新依赖,升级为最新版本

* feature: 自动化代码预览部分支持黑夜模式

* fixed: 修复keepalive上线后失效的bug

* feature: 增加自动化基础模板功能

* feature: 增加自动化基础模板功能

* 将用户配置保存到数据库,刷新或者异地登录配置不丢失

* update: 清除无用的userinfo配置信息

* fixed: 清理开发阶段页面无端进入404的bug

* feature: 前端主题配置跟随用户,不再单独设置json编译生效。

* feature: 增加个人中心配置兼容性

* fix(package): 包名设置为中文会导致无法自动生成代码,禁止包名设置为中文

* feature: 格式化代码

* feature: 对严格模式新建根角色进行调整。

* feature: 版本变更为2.7.4

---------

Co-authored-by: sliboy <34034053+sliboy@users.noreply.github.com>
Co-authored-by: ba0ch3ng <ba0ch3ng@foxmail.com>
Co-authored-by: task <121913992@qq.com>
Co-authored-by: task <ms.yangdan@gmail.com>
Co-authored-by: 爱丽-黑子 <62006632+ailiheizi@users.noreply.github.com>
Co-authored-by: sliboy <sliboy@hotmail.com>
2024-09-12 20:48:03 +08:00
pixelmaxQM df3fc0a9ef fixed: 修复文件上传失败但是依然加入了文件列表的bug 2024-09-04 22:37:41 +08:00
pixel(奇淼 3c7a05b572 feature: 增加上传文件组件的成功失败回调事件 2024-08-31 22:06:36 +08:00
pixelmaxQM a155bcd11a fixed: 修复登陆页面小屏幕下背景色bug 2024-08-30 22:17:46 +08:00
pixelmaxQM 57f13f59b1 fixed: 修复loading无法消失的bug 2024-08-30 22:15:15 +08:00
pixelmaxQM 894cf8e6c3 feature: api默认忽略数据增加 /info/getInfoDataSource 和 /info/getInfoPublic 2024-08-27 21:44:15 +08:00
zayn fa3b952af3 column参数类型是number (#1865)
避免浏览器console的warn提示
Vue warn]: Invalid prop: type check failed for prop "column". Expected Number with value 1, got String with value "1".
2024-08-27 13:17:07 +08:00
chenlianghong b26db1910b Update model.go.template (#1866) 2024-08-27 13:16:39 +08:00
chenlianghong aab865be96 Update service.go.template (#1867)
清除生成代码多于空格
2024-08-27 13:16:18 +08:00
PiexlMax(奇淼andtask 866fa5643e Dev273 (#1868)
* fixed: 修复addFunction下前端api.js无法创建的bug。

* feature: 增加严格角色模式

* Update system.vue

* fixed: 多点登录拦截模式下,jwt换票期间不需要拉黑token。

* fixed: 修复使用ast时候产生无意义的换行的问题

* fixed: 修复跨级操作角色权限的越权问题

* feature: 优化严格模式角色鉴权操作。

* fixed: 增加菜单和api设置越权问题的限制

* feature: 增加插件打包前的自动化同步所需菜单和api的功能

* feature: 自动化代码可以默认生成导入导出

* feature: 自动化导入导出对模板进行回滚

* feature: 剔除无用的packfile代码包

* feature: 发布V2.7.3版本公测。

---------

Co-authored-by: task <ms.yangdan@gmail.com>
2024-08-27 13:15:56 +08:00
PiexlMax(奇淼 87ced16d63 Merge pull request #1862 from Eric54920/Eric-dev
feature: swagger接口请求优化
2024-08-24 23:20:23 +08:00
Eric54920 ed5463360e feature: swagger接口请求优化 2024-08-24 22:34:09 +08:00
chenlianghong 27edfac161 fix: add funcName is sure UpperChar (#1860)
* fix: add funcName is sure UpperChar
2024-08-23 18:14:40 +08:00
pixelMax(奇淼 7f70e69c8e fixed: 修复自动化代码产生的详情功能图片不可用的bug 2024-08-20 10:55:41 +08:00
pixelMax(奇淼 c70fedfb43 fixed: 修复addFunction下前端api.js无法创建的bug。 2024-08-15 18:05:43 +08:00
pixelMax(奇淼 85d7b5fd5d fixed: 修复addFunction下前端api.js无法创建的bug。 2024-08-15 18:04:33 +08:00
pixelMax(奇淼 cbace6f97e feature: 调整全量引入功能对格式化后的代码依然生效 2024-08-15 15:52:35 +08:00
pixelMax(奇淼 bec5dc4476 fixed: 模板中el-image默认添加preview-teleported,用户在预览时候方式弹出层被遮罩。 2024-08-15 15:38:29 +08:00
sliboy f7ddd8bbbb chore(user.vue): Update user.vue, alter userInfo username to userName. (#1855) 2024-08-15 10:49:31 +08:00
马国栋 43d0c291ed feature:swagger 接口请求方式优化 (#1854) 2024-08-15 10:46:41 +08:00
pixelmaxQM 0956edd0d0 feat: 初始化完成后主动获取GVA_ACTIVE_DBNAME。 2024-08-14 20:48:47 +08:00
c9477d37fa V2.7.2版本发布 (#1853)
* feat: 自动化代码增加json导出和导入功能

* feat: 自动化代码前端可见分为Table和Form分别选中

* feature: 调整代码预览为左边栏模式的tabs。

* feat: 增加方法自动添加前端api

* feat: 自动化生成前端支持详情功能

* feat: 增加自动创建可控权限按钮功能

* fixed: 顶栏样式菜单样式细节bug修复

* fixed: 修改视频地址

* fixed: 自动获取表结构和数据库表列结构保持一致

* fixed: casbin 设置空权限无需调用 AddPolicies 方法 (#1850)

* feat:对象存储支持配置Cloudflare R2 (#1849)

* fixed:设为首页和菜单勾选互为必选

---------

Co-authored-by: SliverHorn <503551462@qq.com>
Co-authored-by: 千石 <CN_QianShi@hotmail.com>

* feat: 复杂数据类型的查询将不会生成查询语句,会以string形式接收参数,用户自行实现复杂查询逻辑。

* feat: 创建新角色默认携带字典和长传权限。
禁止删除有首页占用的菜单。
不允许切换至无首页的角色。
自动化代码创建失败将返回错误信息。

* feat: 当package或plugin结构异常时候,阻止创建自动化代码。

---------

Co-authored-by: krank <emosick@qq.com>
Co-authored-by: SliverHorn <503551462@qq.com>
Co-authored-by: 千石 <CN_QianShi@hotmail.com>
2024-08-13 21:55:27 +08:00
千石 3b5c96d7cb feat:对象存储支持配置Cloudflare R2 (#1849) 2024-08-12 22:30:14 +08:00
SliverHorn c3c049b225 fixed: casbin 设置空权限无需调用 AddPolicies 方法 (#1850) 2024-08-12 22:29:50 +08:00
lbbniu 6fedb9773b fix: 代码自动生成选择业务库自动迁移代码生成异常 (#1848) 2024-08-12 15:08:17 +08:00
pixelmaxQM 332a8de2e9 fixed: 修复其他数据库类型下无法获取表列表的bug 2024-08-05 20:05:23 +08:00
PiexlMax(奇淼andkrank 7121968081 2.7.1版本提交 (#1844)
* feature:表格模板自动化生成 (#1841)

* feature:  为导出模板增加自动化功能

* feature:  视频按钮修改

* feature: 发布2.7.1Beta版本,视频集中处理。

---------

Co-authored-by: krank <emosick@qq.com>
2024-08-04 16:06:00 +08:00
pixelmaxQM a44133d0c9 fixed: 修复在同时开启多个窗口的情况下刷新页面导致的死循环情况 2024-08-04 11:12:43 +08:00
pixelmaxQM 3c3d9487d0 fixed:修复复用代码无法改变主键的bug 2024-08-03 15:08:25 +08:00
PiexlMax(奇淼 15b5083d17 Update README.md 2024-08-03 14:55:11 +08:00
pixelMax(奇淼 e25cafe2b4 fixed: 调整重复创建代码的提示 2024-08-02 14:35:16 +08:00
pixelMax(奇淼 b5c44e47ff feature: 调整baseUrl方法 2024-08-01 18:24:11 +08:00
pixelMax(奇淼 5d04b8deea fixed: 调整autoCode标签 2024-08-01 14:20:18 +08:00
pixelMax(奇淼 1207291249 fixed: 修复自动化模板多了}的问题 2024-08-01 14:08:05 +08:00
pixelMax(奇淼 06bf641e7a fixed: 修复自动化代码路径不匹配的bug 2024-07-31 18:09:12 +08:00
pixelMax(奇淼 ce764082b8 feature: 修改vite.config.js注释 2024-07-31 16:23:09 +08:00
pixelMax(奇淼 aebc301b05 feature: swagger自动化模板优化 2024-07-31 15:55:31 +08:00
pixelMax(奇淼 3b93a073c3 feature: swagger 优化 2024-07-31 15:52:23 +08:00
pixelMax(奇淼 a4a7b44da9 feature: Local优化文件删除逻辑 2024-07-31 11:22:56 +08:00
maxwell e65be6ee36 feat: tab支持使用鼠标中键关闭 (#1840)
* fix: 修复注释错误

* feat: tab支持使用鼠标中键进行关闭
2024-07-31 11:20:14 +08:00
LixvYang 2d0b9ecac0 add cloudflare r2 storage (#1835) 2024-07-30 15:31:23 +08:00
pixelmaxQM 5a5b86aeec fixed:新增方法清空已经输入的内容 2024-07-27 22:25:13 +08:00
pixelmaxQM ff41fe0577 fixed:对导出关键字进行处理 2024-07-27 17:59:00 +08:00
pixelmaxQM c97b60b2da fixed:插件api增加空方法模板调整。 2024-07-27 14:29:02 +08:00
pixelmaxQM 2645dcdddf fixed:插件api增加空方法模板调整。 2024-07-27 14:25:22 +08:00
pixelmaxQM 6debb09b0f Merge remote-tracking branch 'origin/main' 2024-07-27 00:17:02 +08:00
pixelmaxQM 62b84d454a feature:提取创建claims和token的方法,方便后续插件扩展。 2024-07-27 00:16:48 +08:00
pixelMax(奇淼 26dc3f32d9 feature: 优化自动化api模板 2024-07-26 14:52:24 +08:00
SliverHorn 84f8b6e1da fixed: package template api.go.tpl Update 2024-07-26 14:47:47 +08:00
SliverHorn 70e3d40c3e Merge remote-tracking branch 'origin/main' 2024-07-26 14:45:28 +08:00
SliverHorn 432b2f04d7 fixed: plugin template api.go.template and package template api.go.tpl 2024-07-26 14:45:10 +08:00
pixelMax(奇淼 63c82cf705 feature: 优化pathInfo.json生成功能 2024-07-26 14:00:08 +08:00
pixelMax(奇淼 5c7d121e67 feature: 放弃自己研发的代码定位功能,集成vite官方的devtool工具 2024-07-26 13:38:21 +08:00
SliverHorn 055198ccd5 fixed: plugin template api.go.template {{.Abbreviation}}.UpdatedBy rename info.UpdatedBy 2024-07-26 13:01:06 +08:00
SliverHorn 0993e81e00 fixed: package template api.go.tpl 作用域问题 2024-07-26 11:58:39 +08:00
pixelMax(奇淼 15d22b7726 feature: 增加空方法后续业务逻辑处理 2024-07-26 11:30:41 +08:00
pixelMax(奇淼 bb3a54a312 feature: 优化添加空方法的apiPath 2024-07-26 11:22:30 +08:00
pixelMax(奇淼 7ad6b9c32a feature: 自动关联可能的apiGroup 2024-07-26 11:15:02 +08:00
pixelMax(奇淼 4814f21017 feature: 增加新初始化api 2024-07-26 10:28:21 +08:00
pixelMax(奇淼 1f962f21b3 fixed: 修复自动化代码字段名称key编辑时候失去焦点的bug 2024-07-26 10:24:48 +08:00
pixelMax(奇淼 397e1e2bf1 opt: 优化模板逻辑 2024-07-26 10:04:56 +08:00
pixelmaxQM b10c7297fd feature:方法结束关闭file 2024-07-25 21:55:40 +08:00
PiexlMax(奇淼 7f9194f475 feater: 可对自动化代码增加空方法 (#1834)
* feature:自动化代码可从自动化代码管理中增加空方法,用户不用自行组织其中的关系。
2024-07-25 21:29:20 +08:00
lonevle 0fc1edf895 Dockerfile修复工作路径的问题 (#1833) 2024-07-25 21:27:20 +08:00
pixelMax(奇淼 c973c0cce5 feature: 调整自动化代码菜单和api注册逻辑 2024-07-25 16:43:11 +08:00
pixelMax(奇淼 48f3bdc80c fixed:前端文件创建路径错误 2024-07-25 16:11:33 +08:00
pixelMax(奇淼 0fc43fcf42 opt: 调整Viper配置文件路径展示代码 2024-07-25 10:05:48 +08:00
pixelMax(奇淼 e593ec604e opt: 调整import注入和回滚带别名无法识别的bug 2024-07-24 16:48:49 +08:00
PiexlMax(奇淼 1494bc9db3 2.7.0Beta2 (#1829)
* opt: 优化自动化package注册gorm_biz代码,替换为Inspect

* opt: 自动化代码插件gorm改造完成

* opt: 自动化代码插件路由注册改造完成
2024-07-24 15:24:50 +08:00
pixelMax(奇淼 4512aa7ff8 feature: 修复下标越界的bug,调整enter ast 代码 2024-07-23 18:36:35 +08:00
pixelMax(奇淼 de782e629f feature: 修复package下gorm数据添加和回滚的异常 2024-07-23 18:26:19 +08:00
pixelMax(奇淼 b7c6a7ffd9 feature: 修复package下gorm数据添加和回滚的异常 2024-07-23 17:35:17 +08:00
pixelMax(奇淼 ca4118cc8e feature: 插件enter回滚当数据为空时候删除import 2024-07-23 16:27:41 +08:00
pixelMax(奇淼 a561e7dc2b feature: 修复自动化插件会创建两个var的bug 2024-07-23 15:56:17 +08:00
PiexlMax(奇淼 b3a0f187d7 2.7.0Beta Bug修复 (#1826)
* feature:调整package注入路由方法

* feature:调整package回滚路由方法

* feature:调整创建自动化代码enter重复import的问题

* feature:调整package创建时enter的问题

* feature:调整package回滚问题
2024-07-23 00:19:21 +08:00
PiexlMax(奇淼 39be2d0351 BetaBug修复 (#1825)
* feature:调整package注入路由方法

* feature:调整package回滚路由方法

* feature:调整创建自动化代码enter重复import的问题
2024-07-22 23:53:48 +08:00
pixelMax(奇淼 5492e0db50 feature: 修复插件无法安装的bug 2024-07-22 11:33:47 +08:00
pixelMax(奇淼 db038c29e8 feature: 修复插件无法安装的bug 2024-07-22 11:30:46 +08:00
pixelmaxQM 4fe1f5c225 feature:菜单选择文件时自动同步path 2024-07-21 22:00:52 +08:00
pixelmaxQM ac374bab22 feature: 调整自动化代码web模板 2024-07-21 21:58:23 +08:00
pixelmaxQM 01f6814a25 feature: 调整插件自动注册逻辑。 2024-07-21 21:36:25 +08:00
6e4dc10c49 文件结构调整,支持插件自动化 (#1824)
* Update index.vue

多个详情页之间切换tab,页面没有重新渲染

* feature:新增同步API功能

* feature: 同步表数据

* feature:新增同步API功能

* feature: 增加V2插件注册

* feature:给Enter的依赖结构增加单独的New 方便引用

* feature: 调整关联属性的选择模式

* feature: 增加component组件和name的映射插件,防止keepalive的懒加载失效。

* update: PluginInitializeRouter  && 修复TypePluginInitializeMenu ast 类型错误

* update: 测试文件的astType 类型错误

* feature: 文件变更自动同步componentName.json。

* feature: 文件变更自动同步componentName.json。

* feat: UI美化

* feat: 自动化页面顺序调整

* feature:修改404页面

* update: PluginInitializeMenu

* update: Plugin template

* fixed systemApi 重复声明

* api.vue:update:修改API分组为下拉列表

* update: import添加注释

* update: plugin_enter_test.go 增加测试用例

* update: ast 预览文件路径

* update: config Autocode 新增Module字段以及如果为空的情况下自动获取运行目录下的go.mod文件

* update: auto_code_package.go 完善调用ast工具类的封装使用

* update: auto_code_template.go Create方法和修正SysAutoCodeHistory

* feat:调整自动化package为模板,增加初始化配置信息,调整页面信息。

* update: ast PreviewPath MkdirAll

* update: ast type错误, PluginEnter and PackageModuleEnter add TemplatePath模版路径

* update: autoCodePackage and autoCodeTemplate bug修正

* update: PackageInitializeRouter 传入两个路由组

* update: PackageModuleEnter 处理空变量时与type冲突注入

* update: Package 模版更新

* update: utils/ast 优化统一

* update: 注入内容修复错误

* fix: 修复注释错误

* update: plugin 模版 完成

* feature: 文件watch功能只在development下开启

* update: viper.go.template 因为viper不区分配置的key的大小写所以用package

* update: ast 测试代码规范化

* update: package 删除api和router多余导包

* update: plugin template

* update: auto_code_package 问题修复

* update: ast 测试插件的预览功能

* update: gorm_biz 更新注册方式

* update: go.mod tidy

* remove: plugin template gen main.go.template

* update: ast 重构, 分离读取和写入步骤支持

* update: AutoCodePackageApi 传入参数错误修复

* rename: sys_autocode_history.go => sys_auto_code_history.go

* update: 预览无需落盘, 创建落盘,抽离公共参数

* update: api.go.tpl 导包位置fmt 和package js位置存放错误

* update: 测试用例修复 and PackageInitializeGorm 重构

* update: ast 新增相对路径, 代码生成器历史回滚功能

* update: ast 工具类回滚失败修复以及测试文件

* update: 代码生成器历史 回滚问题修复

* update: 代码生成器模版忽略.DS_Store

* featute: 自动化GORM结构的注入和剔除

* feature: 插件模板调整

* feature: 增加公告插件示例,调整代码模板。

* feature: 自动注册插件V2。

---------

Co-authored-by: zayn <972858472@qq.com>
Co-authored-by: SliverHorn <sliver_horn@qq.com>
Co-authored-by: krank <emosick@qq.com>
Co-authored-by: cjk <wlicjk@126.com>
Co-authored-by: piexlMax(奇淼 <qimiaojiangjizhao@gmail.com>
Co-authored-by: maxwell <zhong.maxwell@gmail.com>
2024-07-21 11:33:25 +08:00
jameschcc 6b3a9024d3 README.md: correct typo (#1823) 2024-07-21 11:30:36 +08:00
PiexlMax(奇淼 b4841843f7 Update ci.yaml 2024-07-17 13:24:52 +08:00
pixelMax(奇淼 35efc07b2e fixed: 增加导出模板特殊字段说明,添加默认darkMode 2024-07-10 17:53:57 +08:00
pixelMax(奇淼 954160ebd9 feature: 调整导出的时间格式处理 2024-07-10 17:52:53 +08:00
pixelMax(奇淼 ea1633ad52 fixed: 修复darkMode失效的bug 2024-07-10 17:34:56 +08:00
pixelmaxQM fb5d5ea1be feature:版本变更v2.6.7 2024-07-06 12:17:17 +08:00
PiexlMax(奇淼 02f5d6fea2 增加同步API功能 (#1811)
* feature:新增同步API功能
2024-07-04 21:19:20 +08:00
zayn 227755b892 Update index.vue (#1810)
多个详情页之间切换tab,页面没有重新渲染
2024-07-04 21:14:12 +08:00
SliverHorn eebd8771bd Merge pull request #1809 from SliverHorn/ai
Update: mv system ai-path to autocode
2024-07-03 09:31:34 +08:00
SliverHorn 36fed0cc6f Update: mv system ai-path to autocode 2024-07-03 09:27:30 +08:00
pixelmaxQM 08f3b64243 feature:增加AI提问的长度限制 2024-07-02 23:40:14 +08:00
PiexlMax(奇淼 59cfe96fe3 增加AI辅助功能 (#1808)
* feature: 增加两个辅助AI,小奇和小淼

* feature:调整AI自动反写部分
2024-07-02 22:53:59 +08:00
PiexlMax(奇淼 128e810f77 调整镜像和依赖 2024-07-02 11:07:33 +08:00
PiexlMax(奇淼 bbe9322f75 Update Makefile 2024-07-02 11:03:38 +08:00
pixelMax(奇淼 35186b41ff feature:调整多图下不换行的问题 2024-07-02 10:46:38 +08:00
pixelMax(奇淼 0c846f0fea feature:url调整兼容各类情况下的图片展示 2024-07-02 10:46:30 +08:00
Wallandwall-js d497e96407 feat: 调整逻辑无论是否创建菜单或API都注册自动化代码历史 (#1804)
* feat: 调整逻辑无论是否创建菜单或API都注册自动化代码历史

---------

Co-authored-by: wall-js <wall_js@foxmail.com>
2024-07-01 10:43:32 +08:00
Qing Liang a4f139f855 后端dockerfile正确设置时区 && 忽略后端server/uploads文件夹 (#1803)
* dockerfile后端设置时区

* gitignore忽略后端uploads文件夹
2024-07-01 10:14:24 +08:00
pixelmaxQM e386b28ba4 feature:插件注册功能多给一个engine 准备后续扩展 2024-06-29 00:22:53 +08:00
pixelmaxQM aa8ef48246 fixed:侧边宽度调整防止出现横向滚动条 2024-06-28 21:59:07 +08:00
pixelmaxQM 6bac462359 fixed:图片展示功能调整 2024-06-28 21:46:37 +08:00
pixelMax(奇淼 24e4d05157 feature:url调整让上传文件支持/模式 2024-06-28 11:37:59 +08:00
SliverHornandSliverHorn 737c051466 Update: .gitignore (#1800)
* Update: .gitignore server

---------

Co-authored-by: SliverHorn <caiwei.lai@jutze.com.cn>
2024-06-27 17:33:52 +08:00
SliverHorn 4ab50882a4 Merge pull request #1801 from jedyang/patch-1
业务路由的代码错误
2024-06-27 16:40:20 +08:00
yunsheng 06a07865f3 Update router_biz.go
privateGroup应该是切片的第一个。publicGroup应该是切片的第一个。
2024-06-27 15:02:11 +08:00
pixelMax(奇淼 5607702be9 fixed: 导出模板调整limit为指针 2024-06-27 14:57:57 +08:00
pixelMax(奇淼 e9be009f49 fixed: 导出模板调整limit为指针 2024-06-27 14:57:01 +08:00
pixelMax(奇淼 bb4e938bd2 fixed: 业务库导出问题调整 2024-06-27 10:20:44 +08:00
Wallandwall-js 45f723c07f feat: 调整自动化代码逻辑,重复创建的菜单和api需要用户手动取消自动创建 (#1798)
* feat: 调整自动化代码逻辑,重复创建的菜单和api需要用户手动取消自动创建

---------

Co-authored-by: wall-js <wall_js@foxmail.com>
2024-06-27 09:41:35 +08:00
pixelmaxQM 640f44fd10 fixed:修复左侧无法滚动的bug 2024-06-26 19:58:57 +08:00
Jupiterandhxl 821dd02aa4 feat: 优化布局结构 统一使用 drawer (#1796)
* sysDictionary.vue: perf 系统统一使用 drawer 抽屉 新增或编辑时form 取消校验

---------

Co-authored-by: hxl <52553624@qq.com>
2024-06-25 10:54:35 +08:00
pixelmaxQM 6e2140258e feature:后端路由注册和数据库注册方法与原始框架分离,自定业务不再干扰原始框架内容。 2024-06-23 17:01:39 +08:00
b628bd7769 调整配置文件默认灰度不生效问题 (#1795)
修复:在默认配置config.json文件修改灰色模式后,启动项目后不生效问题。

---------

Co-authored-by: zsc1003 <11476303+zsc1003@user.noreply.gitee.com>
Co-authored-by: Isaacedvr1003 <152384462+Isaacedvr1003@users.noreply.github.com>
2024-06-22 21:46:42 +08:00
pixelmaxQM f23cd22110 feature:增加静态目录public,调整在线logo地址到public。 2024-06-22 21:16:50 +08:00
PiexlMax(奇淼andSliverHorn 8ef4f408bf feat: 优化自动化代码结构,增加顶栏侧边栏组合式结构 (#1793)
* feature:增加顶栏组合模式。

* Update:
1. request.go.tpl and model.go.tpl indent problem
2. api.go.tpl, request.go.tpl, service.go.tpl struct {}

* Update:
1. model.go.tpl import blank line

* feature:增加顶栏组合模式。

* feature:增加左侧检测逻辑保证存在左侧菜单。

---------

Co-authored-by: SliverHorn <caiwei.lai@jutze.com.cn>
2024-06-21 21:03:47 +08:00
PiexlMax(奇淼 01139a2e6b Merge pull request #1792 from sliboy/main
chore(spell check): rename /server/utils/clamis.go to /server/utils/claims.go
2024-06-21 20:15:15 +08:00
pixelMax(奇淼 08606f740d feature: swagdoc调整 2024-06-21 14:59:30 +08:00
LiDahan 42c6bc11cc chore(spell check): rename clamis.go to claims.go 2024-06-21 09:50:49 +08:00
Wallandwall-js d6703e82e2 fixed: 修复自动化代码form模板,find接口调整未调整完全 (#1790)
Co-authored-by: wall-js <wall_js@foxmail.com>
2024-06-20 17:45:56 +08:00
Wallandwall-js 8f1692e394 fixed: 修复生成代码element-ui接口启用警告问题 (#1787)
* fixed: 修复生成代码element-ui接口启用警告问题

---------

Co-authored-by: wall-js <wall_js@foxmail.com>
2024-06-18 13:17:09 +08:00
pixelMax(奇淼 3e55234a24 feature: 可以选择不自动迁移表结构 2024-06-17 17:17:25 +08:00
pixelMax(奇淼 7df246c25a feature: 可以选择不自动迁移表结构 2024-06-17 17:15:15 +08:00
pixelMax(奇淼 fbffbce090 fixed:调整顶栏模式自动缩进bug 2024-06-17 15:15:28 +08:00
Juneyx 18e9b6d84c Fixed system.vue: 日志留存时间json key错误 (#1785)
后端对应的json key是retention-day
2024-06-16 23:33:59 +08:00
03e5bc515f v2.6.6版本发布 (#1784)
* 前端支持顶部菜单栏模式

* 自动化代码单条获取方法不再需要取data.xxx直接取用data

* 自动化代码支持选择索引

* 自动化代码回滚支持自行选择是否删除菜单、API、表

* 日志增加定期清理功能

* 权限配置API部分,支持根据API真实path进行筛选

* 修复了一些已知bug

* 修复了一个sql注入漏洞

---------

Co-authored-by: xuedinge <781408517@qq.com>
Co-authored-by: Qing Liang <106448173+xue-ding-e@users.noreply.github.com>
Co-authored-by: wall-js <wall_js@foxmail.com>
Co-authored-by: Wall <307606056@qq.com>
Co-authored-by: leooza <leooza@163.com>
Co-authored-by: piexlMax(奇淼 <qimiaojiangjizhao@gmail.com>
Co-authored-by: hxl <52553624@qq.com>
Co-authored-by: zsc1003 <11476303+zsc1003@user.noreply.gitee.com>
2024-06-16 00:27:40 +08:00
Juneyx b336529d42 添加通过点击展开/收起控制显示更多的查询条件的功能 (#1771)
* 给table.vue模板添加控制显示/隐藏更多查询条件的语句块和按钮

* sys_auto_code.go: 添加隐藏查询条件控制字段

* table.vue.tpl: 按照FieldSearchHide字段自动将隐藏的查询条件写到对应的代码块里

* fieldDialog.vue: 添加隐藏查询条件的控制开关

* 只有已经选择了查询条件的情况下才能选择
2024-06-12 23:33:19 +08:00
青菜白玉汤 bbf716b28e style(login): 优化登陆部分代码,提升可读性 (#1772) 2024-06-12 23:32:18 +08:00
pixelMax(奇淼 725f6fe3ec fixed: 自动化请求结构中不应该携带JSON 2024-06-11 14:33:44 +08:00
Dale f773a02ce0 [fixed] 优化错误判断 (#1762) 2024-06-07 11:17:25 +08:00
Deng 21266be1ed perf: 优化 api 和 service 中方法注释不正确的问题 (#1765) 2024-06-05 20:30:08 +08:00
pixelmaxQM 53d0338218 feature:修复已知安全问题。 2024-06-02 21:13:51 +08:00
pixelmaxQM 2f67c23c5c feature:在选择图片时候增加删除按钮,可以在媒体库中直接删除图片。 2024-06-02 20:50:55 +08:00
poppingkaka e64be755f9 优化如果join表时出现重复的字段或者需要有函数时可以导出别名的值 (#1761) 2024-05-31 10:45:39 +08:00
SliverHornandSliverHorn 23952c5f5f Update: (#1758)
1.config gorm相关移除DBBASE实现改为GeneralDB实现LogLevel函数
2.移除initializel/internal/logger实现,改为gorm_logger_writer实现gorm的logger通过zap输出到文件或者控制台
3.优化initializel/internal/gorm代码

Co-authored-by: SliverHorn <caiwei.lai@jutze.com.cn>
2024-05-27 10:24:19 +08:00
02fc5036d7 v2.6.5版本更新 (#1757)
* feature:增加资源加载loading

* feature:修正sql无法落盘的问题

* fixed: 修复切换角色出现404的问题。

* 删除selectImage.vue中chooseImg下多余的console.log(url)

---------

Co-authored-by: krank <emosick@qq.com>
Co-authored-by: Qing Liang <106448173+xue-ding-e@users.noreply.github.com>
2024-05-26 21:49:34 +08:00
a6a65ed9f4 fixed:修复自动化生成表格缺少的prop (#1755)
* fixed:修复自动化生成表格缺少的prop

---------

Co-authored-by: wall-js <liujun@grectronics.cn>
Co-authored-by: wall-js <wall_js@foxmail.com>
2024-05-26 21:24:33 +08:00
Wallandwall-js 369f657aa6 fixed:修复自动化代码无法识别json类型,去掉插件路由冗余代码 (#1751)
* fix(bug): [api.go.tpl]自动化代码swag路径冲突

---------

Co-authored-by: wall-js <liujun@grectronics.cn>
2024-05-22 16:56:55 +08:00
pixelmaxQM 1801e5b30f fixed:selectImage组件图片偏移的bug 2024-05-21 21:26:16 +08:00
pixelmaxQM b10d5103f3 fixed:selectImage组件重构 2024-05-20 22:07:45 +08:00
pixelmaxQM 9964bfef8b fixed:修复特殊符号下无法预览图片的bug 2024-05-20 21:08:32 +08:00
Juneyx 9945a19f2c state.vue: 修复展示多硬盘信息时无法上下滚动的bug (#1749) 2024-05-20 10:27:32 +08:00
pixelmaxQM a5d43e6f14 fixed:修复右上角focus-visible状态下会出现outline的bug 2024-05-18 23:11:28 +08:00
pixelmaxQM b61b9a06dd feature:增加首页插件推荐 2024-05-18 21:58:50 +08:00
pixelmaxQM f28570fa98 feature:新版树组件适配暗夜模式 2024-05-18 21:48:42 +08:00
Juneyx fb53d639be 添加展示多硬盘用量信息的功能 (#1747)
* featurel: 添加多磁盘用量信息展示
2024-05-18 11:52:44 +08:00
nonstop 42de9257c3 fixed: 修复文件分片上传在已选择文件的情况下,再次选择并取消出现控制台飘红且原文件清空的bug (#1746) 2024-05-18 11:48:28 +08:00
Wallandwall-js 0fba597a61 fixed:调整自动化代码swagger文档返回值类型 (#1742)
* fix(bug): [api.go.tpl]自动化代码swag路径冲突

* fixed:调整自动化代码swagger文档返回值类型

* fixed:修复RouterPrefix修改后不影响插件路由问题

---------

Co-authored-by: wall-js <liujun@grectronics.cn>
2024-05-17 16:22:16 +08:00
pixelMax(奇淼 d0393c4e9f fixed:调整前端打包的base路径,适配history模式路由。 2024-05-17 13:25:31 +08:00
pixelMax(奇淼 a21d2a591e feature:优化数据源字段和数组字段展示 2024-05-17 11:26:51 +08:00
pixelMax(奇淼 de54688c56 fixed:自动导入功能将根据表内字段自动创建created_at和updated_at的时间 2024-05-17 10:26:47 +08:00
pixelmaxQM 3c486d9117 feature:暗夜模式兼容调整,初始化需要手动写入初始密码。 2024-05-16 21:55:32 +08:00
pixelmaxQM e8128250f4 feature:暗夜模式兼容调整,初始化需要手动写入初始密码。 2024-05-16 21:49:56 +08:00
pixelmaxQM 58a1b72910 fixed:登录页面暗夜模式适配 2024-05-16 21:02:16 +08:00
SliverHornandSliverHorn ee00d29afd Update: (#1743)
1. 移除zap配置文件MaxAge字段
2. 重构自定义Cutter切分日志
3. 自定义ZapCore, 可实现根据fields自定义功能文件输出

Co-authored-by: SliverHorn <caiwei.lai@jutze.com.cn>
2024-05-16 18:21:30 +08:00
pixelMax(奇淼 5cfcc538a8 fixed:左侧菜单栏超长支持滚动 2024-05-16 15:22:21 +08:00
pixelmaxQM e7c8a9d420 feature:增加自动化代码页面暂时存储功能 2024-05-15 21:40:36 +08:00
pixelmaxQM 6b07ffe8f7 feature:增加数据源一对多关系。 2024-05-15 21:26:32 +08:00
pixelmaxQM 0d17340445 feature:增加数据源一对多关系。 2024-05-15 21:15:41 +08:00
pixelMax(奇淼 2a0b92713b fixed:兼容旧自动化数据 2024-05-15 10:50:22 +08:00
pixelMax(奇淼 fb22eb4178 fixed:修复生成json类文件关闭弹窗后再开启的错误 2024-05-14 15:29:34 +08:00
pixelMax(奇淼 136fb2f394 fixed:修复更新api失败的bug 2024-05-14 12:45:33 +08:00
pixelMax(奇淼 c515805f0a fixed:表格增加左右-1px的边距,防止表格边框线导致宽度超出页面从而无限延伸的bug。 2024-05-14 10:44:36 +08:00
PiexlMax(奇淼 613ba9ba20 Update README-en.md 2024-05-11 11:30:12 +08:00
PiexlMax(奇淼 f6314d3581 Update README.md 2024-05-11 11:29:51 +08:00
pixelmaxQM 043f5c78c2 feature:调整autoPackage弹窗 2024-05-10 21:28:53 +08:00
pixelMax(奇淼 0f9e519b0e feature:调整侧边栏暗夜模式的hover错误 2024-05-10 15:17:04 +08:00
PiexlMax(奇淼 0d17a2351f Update ci.yaml 2024-05-10 14:34:21 +08:00
pixelMax(奇淼 1b388664cb feature:水印密集度调整 2024-05-10 13:16:06 +08:00
pixelMax(奇淼 1edb0c529f feature:调整bottomInfo组件位置 2024-05-10 13:05:36 +08:00
pixelMax(奇淼 f07a58bff4 feature:readme版权相关文案调整 2024-05-10 11:18:48 +08:00
pixelMax(奇淼 c054840aec feature:上线前细节数据调整 2024-05-10 11:15:38 +08:00
PiexlMax(奇淼 e259418398 Update README.md 2024-05-09 21:42:11 +08:00
PiexlMax(奇淼andbypanghu df1d68a724 新版前端UI,预发布2.6.4版本。 (#1735)
* fix: 修改 layout 中相关 emit 和 重复声明的 theme ,采用最新的vue api

* fix:修改 eslintrc 的配置文件,删除大多数无用配置

* fix: 修复 layout 切换手机样式模糊层的 bug

* feature: 重构 layout , 添加暗黑模式 , 删除侧边栏颜色

* fix:细节调整,activeColor摘除。

* feature:右侧滚动模式调整

* feature:无用代码剔除

* fix: 修复暗黑模式相关细节

* fix: custome config layout

* feature:样式细节调整

* fix: 增加前端样式配置文件

* feature:调整基础配置,增加表格边框

* feature:buttomInfo取消底色,a标签更改为活跃色

* feature:调整阴影颜色和配置同步

* feature:版本调整2.6.3==>2.6.4

---------

Co-authored-by: bypanghu <bypanghu@163.com>
2024-05-09 21:35:39 +08:00
Wallandwall-js 9d58390e11 fix(bug): [api.go.tpl]自动化代码swag路径冲突 (#1732)
Co-authored-by: wall-js <liujun@grectronics.cn>
2024-05-09 11:48:15 +08:00
pixelMax(奇淼 db4c7a8bda fixed:修复富文本无法编辑的bug 2024-05-09 10:12:20 +08:00
PiexlMax(奇淼 ab163fc0ef Update ci.yaml 2024-05-06 21:20:20 +08:00
pixelmaxQM 0265801830 fixed:表格模板删除查看详情功能。 2024-05-06 21:15:37 +08:00
pixelmaxQM 5fa7bbbc0f fixed:导出模板顺序一致性调整 2024-05-06 21:10:01 +08:00
PiexlMax(奇淼 e15351e1c5 Update README.md 2024-04-29 17:10:22 +08:00
pixelmaxQM 5eb0133b5c feature:升级后端依赖,前端代码调优 2024-04-28 22:05:50 +08:00
pixelmaxQM ff8344d671 feature:自动化代码增加数据源配置功能 2024-04-27 21:48:24 +08:00
pixelmaxQM d9a43ea1d6 feature:自动化代码增加数据源配置功能 2024-04-27 21:35:29 +08:00
pixelmaxQM 6c62d73afb feature:v2.6.3发布 2024-04-27 17:16:42 +08:00
pixelmaxQM d23d6c342a feature:自动化增加前端可控显隐。 2024-04-25 21:13:55 +08:00
pixelmaxQM 90549a09e1 feature:自动化增加前端可控显隐和自定义class。 2024-04-25 21:02:43 +08:00
pixelmaxQM 17d3639443 feature:优化api代码逻辑,调整pgsql下 more than once的bug。 2024-04-23 21:13:09 +08:00
pixelmaxQM e8a096b8fe feature:调整Update方法,不再使用save全量更新。 2024-04-23 20:56:30 +08:00
pixelmaxQM fea136e513 fixed:修改agent的数据库存储方式,防止日志过长存储失败。 2024-04-23 20:43:50 +08:00
pixelMax(奇淼 f3a4095462 增加丢失的vue-router 2024-04-23 14:45:56 +08:00
pixelmaxQM d7d25cf69b feature:调整抽屉的title属性,消除warning 2024-04-22 22:14:25 +08:00
pixelmaxQM 3b33fe83e6 feature:代码生成器可拖拽行,修复pgsql从库创建代码的bug,增加默认值属性。 2024-04-22 22:04:29 +08:00
pixelmaxQM 56f4d223ab fixed:适配pgsql编辑菜单触发 more than once的bug 2024-04-22 20:59:15 +08:00
pixelMax(奇淼 c07317a619 调整openDocument 2024-04-17 10:39:55 +08:00
Qing Liang 4798f7688b 点击跳转代码插件修复websotrm bug (#1715) 2024-04-17 10:35:32 +08:00
pixelmaxQM 24db0eb5aa fixed:切换角色功能适配新版gorm 2024-04-14 23:43:21 +08:00
Haoran Wu 1ece13c43d sys_export_template.go: 修复导入Excel时前几条为空数据的问题 (#1713) 2024-04-14 21:03:44 +08:00
pixelmaxQM 48268309b9 fixed:回滚时候自动清理掉router下空的作用域 2024-04-14 21:02:35 +08:00
4074a52b1b 修复pgsql和数据库导入bug,增加默认mod中的datatypes (#1712)
* 多文件: fix error specified more than once in PG

* Update sys_authority.go

* Update sys_authority.go

* sys_export_template.go: 导入Excel时使用批量插入提高性能

* 添加gorm.io/datatypes

---------

Co-authored-by: crazyrunsnail <fjyuan1991@163.com>
Co-authored-by: XiMo-210 <2831802697@qq.com>
2024-04-13 18:46:58 +08:00
pixelMax(奇淼 61dd524c26 fixed:修复根目录为O的错误 2024-04-12 14:54:28 +08:00
pixelMax(奇淼 61a678a318 调整无法创建根菜单的bug 2024-04-12 14:47:16 +08:00
pixelmaxQM 8ecec6a14f Merge branch 'fixed_menu'
# Conflicts:
#	server/service/system/sys_base_menu.go
#	web/src/view/superAdmin/menu/menu.vue
2024-04-11 21:27:44 +08:00
PiexlMax(奇淼andcrazyrunsnail e3f8b8a394 fixed:菜单删除功能细节调优 (#1705)
* 多文件: 菜单parentId由string改成uint

* sys_base_menu.go: fix table name "sys_base_menus" specified more than once (SQLSTATE 42712) (#1704)

---------

Co-authored-by: crazyrunsnail <fjyuan1991@163.com>
2024-04-11 21:17:49 +08:00
pixelmaxQM eebddbafcc feature:调整菜单删除逻辑 2024-04-11 21:15:35 +08:00
PiexlMax(奇淼 50cbce0f7a Merge pull request #1702 from crazyrunsnail/fix-model-idtype
多文件: 菜单parentId由string改成uint
2024-04-11 20:56:07 +08:00
fakedavid f9974a8971 sys_base_menu.go: fix table name "sys_base_menus" specified more than once (SQLSTATE 42712) (#1704) 2024-04-11 20:55:46 +08:00
crazyrunsnail baa48a1679 多文件: 菜单parentId由string改成uint 2024-04-11 16:38:09 +08:00
pixelmaxQM 032910f87a feature:插件自动化添加自动注册菜单和api的模板供给修改 2024-04-10 21:48:20 +08:00
pixelmaxQM 773ef95b70 feature:增加插件自动化的前端功能页面 后端api生成自动添加一个开放的接口示例 2024-04-10 21:24:46 +08:00
pixelmaxQM 18c2f84771 feature:表格导出功能增加join支持多表关联导出 2024-04-09 22:05:12 +08:00
pixelmaxQM ea721a71b5 feature:防止自动化代码中的路径穿越 2024-04-09 21:09:01 +08:00
pixelMax(奇淼 b1b7427c6e fixed:修复GHSA-gv3w-m57p-3wc4 2024-04-09 18:09:09 +08:00
pixelmaxQM 7bc7c30510 fixed:#1695 对资源属性进行检测 2024-04-07 21:35:40 +08:00
pixelmaxQM d1e055430d feature:前端自动化增加分包 2024-04-07 21:20:27 +08:00
pixelmaxQM 736534379a fixed:字典限制仅字符串模式可选择 2024-04-07 20:40:02 +08:00
pixelMax(奇淼 f6b71e157c fixed:升级postgres的驱动到1.5.7 2024-04-07 10:16:51 +08:00
ShuBo6 53e9f931f2 fix: 应该调用filepath.Ext的地方调用了path.Ext (#1696)
* fix: 应该调用filepath.Ext的地方调用了path.Ext

* fix: typo
2024-04-03 16:25:09 +08:00
PiexlMax(奇淼 c226a9476f Merge pull request #1694 from xue-ding-e/main
增加redis集群设置
2024-03-31 17:51:56 +08:00
pixelmaxQM 8ca5600286 feature: 修改版本号发布v2.6.2 2024-03-31 17:50:07 +08:00
薛定饿了不养喵 9729bc00a0 删掉了不必要的增加(就是之前说的那个样式bug其实不是bug)
style="width:194px"
2024-03-31 03:58:55 +08:00
xuedinge f9c9af8261 增加redis集群连接方式 2024-03-31 01:15:20 +08:00
薛定饿了不养喵 c9e64373fb Merge branch 'flipped-aurora:main' into main 2024-03-31 00:33:51 +08:00
pixelmaxQM 262febf486 feature:增加API导入导出,方便填写录入,暂时屏蔽自动书写导入的创建时间的功能,等待gorm合并pr后恢复。 2024-03-30 20:54:34 +08:00
pixelmaxQM eca9c4d7f8 fixed:#1692 统一前端操作模式 2024-03-29 20:53:19 +08:00
薛定饿了不养喵 a20083bb9c Merge branch 'flipped-aurora:main' into main 2024-03-28 01:59:21 +08:00
piexlMax d31b01415b feature:自动化代码支持基础菜单创建 2024-03-27 21:18:34 +08:00
piexlMax 26cdb472f0 feature:自动创建基本菜单 2024-03-27 20:55:03 +08:00
pixelMax(奇淼 3c2595aaf9 feature:调整jwt令牌过期展现形式和返回错误编码形式,方便用户重新登录和知晓错误原因。 2024-03-27 17:35:24 +08:00
PiexlMax(奇淼 ad323a0dff Update config.js 2024-03-27 16:48:22 +08:00
PiexlMax(奇淼 9a0417b1a7 Update server.go 2024-03-27 16:47:59 +08:00
PiexlMax(奇淼 3324a816ee Update README.md 2024-03-27 16:47:32 +08:00
piexlmax(奇淼 cc4135a2d7 feature:禁止选中角色的子以及后代节点 2024-03-27 10:45:19 +08:00
piexlmax(奇淼 2d884c83cc feature:调整jwt续期功能,保证新的token返回和一致性 2024-03-27 10:39:19 +08:00
piexlmax(奇淼 619c5b5e1d feature:消除icon缓存 2024-03-27 10:11:19 +08:00
傅鹏 33afa9adfc feat: ignore go debug bin file (#1687)
* fix: k8s cpu num

* feat: ignore go debug bin file
2024-03-25 13:38:40 +08:00
CC11001100 0c141cc6f7 fix: 应该调用filepath.Join的地方调用了path.Join (#1688) 2024-03-25 13:38:22 +08:00
傅鹏 efdff2ab0c fix: k8s cpu num (#1685) 2024-03-21 10:16:06 +08:00
hooraymanand胡浩 ebefb0eba4 feat: docker-compose healthz check (#1680)
Co-authored-by: 胡浩 <huhao@anesec.cn>
2024-03-20 15:08:39 +08:00
奇淼(piexlmax d4b9c2c97b loading增加定制属性,可自行配置 (#1683)
* feature:增加区域loading功能

* feature:增加修改loading配置
2024-03-20 10:44:21 +08:00
piexlMax d4db16b501 增加json model模板 2024-03-18 22:32:14 +08:00
piexlMax a5cbd7387b feature:#1647 自动化代码支持纯json 2024-03-18 22:25:50 +08:00
piexlMax 99d6b4a361 feature:#1671调整字典的value属性为string 自动化模板随改 2024-03-18 21:44:14 +08:00
piexlMax 18365689e6 调整字典的value属性为string 不再限制为int 2024-03-18 21:23:53 +08:00
piexlMax 8ea827412a 同步清理前端timer配置 2024-03-17 12:52:57 +08:00
piexlMax 4d8979c4ad 调整抽屉框格式 2024-03-16 00:29:03 +08:00
piexlMax 236357baa8 调整自动化代码的新增,编辑,删除为抽屉模式 2024-03-16 00:22:36 +08:00
piexlMax 5ef4b21858 增加表格导出多数据库支持 2024-03-15 23:22:20 +08:00
piexlmax(奇淼 3b3441851c feature:保证存在GVA默认结构的表格导入自动填充created和updated 2024-03-15 14:55:20 +08:00
piexlmax(奇淼 5517987e14 feature:保证表格导出的列顺序和json录入顺序一致 2024-03-15 11:38:34 +08:00
奇淼(piexlmax 7e98f61bec Revert "fix:保证excel每次导出列顺序一致 (#1677)" (#1678)
This reverts commit e2d360e8b1.
2024-03-15 11:23:21 +08:00
e2d360e8b1 fix:保证excel每次导出列顺序一致 (#1677)
* fix:保证excel每次导出列顺序一致

* Update sys_export_template.go

---------

Co-authored-by: Li vito <vito.li@shopee.com>
Co-authored-by: 奇淼(piexlmax <qimiaojiangjizhao@gmail.com>
2024-03-15 11:16:24 +08:00
piexlmax(奇淼 57cfedfd7c typo修复,正则字符串修复 2024-03-14 14:50:41 +08:00
piexlMax 50b1d21d13 调整删除方法 放弃使用el-popover 删除操作使用弹窗提示 2024-03-13 22:37:07 +08:00
Alex Lin 7b79ec6c66 fixed: api管理中的 popover 触发改为 click (#1673) 2024-03-13 20:14:27 +08:00
piexlmax(奇淼 7a5b31530f 清理错误提交的测试代码 2024-03-13 16:25:01 +08:00
piexlmax(奇淼 e9100a9542 替换v-model API 为 defineModel 2024-03-13 15:17:57 +08:00
piexlmax(奇淼 421304d4a3 提升最低VUE版本至3.4.x 2024-03-13 14:49:28 +08:00
piexlMax 10d61bbbb3 导出功能可传入limit、offset和order,优先级高于默认配置 2024-03-12 21:08:25 +08:00
piexlmax(奇淼 095709fb19 fixed:退出只清理特定的localStorage 不再进行全部清理操作 2024-03-11 11:47:59 +08:00
piexlMax 725f4150fc 统一调整element form inline元素的属性 2024-03-07 22:35:02 +08:00
andywu1998 93ac2e70d2 feat(gin.Mode()): 由环境变量决定,不再依赖于配置文件system.Env (#1668)
* feat(gin.Mode()): 由环境变量决定,不再依赖于配置文件system.Env

* feat(casbin):不需要判断是否是debug模式,都要附带参数

* feat(前端配置):去掉环境之的配置
2024-03-06 23:38:17 +08:00
andywu1998 f4c2b50ca5 feat(config init log): modify constant value GIN_MODE to gin.Mode() (#1667) 2024-03-06 22:32:42 +08:00
piexlMax 3354edbb1c 在初始化时候添加excelTemplate的关联表 2024-03-06 22:22:27 +08:00
piexlMax d3600499af fixed:剔除错误提交的测试用代码 2024-03-06 00:19:17 +08:00
奇淼(piexlmax 35e2c2cfe8 feature:表格导出支持配置limit order和where条件 (#1665)
* feature:导出功能可携带条件

* feature:组件增加导出入参

* 带条件导出Excel功能
2024-03-05 23:29:59 +08:00
piexlmax(奇淼 1e4970469f publish:调整版本号v2.6.1 2024-03-04 17:06:34 +08:00
piexlMax 4cbfd7c9b1 消除el-descriptions的warning 2024-03-03 17:35:38 +08:00
piexlmax(奇淼 deb32fa0fa fixed:#1659 调整table中sort驼峰对应不到数据库字段的问题 2024-03-01 11:04:52 +08:00
piexlmax(奇淼 f17a738780 fix:switchTab,query=>params。 2024-03-01 10:04:18 +08:00
piexlmax(奇淼 2f53d0efae feat:增加全局订阅switchTab,用户可以给tab添加参数跳转且不打开新tab。 2024-02-29 18:06:29 +08:00
piexlmax(奇淼 3e43c2e6e6 type:限=>线 2024-02-29 16:34:53 +08:00
piexlmax(奇淼 96919a9f79 fix:取消重复方法 2024-02-29 16:34:08 +08:00
piexlmax(奇淼 a23fb627cd feat:#1658 增加全局订阅 setQuery 用户可以动态变更当前页query而不产生新的tab 2024-02-29 16:32:09 +08:00
Leo Wang aae915b092 fix: 解决build时,会有浏览器缓存问题。 (#1661) 2024-02-29 16:26:45 +08:00
Leo Wangand奇淼(piexlmax 160c8e814b bugfix:修复新增菜单强制默认icon的bug;修复production环境变量容易造成困惑的问题; (#1660)
* fix: 解决每次新增菜单时,默认都会选中第一个aim图标的问题

* fix: 修订production的环境变量,去除那些在生产环境会造成困惑的项目

* Update .env.production

合理性调整

---------

Co-authored-by: 奇淼(piexlmax <qimiaojiangjizhao@gmail.com>
2024-02-29 16:18:07 +08:00
piexlmax(奇淼 88f48baba1 feat:#1658 增加全局订阅 setQuery 用户可以动态变更当前页query而不产生新的tab 2024-02-29 16:08:36 +08:00
piexlMax 7835efbf37 调整自动化代码模板的格式 2024-02-26 23:09:51 +08:00
shan_lu 455fbb505e fix the word spelling error for acitveAxios (#1655) 2024-02-23 11:31:15 +08:00
ipanghuand陶正虎 df3f7090e8 fix:修改操作记录中间件,文件类型统一记录为[文件] (#1656)
Co-authored-by: 陶正虎 <zhenghu.tao@jutze.com.cn>
2024-02-23 11:30:52 +08:00
piexlmax(奇淼 632b3c200c 调整cookie写入方法 2024-02-22 13:43:53 +08:00
piexlmax(奇淼 5b203326ae 清理文本输出之前的sleep 2024-02-21 17:44:25 +08:00
piexlMax fd87aca57d 前端跟随增加cookie管理方法,防止后端无法设置cookie的情况下导致的某些功能不可用问题。 2024-02-20 16:06:08 +08:00
piexlMax b9b7e556e3 修复表格导出和模板导出的bug 2024-02-20 15:06:17 +08:00
piexlmax(奇淼 5b9a7e6a2a 调整mssql自动化 2024-02-19 10:48:38 +08:00
rightSun d278e19367 dictionary.js update 优化字典文字展示方法 (#1652)
优化字典文字展示方法
新增可配置的参数 keyCode 和valueCode 使用字典字段更加灵活
2024-02-07 17:40:01 +08:00
piexlmax(奇淼 342030ca47 Merge remote-tracking branch 'origin/main' 2024-02-04 17:47:43 +08:00
piexlmax(奇淼 f90e241cc9 调整mssql初始化 2024-02-04 17:47:30 +08:00
lenandwangshenglei ff6bcc437c [Bug]:修复使用页面内按钮权限不生效问题 (#1621)
Co-authored-by: wangshenglei <wangshenglei@zhuanzhuan.com>
2024-02-04 11:36:06 +08:00
G-XD e32dbb5125 fix: 更新api路径时使用binary区分大小写进行查询 (#1645)
* fix: 更新api路径时使用`binary`区分大小写进行查询

* fix: 修改相同api路径判断逻辑
2024-02-04 11:35:45 +08:00
Sonui 06701cc7d1 fix(Server): 静态资源目录错误 (#1648) 2024-02-04 11:33:29 +08:00
piexlMax ccb31bc1b4 调整静态文件读取 防止文件目录暴露 2024-01-30 23:33:38 +08:00
myface-wang 7e2e29e2e8 Update svgIcon.vue (#1642)
删除不必要的导入,defineProps
2024-01-30 22:56:02 +08:00
piexlMax 0c76995f6d 修复菜单select展示的bug 2024-01-30 22:43:22 +08:00
piexlMax 17cab8fcb7 更换版本号 2024-01-28 16:40:08 +08:00
Krane d64753859d 解决drawer和dialog层级冲突问题 (#1640) 2024-01-26 14:35:54 +08:00
piexlMax 48b1c24c95 [fixed]:修复超出26个英文字母后表格的导出导入bug 2024-01-25 19:41:52 +08:00
piexlmax(奇淼 7e5e12b139 前端dist代码位置变更 2024-01-25 16:14:28 +08:00
59ba4752c0 [server/config/system.go]: fix a comment error (#1638)
Co-authored-by: liweiwu.wlw <liweiwu.wlw@xiaoman.cn>
Co-authored-by: 奇淼(piexlmax <303176530@qq.com>
2024-01-24 16:01:36 +08:00
piexlmax(奇淼 189219c673 typo修复 2024-01-24 15:59:02 +08:00
piexlmax(奇淼 4b54262edd Merge remote-tracking branch 'origin/main' 2024-01-24 15:50:37 +08:00
piexlmax(奇淼 458b035a7e 增加字典方法 GetDictionaryList,GetDictionaryListByType,GetDictionaryInfoByValue, GetDictionaryInfoByTypeValue 方便后台直接获取字典属性
前端增加extend属性获取
2024-01-24 15:50:15 +08:00
piexlmax(奇淼 abe85cf6e7 增加字典方法 GetDictionaryList,GetDictionaryListByType,GetDictionaryInfoByValue, GetDictionaryInfoByTypeValue 方便后台直接获取字典属性
前端增加extend属性获取
2024-01-24 15:50:14 +08:00
奇淼(piexlmax 379b63275a 自动化代码可选不使用官方global.Model结构 (#1637)
* 自动化代码可自行选择默认结构

* 调整自动化模板

* 增加自动化模板中对timer的处理
2024-01-22 17:37:03 +08:00
yunshengand01471076 07cde689b1 mongo use auth-source (#1635)
Co-authored-by: 01471076 <yangyunsheng.it@haier.com>
2024-01-20 12:33:27 +08:00
薛定饿了不养喵 26606f138d 修改样式 系统工具 -> 代码生成器 下的 '点这里从现有数据库创建代码' 内容显示不全 (#1632) 2024-01-20 12:33:10 +08:00
haimait 24c4774f7e 代码打包的插件,从后台安装失败,认不到目录的问题 (#1634)
https://github.com/flipped-aurora/gin-vue-admin/issues/1633
2024-01-20 12:32:59 +08:00
xuedinge 6bbb4f577e 修改样式 系统工具 -> 代码生成器 下的 '点这里从现有数据库创建代码' 内容显示不全 2024-01-18 18:48:47 +08:00
piexlMax(奇淼 4890de5052 Merge remote-tracking branch 'upstream/main' 2024-01-18 13:16:52 +08:00
haimait 746af37899 解决打包插件解压报错的问题 (#1630)
https://github.com/flipped-aurora/gin-vue-admin/issues/1628
2024-01-18 13:16:39 +08:00
haimait 0136ce7034 解决打包插件解压报错的问题 (#1630)
https://github.com/flipped-aurora/gin-vue-admin/issues/1628
2024-01-18 13:11:54 +08:00
piexlMax(奇淼 5ca47a91a6 开发环境允许设置cookie 2024-01-18 13:08:14 +08:00
piexlMax(奇淼 d849df41be 代码定位功能默认关闭。 2024-01-17 16:05:32 +08:00
奇淼(piexlmax a2269bcdd5 优化自定义图标功能,修复上线后无法展示自定义图标的问题。 (#1625)
* 修改自定义图标使用方式

* 优化自定义icon功能
2024-01-16 22:07:59 +08:00
ipanghu d41394c70a fix:修复首页 dashboard echarts 页面变化导致的变性, 修复 vite.config.js 中 proxy 代理 https 时的 bug (#1623)
add : 添加 “@vueuse/core” 的依赖,添加全局 hooks (use-windows-resize)使用方法查看 dashboard 页面
2024-01-15 13:10:42 +08:00
haimait 756f73bbd2 修复代码生成器 列表中数据库字段描述回显错误 (#1622) 2024-01-15 13:10:24 +08:00
piexlMax 95eb17b6d1 [fixed]:默认注释静态资源 2024-01-13 12:38:07 +08:00
piexlMax 773fd1f221 Merge remote-tracking branch 'origin/main' 2024-01-13 12:09:49 +08:00
piexlMax c95b436680 [fixed]:静态资源基础path修复 2024-01-13 12:08:37 +08:00
piexlmax(奇淼 3f47151678 默认增加 gorm.io/datatypes 2024-01-11 15:57:20 +08:00
piexlmax(奇淼 dbf1e7136c 调整更换绑定后的自动化代码结构 2024-01-11 15:56:38 +08:00
piexlMax 84b44eef91 [fixed]:调整过期token更换new-token时间,防止多机操作业务延迟带来的token失效的bug 2024-01-08 21:50:25 +08:00
piexlMax 686ada1e49 [fixed]:调整自动化表格TemplateInfo字段类型为text防止超长 2024-01-08 19:55:21 +08:00
piexlmax(奇淼 d9f6bc058a 调整自动化验证为gin自带binding tag 2024-01-08 16:45:19 +08:00
piexlMax 6f531793f0 清理错误添加的测试代码 2024-01-06 17:26:39 +08:00
piexlMax f8794bef5f 导入导出功能性bug修复 2024-01-06 16:16:50 +08:00
piexlMax 9daf103669 增加导入成功回调 2024-01-05 23:27:59 +08:00
piexlMax 26fa047fe4 基于cookie模式下,剔除所有的上传文件的x-token头 2024-01-05 23:13:04 +08:00
piexlMax 1a04bb535d 增加表格导入,增加导入模板下载,修复日志中间件的截断bug。 2024-01-05 23:09:07 +08:00
piexlMax ad41b7b434 [fixed]:初始化添加自动导出功能表 2024-01-05 21:28:57 +08:00
piexlMax 6791b1dbdc [fixed]:修复切换角色不生效的bug 2024-01-05 20:11:16 +08:00
piexlMax dc1b84130c 完善cookie模式 2024-01-04 22:25:13 +08:00
piexlMax e70a933090 完善cookie模式 2024-01-04 22:21:37 +08:00
piexlMax 08617f2fd4 完善cookie模式 2024-01-04 22:15:54 +08:00
thy 8aefb5db8e feat: 开启recovery (#1615) 2024-01-04 17:06:52 +08:00
piexlMax(奇淼 e1d214b91a 剔除GPT相关功能,后续独立新开源项目制作。 2024-01-03 14:49:28 +08:00
奇淼(piexlmax 0285de50e5 修复#1611提及的反引号导致pgsql搜索不支持的bug (#1612) 2024-01-03 11:21:08 +08:00
piexlmax(奇淼 5f7caa0535 降低自定义button圆角权重 2024-01-02 17:23:34 +08:00
piexlMax df9d2bc472 消除误提交的测试代码 2023-12-31 20:22:47 +08:00
piexlMax a923b6beca 更新版本号2.5.9 2023-12-31 11:09:00 +08:00
piexlMax 760ef77593 消除误提交的测试代码 2023-12-30 20:49:24 +08:00
piexlMax 64f703856e 调整初始化信息 2023-12-30 20:42:24 +08:00
piexlMax 36eba36bf2 调整建表结构 2023-12-30 20:32:05 +08:00
piexlMax 332176a619 增加新功能初始化数据 2023-12-30 20:29:49 +08:00
piexlMax cd5b60c8cc 增加excel模板配置,增加前端导出工具。token迁移至cookie x-token且保留header x-token 两者兼容。 2023-12-30 20:29:47 +08:00
thy 5ea8947fc9 feat: 将placeholder替换为tooltip (#1606) 2023-12-28 09:55:32 +08:00
piexlmax(奇淼 474a5c8e42 清理RemoveTaskByName的重复锁导致系统卡死的问题 2023-12-26 09:53:26 +08:00
piexlMax 952062d5be 调整弹出气泡无法取消的bug 2023-12-25 22:04:27 +08:00
奇淼(piexlmax c071564de4 Update ci.yaml 2023-12-25 10:26:50 +08:00
huoxiao b2fa7563d3 web/src/view/routerHolder.vue:Fix Vue warn Component inside <Transition> renders non-element root node that cannot be animated (#1603) 2023-12-25 09:53:45 +08:00
piexlmax(奇淼 22f68fedcb swag文档默认属性调整 2023-12-22 10:27:51 +08:00
奇淼(piexlmax 0a4cda26cb Update README.md 2023-12-22 10:19:21 +08:00
piexlmax(奇淼 54eb84e690 将task拆分为cron与task两部分,使其呈现父子结构,切单独可控。 2023-12-22 10:08:54 +08:00
piexlmax(奇淼 5cd33814fc 将task拆分为cron与task两部分,使其呈现父子结构,切单独可控。 2023-12-22 09:55:57 +08:00
奇淼(piexlmax 90f19679e7 Update README.md 2023-12-19 17:26:43 +08:00
奇淼(piexlmax 38ade9e498 Update go.mod 2023-12-19 17:26:07 +08:00
faker-wang 4c77831001 zapcore.WarnLevel修改成zapcore.ErrorLevel (#1602) 2023-12-19 17:17:02 +08:00
piexlMax 722fe556e3 增加初始字典内容,兼容自动化使用pgsql读取表的数据格式 2023-12-17 17:40:00 +08:00
xinyan818 98b83c0078 fix: typo (#1591) 2023-12-13 15:01:35 +08:00
yang hao 85646b5ffa sys_auto_code fix: log文字提示错误 (#1592) 2023-12-13 15:01:19 +08:00
Zmzblink d3f5ed7d60 修改el-tag中type属性的默认值, type属性枚举不包含primary (#1593) 2023-12-13 15:01:02 +08:00
piexlmax(奇淼 e0a8e93704 定位功能调整为 shift+alt+左键 2023-12-12 10:50:23 +08:00
piexlmax(奇淼 3aab5e9eb7 路由增加meta.client 属性,添加本属性为true则跳过前端路由拦截器 2023-12-11 16:28:40 +08:00
piexlMax 2307ac88cb 对不合法名称icon做检测停止加入图标库 2023-12-10 23:47:30 +08:00
piexlMax 0f2018d913 增加自动icon功能,所有添加到web/assets/icons下的svg会自动被注册为icon组件使用【可用于menu和直接用标签加文件名使用】 2023-12-10 23:30:39 +08:00
piexlMax 8b9a75ba5a 清除ast中无用的测试用例 2023-12-06 23:06:43 +08:00
SliverHorn 7872e0ce38 Update: 修复mongodb index默认name太长而导致创建索引失败, 在组装keys数据进行排序以便符合bson.M的构造 (#1580) 2023-12-05 23:04:23 +08:00
xinyan818 d28ac73987 fix: use db list (#1588) 2023-12-05 23:03:54 +08:00
ning2510 2c8c7a8b51 Update ast_gorm_test.go (#1587) 2023-12-05 23:01:50 +08:00
奇淼(piexlmaxandyang hao f98fc6bf3c swag中id错误问题的修复 (#1589)
* model.go: fix swagger请求的id问题

* 验证码逻辑修回

---------

Co-authored-by: yang hao <1013055366@qq.com>
2023-12-05 23:01:27 +08:00
奇淼(piexlmax d42958734f 清理掉定时任务config配置,修改为代码内书写 (#1584) 2023-12-04 22:12:01 +08:00
piexlMax 6f2c785713 调整为新的timer模式 增加每个task内具体方法的描述方便对接后续的页面控制 2023-12-04 22:12:01 +08:00
奇淼(piexlmax 05a1ce51f0 清理掉定时任务config配置,修改为代码内书写 (#1584) 2023-12-04 22:05:19 +08:00
piexlMax(奇淼 58b063770d 调整swag 2023-12-01 14:42:54 +08:00
Sun Dadiand奇淼(piexlmax 6f9a83709d [selectImage.vue]: 增加selectImage组件,最多上传图片的功能 (#1568)
* 增加selectImage组件,最多上传图片的功能

* 增加selectImage组件,最多上传图片的功能

* Update config.yaml

* Update config.yaml

---------

Co-authored-by: 奇淼(piexlmax <qimiaojiangjizhao@gmail.com>
2023-11-21 22:54:39 +08:00
奇淼(piexlmax bd2a3ddfba 清理掉定时任务config配置,修改为代码内书写 (#1578) 2023-11-20 23:38:15 +08:00
SliverHorn 4433b6623e Merge pull request #1577 from flipped-aurora/transaction
[feature]:调整角色的创建,删除操作为事务模式
2023-11-19 14:17:30 +08:00
piexlMax e1ca17637f casbin相关操作修改为事务 2023-11-19 11:50:30 +08:00
ZongQiangandzongqiang 5ef0e43312 缺少事务可能出现数据不一致风险 (#1575)
Co-authored-by: zongqiang <zongq@rp-pet.cn>
2023-11-18 22:20:26 +08:00
aa6ca95f13 初始化失败panic (#1573)
* 初始化失败panic

* Update gorm_mssql.go

* Update gorm_pgsql.go

* Update gorm_mysql.go

---------

Co-authored-by: zongqiang <zongq@rp-pet.cn>
Co-authored-by: 奇淼(piexlmax <qimiaojiangjizhao@gmail.com>
2023-11-18 21:01:44 +08:00
奇淼(piexlmax 2523467c97 Update LICENSE 2023-11-15 16:31:51 +08:00
奇淼(piexlmax b38eb6709e Update README.md 2023-11-14 10:38:25 +08:00
piexlMax(奇淼 f6dacdb046 优化自动化模板,防止按钮被折叠 2023-11-13 11:03:51 +08:00
piexlMax(奇淼 cc0903f74d 调整表格的适配性 2023-11-13 10:53:30 +08:00
piexlMax(奇淼 72936fc0d1 版权信息不再和appName绑定 2023-11-07 14:48:22 +08:00
SliverHorn 4b7f552885 Merge pull request #1569 from 729343861/main
web/src/view/systemTools/system/system.vue : fix 图形验证码配置 bug
2023-11-06 11:25:17 +08:00
729343861 9b2fc60d79 web/src/view/systemTools/system/system.vue : fix 图形验证码配置 bug 2023-11-06 11:09:12 +08:00
piexlMax 3e5a26b95a 修改开发环境的中间件 2023-11-04 21:48:01 +08:00
SliverHorn a5f3139784 fixed: deploy/docker/Dockerfile #1518 (#1567) 2023-10-31 17:52:38 +08:00
piexlMax 9ca9fcdb09 SelectFile组件建议添加limit和accept属性,控制文件的上传数量和类型 2023-10-26 22:41:37 +08:00
piexlMax 913db35b23 添加分配菜单和分配api的滚动条 2023-10-26 22:26:04 +08:00
piexlMax(奇淼 8eba3ba4f7 修复字典展示bug
修复自动化代码字典类型渲染bug
2023-10-25 17:14:09 +08:00
piexlMax(奇淼 5bd0f24a84 增加package为空判断 #1564
Co-authored-by: @saikey0379
2023-10-24 18:42:50 +08:00
piexlMax e8fb3180db 字典使用模式调整 2023-10-22 20:59:47 +08:00
SliverHorn 232aaad090 feature: mongoDB 支持 (#1565)
* feature: mongoDB 支持

* update: 修改错误mongo索引示例

* update: 在system添加use-mongo 开关开启或者关闭mongo
2023-10-14 13:59:30 +08:00
piexlMax(奇淼 b3dbb8d4be 解决打包错误的bug 2023-10-10 18:57:46 +08:00
piexlMax(奇淼 3caf070056 优化打包 2023-10-10 18:52:39 +08:00
piexlMax(奇淼 1e24bbc3e2 修复UI BUG #1562 2023-10-10 16:46:08 +08:00
18694fd24a 修复富文本bug,调整日志输出,修复已知bug (#1563)
* operation.go: fix 调用respPool.Put归还对象前清空对象会造成下次调用无法正常copy
redis.go: fix NewDefaultRedisStore方法实例化的对象直接使用会造成空指针异常

* 设置为发布模式时gin不再输出路由信息log

* 调整基础配置文件

* 修复富文本不回显的bug

---------

Co-authored-by: liuyahui <liuyahui@wjacloud.com>
Co-authored-by: Alan <alan.cd@qq.com>
Co-authored-by: wuqianang <wuqianang@163.com>
Co-authored-by: task <ms.yangdan@gmail.com>
2023-10-10 16:41:55 +08:00
piexlMax(奇淼 10dc003f20 修复富文本未创建前端输入字段的bug 2023-10-10 16:04:23 +08:00
809e2496c0 增加了自动化视频以及修复了一些已知漏洞 (#1554)
* 解决bug:为角色添加权限时,如果有重复api权限,该角色所有权限均添加失败(包括登录)

* 支持视频上传和选用。视频首帧作为封面预览。

* 增加自动化代码视频选项

* 媒体库可上传视频
SelectImage组件增加参数file-type="image|video" 方便用户对媒体库可选内容做限制

* 自动化代码bug修复

---------

Co-authored-by: liuyahui <liuyahui@wjacloud.com>
Co-authored-by: Alan <alan.cd@qq.com>
2023-09-24 15:49:58 +08:00
奇淼(piexlmax c1c37901b5 Merge pull request #1550 from Suixinee/main
初步构建了文件预览组件
2023-09-24 14:50:57 +08:00
SliverHorn 44e115f211 update: 去掉 github.com/lestrrat-go/file-rotatelogs 库的依赖, 实现zap.String("business", "xx")自定义业务日志数据路径, 输出文件路径为./global.GVA_CONFIG.Zap.Director/2006-01-02/xx/level(debug, info, warn, error, dpanic, panic, fatal).log (#1551) 2023-09-24 14:35:54 +08:00
ipanghu 217cc338a8 fix:修复自动代码的详情页面的bug,选择器,输入框添加 中文名称 (#1552) 2023-09-24 14:35:34 +08:00
suixinee 81eccc177d 初步文件预览组件构建 2023-09-22 10:47:16 +08:00
碎心Eand奇淼(piexlmax 4ea00b7e7b 调整了文件上传无法异步赋值的bug (#1547)
* watch了immediate参数,防止组件异步调用获取数据失败的问题

* watch添加了immediate参数,防止组件异步调用获取不到数据

* Update selectFile.vue

---------

Co-authored-by: 奇淼(piexlmax <qimiaojiangjizhao@gmail.com>
2023-09-19 16:08:35 +08:00
奇淼(piexlmax 844699263d Update selectFile.vue 2023-09-19 16:08:14 +08:00
suixinee d72a548852 watch添加了immediate参数,防止组件异步调用获取不到数据 2023-09-19 12:05:21 +08:00
suixinee 722ed9bece watch了immediate参数,防止组件异步调用获取数据失败的问题 2023-09-19 11:57:41 +08:00
SummerBytes 8852367837 codeServer: fix 删除无用代码 (#1541) 2023-09-15 11:50:10 +08:00
piexlMax 5559f9b9af 调整模板代码中的中文解释 2023-09-15 11:44:16 +08:00
piexlMax 39526edafd 代码模板调整name挂载位置 2023-09-14 18:49:59 +08:00
piexlMax a4f86354d3 前端eslint调整 2023-09-14 18:47:47 +08:00
piexlMax 636204bbaf 修复eslint问题 2023-09-14 18:06:26 +08:00
piexlMax 08494834c2 字典增加扩展值字段,优化自动化生成搜索条件默认语句。 2023-09-13 21:33:36 +08:00
piexlMax 2247f34b89 修改富文本组件默认高度 2023-09-13 11:42:25 +08:00
tomoyo233 5c84412238 Update sys_user.go (#1540)
验证码bug修复
2023-09-10 23:03:14 +08:00
piexlMax 13112aa4d8 调整table模板让详情功能适配多种数据类型 2023-09-10 00:27:46 +08:00
zyw0605688 836a165ff2 bugfix:'升级gin-swagger到最新版,解决swagger-ui界面上的Cannot read properties of undefined (reading '1')报错' (#1538) 2023-09-09 13:17:17 +08:00
piexlMax f36e0b39ed 修复#1537 环境变量不生效的问题 2023-09-09 11:25:55 +08:00
Jamieandmazhenming 74e2ec74e0 resource/autocode_template/server/model.go.tpl: swag文档添加中文信息 (#1535)
Co-authored-by: mazhenming <zhenmingma@qq.com>
2023-09-09 11:03:04 +08:00
zyw0605688 bcb6243f3b 批量删除按钮,未选中内容时不应该弹出确定提醒 (#1536)
table的批量删除按钮,未选中内容时候,悬浮提醒不应该显示。增加以下代码
:disabled="!multipleSelection.length"
2023-09-09 11:02:26 +08:00
piexlMax c00b628fb4 [fixed]修复业务库生成代码回滚时候删表位置错误的bug。 2023-09-08 16:54:41 +08:00
piexlMax 2fbed17ebc [fixed]修复业务库生成代码gorm自动迁移数据库name错误的问题。 2023-09-08 16:37:58 +08:00
Felixs 7bfea23958 补充form.vue里遗漏的SelectFile自动化组件 2023-09-06 11:40:30 +08:00
Felixs 91c567779b 恢复 btnAuth 2023-09-05 11:00:36 +08:00
piexlMax c4aeeb419e [update] 清理了一些无用文件 2023-08-31 18:17:06 +08:00
piexlMax 7808fbb852 [fixed] 修复富文本未引入watch的问题 #1528 2023-08-31 12:27:18 +08:00
wangzmgitandwangziming 9e64bd474b fix: 修复菜单折叠后再次展开右侧出现遮罩的问题 (#1529)
Co-authored-by: wangziming <wangziming@emsys.cn>
2023-08-31 11:18:19 +08:00
lubinandlubin 25a6aef472 修复接口实现问题 (#1524)
Co-authored-by: lubin <lubin@xiaoduotech.com>
2023-08-30 14:33:52 +08:00
zyw0605688 203ba521b0 分页列表接口,兼容不分页获取全部数据 (#1526)
* feat:'分页列表接口,兼容不分页获取全部数据'
2023-08-29 20:08:22 +08:00
piexlMax 287685420a [fixed]: 枚举类型条件查询的错误 #1525 2023-08-29 16:17:56 +08:00
piexlMax a6ae0ba4b0 富文本组件增加watch防止富文本无法加载的情况发生。 2023-08-23 18:12:03 +08:00
andywu1998 208346a480 优化config字段排列,使得内存对齐 (#1521)
* 调整字段顺序,解决config包内存对齐问题

* fix(config):修复内存对齐
2023-08-21 18:14:44 +08:00
DaMingandCodeLucifer 0d5c55a3b5 修复上次提交忘记把文件类型下载按钮描述的{{}}设置为字符串 (#1520)
* 修复上次提交忘记把文件类型下载按钮描述的{{}}设置为字符串
---------

Co-authored-by: CodeLucifer <tender_zhu@foxamil.com>
2023-08-19 22:49:29 +08:00
piexlMax 4fcd2bf14c 修改静态目录打包的配置 2023-08-19 11:29:44 +08:00
SDProgrammerandShi Dapeng deea1aba7f fix:修复不同系统环境下创建db文件路径错误的问题 (#1512)
Co-authored-by: Shi Dapeng <shidapeng@cmdi.chinamobile.com>
2023-08-17 17:23:14 +08:00
zhanghaixin246 3e31666cd6 feat:抛出上传文件错误信息 (#1515) 2023-08-17 17:22:50 +08:00
DaMingandCodeLucifer 197c4c46ab 生成代码模版文件新增了查看详情、详情内图片预览、文件下载 (#1516)
* 生成代码模版文件新增了查看详情、详情内图片预览、文件下载
前端工具文件主要修改了utils>format.js

* 替换富文本组建路径

---------

Co-authored-by: CodeLucifer <tender_zhu@foxamil.com>
2023-08-17 17:22:30 +08:00
753 changed files with 74397 additions and 19968 deletions
+902
View File
@@ -0,0 +1,902 @@
### 功能描述以及必要性描述
---
name: gin-vue-admin
description: |
gin-vue-admin 是一个基于现代化技术栈的全栈管理系统框架。
前端技术栈:
- Vue 3.5.7 + Composition API
- Vite 6.2.3 构建工具
- Pinia 2.2.2 状态管理
- Element Plus 2.10.2 UI组件库
- UnoCSS 66.4.2 原子化CSS框架
- Vue Router 4.4.3 路由管理
- Axios 1.8.2 HTTP客户端
- ECharts 5.5.1 数据可视化
- @vueuse/core Vue组合式API工具集
后端技术栈:
- Go 1.23 + Gin 1.10.0 Web框架
- GORM 1.25.12 ORM框架
- Casbin 2.103.0 权限管理
- Viper 1.19.0 配置管理
- Zap 1.27.0 日志系统
- Redis 9.7.0 缓存
- JWT 5.2.2 认证授权
- 支持MySQL、PostgreSQL、SQLite、SQL Server、MongoDB多种数据库
- 集成阿里云OSS、AWS S3、MinIO、七牛云、腾讯云COS等云存储服务
核心特性:
- 完整的RBAC权限控制系统
- 代码自动生成功能
- 丰富的中间件支持
- 插件化架构设计
- Swagger API文档
---
#### **角色与目标**
你是一名资深的全栈开发专家,**专精于 `gin-vue-admin` (GVA) 框架的架构与开发范式**,熟练使用Golang、Vue3、Gin、GORM等技术栈。
你的核心任务是,根据需求开发**完整、生产级别的全栈功能包或插件**。你必须严格遵循 GVA 的分层架构、代码规范和核心设计模式,确保你生成的每一部分代码都能无缝集成到现有项目中。
---
### **🚀 重要提示:GVA Helper MCP 支持**
**在开始任何GVA开发工作之前,请务必注意以下重要工作流程:**
1. **MCP支持**: GVA框架本身支持MCP(Model Context Protocol),提供了强大的开发辅助能力
2. **GVA Helper**: 通常会有一个名为 "**GVA Helper**" 的MCP助手,专门为GVA框架开发提供支持
3. **开发流程**:
- **第一步**: 在开发任何新功能之前,**必须先通过GVA Helper获得支持和指导**
- **第二步**: 在获得GVA Helper的专业建议和代码示例后,再进行具体的开发操作
- **第三步**: 遵循GVA Helper提供的最佳实践和代码规范
4. **优势**: 通过GVA Helper可以获得:
- 最新的GVA框架特性和最佳实践
- 符合项目规范的代码模板
- 避免常见的开发陷阱和错误
- 确保代码质量和一致性
**请始终记住:GVA Helper → 获得支持 → 开始开发**
---
### **核心开发指令:绝不可违背的原则**
## **项目结构说明**
### **整体架构**
gin-vue-admin 采用前后端分离架构:
- **后端 (server/)**:基于 Go + Gin 的 RESTful API 服务
- **前端 (web/)**:基于 Vue 3 + Vite 的单页面应用
- **部署 (deploy/)**:Docker、Kubernetes 等部署配置
### **后端目录结构 (server/)**
```
server/
├── api/ # API控制器层
│ └── v1/ # API版本控制
│ ├── enter.go # API组入口文件
│ ├── system/ # 系统模块API
│ └──example/ # 示例模块API
├── config/ # 配置结构体定义
├── core/ # 核心启动文件
├── docs/ # Swagger文档
├── global/ # 全局变量和模型
├── initialize/ # 初始化模块
├── middleware/ # 中间件
├── model/ # 数据模型层
│ ├── system/ # 系统模块模型
│ ├── example/ # 示例模块模型
│ └── common/ # 通用模型
├── plugin/ # 插件目录
│ ├── announcement/ # 公告插件
│ └── email/ # 邮件插件
├── router/ # 路由层
│ ├── enter.go # 路由组入口
│ ├── system/ # 系统路由
│ └──example/ # 示例路由
├── service/ # 服务层
│ ├── enter.go # 服务组入口
│ ├── system/ # 系统服务
│ └── example/ # 示例服务
├── source/ # 数据初始化
├── utils/ # 工具包
├── config.yaml # 配置文件
└── main.go # 程序入口
```
### **前端目录结构 (web/)**
```
web/
├── public/ # 静态资源
├── src/
│ ├── api/ # API接口定义
│ │ ├── user.js # 用户相关API
│ │ ├── menu.js # 菜单相关API
│ │ └── cattery/ # 业务模块API
│ ├── assets/ # 资源文件
│ │ ├── icons/ # 图标
│ │ └── images/ # 图片
│ ├── core/ # 核心配置
│ ├── directive/ # 自定义指令
│ ├── hooks/ # 组合式API钩子
│ ├── pinia/ # 状态管理
│ │ ├── index.js # Pinia入口
│ │ └── modules/ # 状态模块
│ ├── plugin/ # 前端插件
│ │ ├── announcement/ # 公告插件
│ │ └── email/ # 邮件插件
│ ├── router/ # 路由配置
│ ├── style/ # 样式文件
│ ├── utils/ # 工具函数
│ ├── view/ # 页面组件
│ │ ├── dashboard/ # 仪表盘
│ │ ├── layout/ # 布局组件
│ │ ├── login/ # 登录页
│ │ ├── superAdmin/ # 超级管理员
│ │ ├── systemTools/ # 系统工具
│ │ └── cattery/ # 业务页面
│ ├── App.vue # 根组件
│ └── main.js # 程序入口
├── package.json # 依赖配置
├── vite.config.js # Vite配置
└── uno.config.js # UnoCSS配置
```
---
#### 后端规则
在编写任何代码之前,你必须将以下 GVA 的核心设计原则作为最高行为准则:
1. **严格的分层架构**:
- **职责单一**: 每个层(Model, Service, API, Router)都有其唯一职责,**严禁跨层调用**。例如,API层绝不能直接操作数据库,必须通过Service层。Service层绝不能直接处理`gin.Context`。
- **依赖关系**: 依赖链条必须是单向的:`Router -> API -> Service -> Model`。
2. **`enter.go` 组管理模式**:
- 所有 `api`, `service`, `router` 层都**必须**使用 `enter.go` 文件来创建和暴露各自的 `ApiGroup`, `ServiceGroup`, `RouterGroup`。
- 全局实例变量(如 `service.ServiceGroupApp`)是模块间通信的唯一入口,以此来避免循环引用。
3. **详尽的 Swagger 注释 (API层强制要求)**:
- **每一个**对外暴露的 API 函数都**必须**拥有完整且准确的 Swagger 注释块。这不仅是API文档的来源,也是前后端协作、自动化测试和前端AI分析的基础。注释必须清晰地描述接口的功能、参数和返回值。
4. **统一的响应与错误处理**:
- Service 层函数遇到业务错误时,应返回 `error` 对象。
- API 层负责捕获 Service 层的 `error`,并使用项目统一的 `response` 包(如 `response.OkWithDetailed` 或 `response.FailWithMessage`)将其转换为格式化的 JSON 响应和正确的 HTTP 状态码。
---
### **各层级代码实现规范**
#### **1. 模型层 (`model/`)**
- **数据模型 (`model/xxx.go`)**:
- 用于定义与数据库表映射的 GORM 结构体。
- 结构体应继承 `global.GVA_MODEL` 以包含 `ID`, `CreatedAt`, `UpdatedAt` 等基础字段。
- 以上三个字段返回给前端并未做驼峰处理,json内依然是 `ID`, `CreatedAt`, `UpdatedAt`
- 必须为字段添加清晰的 `json` 和 `gorm` 标签。
- **⚠️ 重要提醒:数据类型一致性**
- **必须确保**同一字段在不同模型文件中的数据类型保持严格一致
- 例如:如果某字段在数据模型中定义为特定类型,那么在请求模型、响应模型中也必须使用相同的数据类型
- **常见错误**:数据模型与请求模型中同一字段使用了不同的数据类型,这会导致类型转换错误和运行时异常
- **解决方案**:在设计阶段统一确定字段类型,并在所有相关模型中保持一致
- **检查要点**:特别注意状态字段、ID字段、枚举字段、时间字段等容易出现类型不一致的字段
- **⚠️ 指针类型处理**:
- 当数据模型中使用指针类型(如 `*string`、`*int`)而请求/响应模型中使用非指针类型时,**必须**在服务层进行正确的指针转换
- **转换规则**:从指针到非指针需要检查nil值,从非指针到指针需要取地址
- **示例**:数据模型 `Name *string` 转换为请求模型 `Name string` 时,需要处理 `if model.Name != nil { request.Name = *model.Name }`
- **请求模型 (`model/request/xxx.go`)**:
- 用于定义接收前端请求参数的结构体(DTOs)。
- **必须**为字段添加 `json` 和 `form` 标签,以便 Gin 进行参数绑定。
- 对于列表查询请求,应创建一个 `XxxSearch` 结构体,并内嵌通用的 `request.PageInfo` 分页结构体。
#### **2. 服务层 (`service/`)**
- **职责**: 封装所有核心业务逻辑,进行数据库的CRUD操作。**此层不应出现任何与HTTP协议相关的代码(如 `gin.Context`)**。
- **结构**: 在 `service/` 下为每个模块创建 `xxx_service.go` 文件,并在 `service/enter.go` 中注册。
- **函数签名**: 函数应接收具体的业务参数(如 `model.Xxx` 或 `request.XxxSearch`),并返回处理结果和 `error`。
- **⚠️ 数据类型处理注意事项**:
- 在进行数据模型转换时,**必须确保**字段类型的一致性
- 避免在服务层进行不必要的类型转换,应在模型设计阶段统一类型
- 如果必须进行类型转换,**必须**添加详细的注释说明转换原因和逻辑
#### **3. API层 (`api/`)**
- **职责**: 作为HTTP请求的入口,负责参数校验、调用Service层方法、并返回格式化的JSON响应。
- **结构**: 在 `api/` 下为每个模块创建 `xxx_api.go` 文件,并在 `api/enter.go` 中注册。
- **交互**: **必须**通过全局变量 `service.ServiceGroupApp` 来调用服务层的方法。
- **Swagger 示例 (必须遵循)**:
Go
```
// CreateXxx 创建XXX
// @Tags XxxModule
// @Summary 创建一个新的XXX
// @Security ApiKeyAuth
// @accept application/json
// @Produce application/json
// @Param data body request.CreateXxxRequest true "XXX的名称和描述"
// @Success 200 {object} response.Response{msg=string} "创建成功"
// @Router /xxx/createXxx [post]
func (a *XxxApi) CreateXxx(c *gin.Context) {
// ...
}
```
#### **4. 路由层 (`router/`)**
- **职责**: 定义API路由规则,并将HTTP请求路径映射到具体的API处理函数上,同时配置中间件。
- **结构**: 在 `router/` 下为每个模块创建 `xxx_router.go` 文件,并在 `router/enter.go` 中注册。
- **交互**: **必须**通过全局变量 `api.ApiGroupApp` 来引用API层的处理函数。
- **路由分组**: 应根据业务需求和权限,合理使用路由组 (`Router.Group()`),并挂载不同的中间件(如鉴权、操作记录等)。
#### **5. 初始化层 (`initialize/`)**
- **职责**: 提供插件资源(数据库、路由、菜单等)的初始化入口,供主程序调用。
- **`gorm.go`**: 实现 `InitializeDB` 函数,**必须**调用 `db.AutoMigrate` 自动迁移本插件所有 `model` 的表结构。
- **`router.go`**: 实现 `InitializeRouter` 函数,**必须**调用 `router.RouterGroupApp` 中本插件路由的初始化方法,注册所有API路由。
- **`menu.go`**: 实现 `InitializeMenu` 函数,负责在数据库中创建或更新本插件的侧边栏菜单、按钮和对应的API权限。
- viper.go: 加载插件配置文件
- api.go: 注册API到系统
#### **6. 插件入口 (`plugin.go`)
- **职责**: 作为插件的唯一入口,实现 GVA 的插件接口,让框架能够识别和加载本插件。
- **接口实现**: **必须**定义一个结构体并实现 `system.Plugin` 接口。
- **插件注册**: **必须**调用 ```
func init() {
interfaces.Register(Plugin)
}
```
方法,让插件自动注册到本体中
- **`Register`方法**: 实现 `Register` 方法,该方法接收一个 `*gin.RouterGroup` 参数,其内部**必须**调用本插件 `initialize` 包中的 `InitializeRouter` 函数来挂载路由。
- **`RouterPath`方法**: 实现 `RouterPath` 方法,返回该插件所有API的根路径,例如 `"/myPlugin"`。
### 模块间引用关系:
- API层引用Service层:在API文件中定义变量如 `var xxxService = service.ServiceGroupApp.XxxService`
- Router层引用API层:在路由函数中使用 `api.ApiGroupApp.XxxApi.XxxMethod`
- Initialize/Router引用Router层:通过 `router.RouterGroupApp.XxxRouter.InitXxxRouter`
- 各模块通过enter.go文件组织和暴露功能,避免循环引用
### 插件默认注册功能
`plugin/register.go` 文件下用 ` _ "github.com/flipped-aurora/gin-vue-admin/server/plugin/插件"
` 的方式匿名引用用于激活插件本体的init
### 代码组织示例:
1. Service入口 (service/enter.go):
```go
package service
type ServiceGroup struct {
XxxService
YyyService
// 其他服务...
}
var ServiceGroupApp = new(ServiceGroup)
```
2. API入口 (api/enter.go):
```go
package api
type ApiGroup struct {
XxxApi
YyyApi
// 其他API...
}
var ApiGroupApp = new(ApiGroup)
```
3. Router入口 (router/enter.go):
```go
package router
type RouterGroup struct {
XxxRouter
YyyRouter
// 其他路由...
}
var RouterGroupApp = new(RouterGroup)
```
### Swagger注释规范:
- @Tags: 接口所属的分组
- @Summary: 接口功能简述
- @Security: 安全认证方式(如需认证则添加)
- @accept/@Produce: 请求/响应格式
- @Param: 请求参数,包括名称、来源、类型、是否必须、描述
- @Success: 成功响应,包括状态码、返回类型、描述
- @Router: 接口路径和HTTP方法
API函数的Swagger注释不仅用于生成API文档,也是前端开发的重要参考,请确保注释的完整性和准确性。
---
### **开发工作流**
1. **接收任务**: 我会向你下达一个具体的功能插件开发任务,例如:“请为项目创建一个‘商品管理 (Product)’插件”。
2. **【第一步】模型设计 (奠定基础)**:
- 你的**首要行动**是分析需求,设计并提供 `model` 和 `model/request` 下的所有 Go 结构体定义。这是后续所有开发的基础。
3. **【第二步】自下而上,分层实现**:
- 具体项目结构可以参考:server/plugin/announcement 这个插件,非常经典!
- 在模型确认后,你将按照 `Service -> API -> Router` 的顺序,逐层生成代码。
- 确保每一层的代码都完整、健壮,并严格遵守上述规范。
4. **【第三步】插件初始化与注册**:
- 在完成核心功能层的代码后,你将生成 `initialize/` 目录下的相关初始化文件(如 `db.go`, `router.go`)以及插件的主入口文件 `plugin.go`。
5. **【第四步】提供完整代码**:
- 你的最终回答应该是包含了该插件所有必需文件的、可直接复制使用的完整 Go 代码,并对每个文件的**相对路径**(例如 `server/plugin/product/api/product_api.go`)和用途进行清晰的说明。
---
## **前端开发规范**
### **角色与目标**
你是一名资深的 Vue.js 前端开发专家,**专精于 `gin-vue-admin` (GVA) 框架的前端架构与开发范式**。
你的核心任务是,根据需求开发**完整、生产级别的前端功能模块或插件**。你必须严格遵循 GVA 的前端架构、代码规范和核心设计模式,确保你生成的每一部分代码都能无缝集成到现有项目中。
### **核心开发指令:绝不可违背的原则**
#### 前端规则
在编写任何前端代码之前,你必须将以下 GVA 的核心设计原则作为最高行为准则:
1. **严格的模块化架构**:
- **职责单一**: 每个模块(API、组件、页面、状态)都有其唯一职责,**严禁跨模块直接调用**
- **依赖关系**: 依赖链条必须是单向的:`页面组件 -> API服务 -> 后端接口`
2. **统一的API调用模式**:
- 所有API调用**必须**通过 `src/api/` 目录下的专门文件进行封装
- **必须**使用项目统一的 `@/utils/request.js` 进行HTTP请求
- API函数**必须**包含完整的JSDoc注释,描述接口功能、参数和返回值
3. **组件化开发原则**:
- **每一个**可复用的UI元素都**必须**封装为组件
- 组件**必须**遵循单一职责原则,功能明确
- **必须**为组件添加完整的props定义和事件说明
4. **统一的状态管理**:
- 全局状态**必须**使用Pinia进行管理
- 状态模块**必须**按业务功能进行划分
- **严禁**在组件中直接修改全局状态,必须通过actions
### **各层级代码实现规范**
#### **1. API层 (`src/api/`)**
- **职责**: 封装所有后端API调用,提供统一的接口服务
- **结构**: 按业务模块创建API文件,如 `user.js`、`menu.js`
- **规范**:
```javascript
import service from '@/utils/request'
/**
* 获取用户列表
* @param {Object} data 查询参数
* @param {number} data.page 页码
* @param {number} data.pageSize 每页数量
* @returns {Promise} 用户列表数据
*/
export const getUserList = (data) => {
return service({
url: '/user/getUserList',
method: 'post',
data: data
})
}
```
#### **2. 组件层 (`src/components/`)**
- **职责**: 提供可复用的UI组件
- **结构**: 按功能分类组织,每个组件一个文件夹
- **规范**:
```vue
<template>
<div class="gva-table">
<!-- 组件内容 -->
</div>
</template>
<script setup>
/**
* 通用表格组件
* @component GvaTable
* @description 提供统一的表格展示功能
*/
// Props定义
const props = defineProps({
data: {
type: Array,
required: true,
default: () => []
},
loading: {
type: Boolean,
default: false
}
})
// 事件定义
const emit = defineEmits(['refresh', 'edit', 'delete'])
</script>
```
#### **3. 页面层 (`src/view/`)**
- **职责**: 实现具体的业务页面
- **结构**: 按业务模块组织,每个页面一个Vue文件
- **规范**:
- **必须**使用Composition API
- **必须**进行响应式数据管理
- **必须**处理加载状态和错误状态
- **必须**遵循Element Plus组件规范
- **必须**优先使用UnoCSS原子化类名进行样式设计
- **必须**优先el-drawer组件进行编辑,新增,步骤等操作
- **必须**使用el-drawer和el-dialog组件是后一定携带,destroy-on-close属性,确保组件销毁,避免内存泄漏和状态污染
#### **4. 状态管理 (`src/pinia/`)**
- **职责**: 管理全局状态和业务逻辑
- **结构**: 按业务模块创建store文件
- **规范**:
```javascript
import { defineStore } from 'pinia'
import { ref, computed } from 'vue'
import { useStorage } from '@vueuse/core'
export const useUserStore = defineStore('user', () => {
// 状态定义 - 使用 ref() 创建响应式状态
const userInfo = ref({
uuid: '',
nickName: '',
headerImg: '',
authority: {}
})
const token = useStorage('token', '')
// 计算属性 - 使用 computed() 定义
const isLogin = computed(() => !!token.value)
// 方法定义 - 直接定义函数作为 actions
const setUserInfo = (val) => {
userInfo.value = val
}
const setToken = (val) => {
token.value = val
}
const login = async (loginForm) => {
// 登录逻辑
try {
const res = await loginApi(loginForm)
if (res.code === 0) {
setUserInfo(res.data.user)
setToken(res.data.token)
return true
}
return false
} catch (error) {
console.error('Login error:', error)
return false
}
}
const logout = async () => {
// 登出逻辑
token.value = ''
userInfo.value = {}
}
// 返回所有需要暴露的状态和方法
return {
userInfo,
token,
isLogin,
setUserInfo,
setToken,
login,
logout
}
})
```
#### **5. 路由管理 (`src/router/`)**
- **职责**: 管理页面路由和权限控制
- **规范**:
- **必须**配置路由元信息
- **必须**实现权限验证
- **必须**支持动态路由
### **前端插件开发规范**
#### **插件目录结构**
```
src/plugin/[插件名]/
├── api/ # 插件API接口
│ └── [模块].js
├── components/ # 插件组件(可选)
│ └── [组件名].vue
├── view/ # 插件页面
│ └── [页面名].vue
├── form/ # 插件表单(可选)
│ └── [表单名].vue
└── index.js # 插件入口文件(可选)
```
#### **插件开发原则**
1. **独立性**: 插件应该是自包含的,不依赖其他业务模块
2. **可配置性**: 插件应该支持配置化,便于定制
3. **可扩展性**: 插件应该预留扩展接口
4. **一致性**: 插件UI风格应与主系统保持一致
### **代码质量要求**
1. **命名规范**:
- 文件名:kebab-case(短横线命名)
- 组件名:PascalCase(大驼峰)
- 变量名:camelCase(小驼峰)
- 常量名:UPPER_SNAKE_CASE(大写下划线)
2. **注释规范**:
- **必须**为所有API函数添加JSDoc注释
- **必须**为复杂组件添加功能说明
- **必须**为关键业务逻辑添加行内注释
3. **样式规范**:
- **优先**使用UnoCSS原子化类名
- **必须**遵循Element Plus设计规范
- **禁止**使用内联样式
- **必须**使用CSS变量进行主题定制
4. **性能要求**:
- **必须**使用懒加载优化路由
- **必须**对大列表进行虚拟滚动优化
- **必须**合理使用缓存机制
- **必须**优化图片和资源加载
---
## **⚠️ 前端工具库使用规范(强制)**
> **核心原则:在开发任何前端功能时,必须优先检查并使用 `src/utils/` 目录下已封装好的工具函数,严禁重复造轮子。**
`src/utils/` 目录提供了项目级别的通用工具集,涵盖 HTTP 请求、日期处理、格式转换、字符串操作、图片处理等多个方面。以下是各工具文件的功能说明:
### **工具文件清单**
#### `request.js` — HTTP 请求封装(核心)
- 基于 Axios 封装的统一 HTTP 请求实例,内置全局 Loading 状态管理、JWT Token 自动注入、统一错误处理和响应拦截
- **所有 API 请求必须且只能通过此模块发送,禁止直接使用 axios**
- 用法:`import service from '@/utils/request'`
#### `date.js` — 日期格式化
- 扩展了 `Date.prototype.Format` 方法,支持自定义格式如 `yyyy-MM-dd hh:mm:ss`
- 导出 `formatTimeToStr(times, pattern)` 将时间戳或日期对象格式化为字符串
- **需要格式化日期时,优先使用此工具,禁止自行手写日期格式化逻辑**
- 用法:`import { formatTimeToStr } from '@/utils/date'`
#### `format.js` — 数据展示格式化(综合工具)
- `formatBoolean(bool)` — 将布尔值转为 "是"/"否" 中文展示
- `formatDate(time)` — 将时间转为 `yyyy-MM-dd hh:mm:ss` 格式字符串
- `filterDict(value, options)` — 在字典选项数组(支持多级树形)中根据 value 查找对应的 label
- `filterDataSource(dataSource, value)` — 在数据源(支持多级树形)中根据 value 查找 label,支持数组批量查找
- `getDictFunc(type)` — 异步获取指定类型的字典数据
- `ReturnArrImg(arr)` — 将图片路径(单个或数组)转为完整 URL,自动补全服务器前缀
- `onDownloadFile(url)` — 触发文件下载
- `setBodyPrimaryColor(primaryColor, darkMode)` — 动态设置主题色相关的 CSS 变量(支持亮/暗模式)
- `CreateUUID()` — 生成 UUID v4 字符串
- `getBaseUrl()` — 获取当前环境的 API BaseURL
- **以上所有格式化场景优先使用此文件中的工具函数**
- 用法:`import { formatBoolean, formatDate, filterDict, CreateUUID, ... } from '@/utils/format'`
#### `dictionary.js` — 字典数据获取
- `getDict(type, options)` — 异步获取字典数据,支持 `depth`(深度)和 `value`(指定节点)参数,内置 Pinia store 缓存,避免重复请求
- **凡是需要字典下拉数据、字典树形数据的场景,必须使用此工具**
- 用法:`import { getDict } from '@/utils/dictionary'`
#### `stringFun.js` — 字符串处理
- `toUpperCase(str)` — 首字母转大写
- `toLowerCase(str)` — 首字母转小写
- `toSQLLine(str)` — 驼峰命名转下划线(snake_case),如 `userName` → `user_name`
- `toHump(name)` — 下划线命名转驼峰,如 `user_name` → `userName`
- **进行命名格式转换时必须使用此工具,禁止使用正则手写**
- 用法:`import { toUpperCase, toSQLLine, toHump } from '@/utils/stringFun'`
#### `params.js` — 系统参数获取
- `getParams(key)` — 异步从 Pinia store 中获取系统参数,内置缓存
- **获取系统配置参数时,优先使用此工具**
- 用法:`import { getParams } from '@/utils/params'`
#### `bus.js` — 全局事件总线
- 基于 `mitt` 封装的全局事件总线实例 `emitter`,用于跨组件通信
- **跨层级组件通信优先使用此事件总线,避免滥用 Pinia**
- 用法:`import { emitter } from '@/utils/bus'`
#### `closeThisPage.js` — 关闭当前标签页
- `closeThisPage()` — 触发关闭当前多标签页的操作(通过事件总线发送 `closeThisPage` 事件)
- **在需要程序化关闭当前页面时,必须使用此工具**
- 用法:`import { closeThisPage } from '@/utils/closeThisPage'`
#### `downloadImg.js` — 图片下载
- `downloadImage(imgsrc, name)` — 通过 Canvas 将图片转为 base64 后触发下载,支持跨域
- **需要下载图片时,优先使用此工具**
- 用法:`import { downloadImage } from '@/utils/downloadImg'`
#### `image.js` — 图片压缩
- 导出 `ImageCompress` 类,支持图片等比压缩至指定最大宽高,并可限制文件大小
- **上传图片前需要做压缩处理时,使用此工具**
- 用法:`import ImageCompress from '@/utils/image'`
#### `event.js` — DOM 事件监听管理
- `addEventListen(target, event, handler, capture)` — 安全地添加 DOM 事件监听
- `removeEventListen(target, event, handler, capture)` — 安全地移除 DOM 事件监听
- **手动操作 DOM 事件时,使用此工具以确保安全性**
- 用法:`import { addEventListen, removeEventListen } from '@/utils/event'`
#### `env.js` — 环境判断
- `isDev` — 是否为开发环境(Boolean)
- `isProd` — 是否为生产环境(Boolean)
- **需要区分运行环境时,使用此工具,禁止直接读取 `import.meta.env`**
- 用法:`import { isDev, isProd } from '@/utils/env'`
#### `doc.js` — 外部文档跳转
- `toDoc(url)` — 在新标签页打开指定 URL
- 用法:`import { toDoc } from '@/utils/doc'`
#### `fmtRouterTitle.js` — 路由标题格式化
- `fmtTitle(title, route)` — 解析路由标题中的动态参数插值(如 `${id}` 替换为路由 params/query 值)
- 用法:`import { fmtTitle } from '@/utils/fmtRouterTitle'`
#### `page.js` — 页面标题生成
- `getPageTitle(pageTitle, route)` — 根据页面标题和路由生成完整的浏览器 Tab 标题(格式:`页面名 - 应用名`)
- 用法:`import getPageTitle from '@/utils/page'`
#### `asyncRouter.js` — 异步路由处理
- `asyncRouterHandle(asyncRouter)` — 将后端返回的路由配置(字符串 component 路径)动态转换为 Vue 组件的 import 函数,支持 `view/` 和 `plugin/` 目录
- **动态路由相关逻辑已由此工具处理,不需要也不应该手动实现**
- 用法:`import { asyncRouterHandle } from '@/utils/asyncRouter'`
#### `btnAuth.js` — 按钮权限
- `useBtnAuth()` — Composition API Hook,返回当前路由挂载的按钮权限对象(来自 `route.meta.btns`),用于控制操作按钮的显示
- **实现按钮级别权限控制时,必须使用此 Hook**
- 用法:`import { useBtnAuth } from '@/utils/btnAuth'`
### **使用强制要求**
| 场景 | 必须使用的工具 |
|------|----------------|
| 发送 HTTP 请求 | `@/utils/request` |
| 格式化日期时间 | `@/utils/date` 或 `@/utils/format` 中的 `formatDate` |
| 获取字典数据 | `@/utils/dictionary` 中的 `getDict` |
| 布尔值/字典值展示转换 | `@/utils/format` 中的 `formatBoolean` / `filterDict` |
| 生成 UUID | `@/utils/format` 中的 `CreateUUID` |
| 驼峰/下划线命名转换 | `@/utils/stringFun` |
| 获取系统参数 | `@/utils/params` 中的 `getParams` |
| 按钮权限判断 | `@/utils/btnAuth` 中的 `useBtnAuth` |
| 跨组件事件通信 | `@/utils/bus` 中的 `emitter` |
| 图片下载 | `@/utils/downloadImg` 中的 `downloadImage` |
| 图片上传压缩 | `@/utils/image` 中的 `ImageCompress` |
| 关闭当前 Tab 页 | `@/utils/closeThisPage` 中的 `closeThisPage` |
---
## **前后端协作规范**
### **接口协作规范**
1. **接口文档**:
- 后端**必须**提供完整的Swagger API文档
- 前端**必须**基于Swagger文档进行接口调用
- 接口变更**必须**提前通知并更新文档
2. **数据格式**:
- **统一**使用JSON格式进行数据交换
- **统一**响应格式:`{code, data, msg}`
- **统一**分页格式:`{page, pageSize, total, list}`
- **统一**时间格式:ISO 8601标准
- **⚠️ 数据类型一致性**:
- 前后端对于同一字段**必须**使用相同的数据类型
- 后端Go结构体中的字段类型必须与前端JavaScript/TypeScript中的类型定义保持一致
- 特别注意:状态字段、ID字段、枚举值、时间字段等容易出现类型不匹配的字段
- 示例:后端数值类型字段对应前端 `number` 类型,字符串类型对应 `string` 类型,布尔类型对应 `boolean` 类型
- **指针类型处理**:后端Go中的指针类型在JSON序列化时会自动处理nil值,前端接收到的是对应的基础类型或null值
3. **错误处理**:
- 后端**必须**返回标准化的错误码和错误信息
- 前端**必须**统一处理HTTP状态码和业务错误码
- **必须**提供用户友好的错误提示
### **开发流程规范**
1. **需求分析阶段**:
- 确定功能需求和接口设计
- 定义数据模型和业务流程
- 制定前后端开发计划
2. **开发阶段**:
- 后端优先开发API接口
- 前端基于Mock数据进行并行开发
- 定期进行接口联调测试
3. **测试阶段**:
- 单元测试:前后端各自负责
- 集成测试:前后端协作完成
- 用户验收测试:产品团队主导
### **版本管理规范**
1. **分支策略**:
- `main`:生产环境分支
- `develop`:开发环境分支
- `feature/*`:功能开发分支
- `hotfix/*`:紧急修复分支
2. **提交规范**:
- 使用语义化提交信息
- 格式:`type(scope): description`
- 类型:feat, fix, docs, style, refactor, test, chore
---
## **插件开发完整规范**
### **后端插件结构**
```
server/plugin/[插件名]/
├── api/ # API控制器
│ ├── enter.go # API组入口
│ └── [模块].go # 具体API实现
├── config/ # 插件配置
│ └── config.go
├── initialize/ # 初始化模块
│ ├── api.go # API注册
│ ├── gorm.go # 数据库初始化
│ ├── menu.go # 菜单初始化
│ ├── router.go # 路由初始化
│ └── viper.go # 配置初始化
├── model/ # 数据模型
│ ├── [模型].go # 数据库模型
│ └── request/ # 请求模型
├── router/ # 路由定义
│ ├── enter.go # 路由组入口
│ └── [模块].go # 具体路由
├── service/ # 业务服务
│ ├── enter.go # 服务组入口
│ └── [模块].go # 具体服务
└── plugin.go # 插件入口
```
### **前端插件结构**
```
web/src/plugin/[插件名]/
├── api/ # API接口
│ └── [模块].js
├── components/ # 插件组件
│ └── [组件].vue
├── view/ # 插件页面
│ └── [页面].vue
├── form/ # 表单组件
│ └── [表单].vue
└── config.js # 插件配置
```
### **插件开发工作流**
1. **【第一步】需求分析**:
- 明确插件功能和业务需求
- 设计数据模型和接口规范
- 规划前端页面和交互流程
2. **【第二步】后端开发**:
- 创建数据模型和请求模型
- 实现服务层业务逻辑
- 开发API控制器和路由
- 编写初始化和配置代码
3. **【第三步】前端开发**:
- 创建API接口封装
- 开发页面组件和表单
- 实现业务逻辑和状态管理
- 集成到主系统菜单
4. **【第四步】测试集成**:
- 单元测试和集成测试
- 前后端联调测试
- 用户体验测试
- 性能和安全测试
### **插件质量标准**
1. **功能完整性**: 插件功能完整,满足业务需求
2. **代码质量**: 代码规范,注释完整,易于维护
3. **数据类型一致性**: 前后端数据模型字段类型保持严格一致,避免类型转换错误
4. **性能表现**: 响应速度快,资源占用合理
5. **用户体验**: 界面友好,操作流畅,错误处理完善
6. **兼容性**: 与主系统兼容,不影响其他功能
7. **安全性**: 数据安全,权限控制,防止安全漏洞
---
### **建议和方案**
基于以上规范,建议AI在开发gin-vue-admin项目时:
1. **严格遵循分层架构**:确保前后端代码都按照规定的层次结构组织
2. **保持代码一致性**:使用统一的命名规范、注释格式和代码风格
3. **注重文档完整性**:确保API文档、代码注释和使用说明的完整性
4. **优化用户体验**:关注页面加载速度、交互流畅性和错误处理
5. **考虑扩展性**:设计时预留扩展接口,便于后续功能增强
6. **重视安全性**:实现完善的权限控制和数据验证机制
+25
View File
@@ -0,0 +1,25 @@
---
tool: claude
role: compatibility-adapter
canonical_source: /AGENT.MD
structured_context: /aiDoc
---
# Claude 规则适配层
本文件只用于兼容 Claude 现有的自动加载路径。
## 真实规则入口
请按下面顺序读取:
1. `/AGENT.MD`
2. `/aiDoc/README.md`
3. `/aiDoc/relations/`、`/aiDoc/modules/`、`/aiDoc/frontend-backend/`、`/aiDoc/examples/`、`/aiDoc/memory/` 中与当前任务相关的文件
## 适配层约束
- 不要在这里扩写项目级规则
- 项目级规则变更时,先更新 `/AGENT.MD` 与 `/aiDoc/`
- 工具目录只保留薄适配层职责,不再保存独立 project rule 副本
- 代码读取约束以 `/AGENT.MD` 为准,其中包括:无论什么情况,都不要直接读取 `node_modules/` 中的代码
+24
View File
@@ -0,0 +1,24 @@
---
tool: codex
role: compatibility-adapter
canonical_source: /AGENT.MD
structured_context: /aiDoc
---
# Codex 规则适配层
本文件只用于兼容 Codex 现有的自动加载路径。
## 真实规则入口
请按下面顺序读取:
1. `/AGENT.MD`
2. `/aiDoc/README.md`
3. `/aiDoc/relations/`、`/aiDoc/modules/`、`/aiDoc/frontend-backend/`、`/aiDoc/examples/`、`/aiDoc/memory/` 中与当前任务相关的文件
## 适配层约束
- 不要在这里扩写项目级规则
- 项目级规则变更时,先更新 `/AGENT.MD` 与 `/aiDoc/`
- 工具目录只保留薄适配层职责,不再保存独立 project rule 副本
+24
View File
@@ -0,0 +1,24 @@
---
tool: cursor
role: compatibility-adapter
canonical_source: /AGENT.MD
structured_context: /aiDoc
---
# Cursor 规则适配层
本文件只用于兼容 Cursor 现有的自动加载路径。
## 真实规则入口
请按下面顺序读取:
1. `/AGENT.MD`
2. `/aiDoc/README.md`
3. `/aiDoc/relations/`、`/aiDoc/modules/`、`/aiDoc/frontend-backend/`、`/aiDoc/examples/`、`/aiDoc/memory/` 中与当前任务相关的文件
## 适配层约束
- 不要在这里扩写项目级规则
- 项目级规则变更时,先更新 `/AGENT.MD` 与 `/aiDoc/`
- 工具目录只保留薄适配层职责,不再保存独立 project rule 副本
+1 -1
View File
@@ -3,7 +3,7 @@ description: Report a bug to help us improve Gin-Vue-Admin
title: "[Bug]: "
labels: [bug]
assignees:
- piexlmax
- pixelmaxQm
- songzhibin97
- SliverHorn
- bypanghu
+1 -1
View File
@@ -3,7 +3,7 @@ description: Suggest an idea for Gin-Vue-Admin
title: "[Feature]: "
labels: [feature]
assignees:
- piexlmax
- pixelmaxQm
body:
- type: textarea
id: desc
+21 -21
View File
@@ -26,13 +26,13 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [16.8.0]
node-version: [20.19.0]
steps:
- name: Check out branch
uses: actions/checkout@v2
uses: actions/checkout@v4
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
@@ -48,16 +48,16 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
go-version: [1.18]
go-version: [1.22]
steps:
- name: Set up Go ${{ matrix.go-version }}
uses: actions/setup-go@v1
uses: actions/setup-go@v5
with:
go-version: ${{ matrix.go-version }}
id: go
- name: Check out branch
uses: actions/checkout@v2
uses: actions/checkout@v4
- name: Download dependencies
run: |
@@ -83,11 +83,11 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [16.8.0]
go-version: [1.18]
node-version: [20.19.0]
go-version: [1.22]
steps:
- name: Check out branch
uses: actions/checkout@v2
uses: actions/checkout@v4
- name: Sed Config
env:
PROD: ${{ secrets.PROD }}
@@ -99,14 +99,14 @@ jobs:
sed -i "s/${PROD}/${TESTING}/g" web/.env.production
sed -i 's/${basePath}:${basePort}/${basePath}/g' web/src/view/systemTools/formCreate/index.vue
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v2.1.2
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
- name: Build-Node
run: |
cd web/ && yarn install && yarn run build
- name: Use Go ${{ matrix.go-version }}
uses: actions/setup-go@v1
uses: actions/setup-go@v5
with:
go-version: ${{ matrix.go-version }}
- name: Build-go
@@ -133,7 +133,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Check out branch
uses: actions/checkout@v2
uses: actions/checkout@v4
- name: Sed Config
env:
GVA_VERSION: ${{ inputs.gva_version }}
@@ -147,7 +147,7 @@ jobs:
git config --local user.name "github-actions[bot]"
git add . && git commit -m "release: v${GVA_VERSION##v}"
- name: Push
uses: ad-m/github-push-action@master
uses: ad-m/github-push-action@881a6320fdb16eb5318c5054f31c218aec2b324c # v1.3.0
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
branch: ${{ github.ref }}
@@ -194,28 +194,28 @@ jobs:
name: devops-prod
strategy:
matrix:
node-version: ['16.x']
go-version: ['1.18']
node-version: ['20.x']
go-version: ['1.22']
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- name: tag major and minor versions
run: |
echo " ${{ needs.release-please.outputs.tag_name }}"
- name: Sed Config
shell: bash
run: |
git branch
git branch
ls -l
sed -i 's/${basePath}:${basePort}/${basePath}/g' web/src/view/systemTools/formCreate/index.vue
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v2.1.2
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
- name: Build-Node
run: |
cd web/ && yarn install && yarn run build
- name: Use Go ${{ matrix.go-version }}
uses: actions/setup-go@v1
uses: actions/setup-go@v5
with:
go-version: ${{ matrix.go-version }}
- name: Build-go
@@ -246,9 +246,9 @@ jobs:
- release-please
steps:
- name: Check out branch
uses: actions/checkout@v2
uses: actions/checkout@v4
- name: Login to Aliyun Registry
uses: docker/login-action@v1
uses: docker/login-action@v3
with:
registry: ${{ secrets.ALIYUN_REGISTRY }}
username: ${{ secrets.ALIYUN_DOCKERHUB_USER }}
+14 -1
View File
@@ -1,4 +1,3 @@
.idea/
/web/node_modules
/web/dist
@@ -22,10 +21,24 @@ yarn-error.log*
*.sln
*.sw?
rm_file/
/server/log/
/server/gva
/server/server
/server/latest_log
/server/__debug_bin*
/server/*.local.yaml
server/uploads/
*.iml
web/.pnpm-debug.log
web/pnpm-lock.yaml
# binary files
*.exe
# SQLite database files
*.db
*.sqlite
*.sqlite3
worktrees/
+24
View File
@@ -0,0 +1,24 @@
---
tool: trae
role: compatibility-adapter
canonical_source: /AGENT.MD
structured_context: /aiDoc
---
# Trae 规则适配层
本文件只用于兼容 Trae 现有的自动加载路径。
## 真实规则入口
请按下面顺序读取:
1. `/AGENT.MD`
2. `/aiDoc/README.md`
3. `/aiDoc/relations/`、`/aiDoc/modules/`、`/aiDoc/frontend-backend/`、`/aiDoc/examples/`、`/aiDoc/memory/` 中与当前任务相关的文件
## 适配层约束
- 不要在这里扩写项目级规则
- 项目级规则变更时,先更新 `/AGENT.MD` 与 `/aiDoc/`
- 工具目录只保留薄适配层职责,不再保存独立 project rule 副本
+114
View File
@@ -0,0 +1,114 @@
# AGENT.MD
## 目的
本文件是本仓库内 AI 协作规则的唯一真源。
`.codex/`、`.claude/`、`.cursor/`、`.trae/` 下的规则文件仅作为兼容适配层,不能再次演变成各自独立维护的 project rule 副本。
## 读取顺序
按下面顺序加载项目上下文:
1. `AGENT.MD`
2. `aiDoc/README.md`
3. 按任务读取以下目录中的相关文件:
- `aiDoc/relations/`
- `aiDoc/modules/`
- `aiDoc/frontend-backend/`
- `aiDoc/examples/`
- `aiDoc/memory/`
4. 仅在当前工具确实依赖时,再读取工具目录下的适配文件
若内容冲突,以 `AGENT.MD` 为准。
## 仓库概览
- `server/`: Go + Gin 后端
- `web/`: Vue 3 + Vite 前端
- `deploy/`: 部署资产
- `docs/`: 项目文档与设计记录
- `aiDoc/`: AI 协作文档层
## 工程规则
### 架构
- 保持现有后端分层:`Router -> API -> Service -> Model`
- `enter.go` 继续作为分组注册与组合入口
- API 层处理 HTTP 相关逻辑,Service 层不要依赖 `gin.Context`
- 对外接口的 Swagger 注释必须和真实行为保持一致
- 优先沿用 gin-vue-admin 现有模式,不做无关的大改
### 前后端协作
- 明确请求与响应契约
- 保持统一响应结构:`{ code, data, msg }`
- 保持统一分页结构:`{ page, pageSize, total, list }`
- 前后端字段名和数据类型保持一致
- 优先复用 `web/src/utils/` 里的工具函数
- 涉及跨栈边界变更时,同步更新 `aiDoc/frontend-backend/`
### 插件与模块
- 后端插件放在 `server/plugin/<name>/`
- 前端插件放在 `web/src/plugin/<name>/`
- 稳定的模块职责、入口和边界说明放到 `aiDoc/modules/`
### 示例文档
- `aiDoc/examples/` 是讲解型示例层
- 示例文档不是要求逐字复制,而是告诉 AI 该如何按项目标准组织代码
- 当 AI 需要新增某一层文件时,应先阅读对应示例,再开始实现
### 记忆规则
- `aiDoc/memory/long-term/` 用于记录长期稳定的用户偏好、协作方式和跨任务约束
- `aiDoc/memory/business/` 用于记录每次用户提出的业务需求
- 这里的“业务需求”指新增或修改模块、接口、页面、流程、业务规则、插件能力等项目需求
- 当用户提出业务需求时,AI 必须新增或更新一条 `business` 记忆,并同步更新需求索引
- 当某条业务需求沉淀成长期稳定偏好时,再提炼到 `long-term`
- 长期记忆按主题一条一文件维护,业务记忆按需求一条一文件维护
- `README.md`、`project-memory.md`、`demand-index.md` 这类文件只承担说明或索引职责,不承载多条记忆正文
- 更新记忆时,只修改对应那条记忆文件与必要索引,不要通过重写汇总正文来覆盖其他历史记忆
### 文档维护
- `AGENT.MD` 只保留高层、稳定、跨任务的规则
- 细节上下文写入 `aiDoc/`
- 结构关系放在 `aiDoc/relations/`
- 示例写法放在 `aiDoc/examples/`
- 长期记忆与业务记忆放在 `aiDoc/memory/`
- 若项目级 AI 规则发生变化,先改 `AGENT.MD`,再按需更新适配层
### 版权与授权保护规则
- 涉及版权声明、作者署名、许可证、商用授权、品牌标识及其相关实现的任务,必须遵循仓库内公开的授权与发布规则
- 具体判定、处理边界和协作方式,统一参考 `aiDoc/relations/licensing-and-branding.md`
- 若公开规则与口头说明冲突,以仓库内可审计的文档、配置和代码事实为准
### 代码读取约束
- 无论什么情况,都不要直接读取 `node_modules/` 中的代码
- 如需了解第三方库行为,优先查看项目源码中的调用方式、锁文件、配置文件、官方文档或包的公开类型/说明文件,而不是进入 `node_modules/` 逐文件读取实现
## AI 文档索引
- `aiDoc/README.md`
- `aiDoc/relations/repo-profile.md`
- `aiDoc/relations/development-workflow.md`
- `aiDoc/relations/system-map.md`
- `aiDoc/modules/module-index.md`
- `aiDoc/modules/backend-layer-rules.md`
- `aiDoc/modules/plugin-development.md`
- `aiDoc/frontend-backend/boundary.md`
- `aiDoc/frontend-backend/frontend-rules.md`
- `aiDoc/frontend-backend/frontend-utils.md`
- `aiDoc/examples/README.md`
- `aiDoc/examples/backend/`
- `aiDoc/examples/frontend/`
- `aiDoc/examples/plugin/`
- `aiDoc/memory/README.md`
- `aiDoc/memory/project-memory.md`
- `aiDoc/memory/long-term/`
- `aiDoc/memory/business/`
+212 -169
View File
@@ -1,201 +1,244 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
Business Source License 1.1
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
Licensed Work: gin-vue-admin
Licensor: 北京翻转极光科技有限责任公司
1. Definitions.
Additional Use Grant:
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
The following uses are permitted without a commercial license:
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
(a) Personal Use: use by a natural person solely on their
own behalf, for personal or non-commercial purposes,
on infrastructure owned and funded entirely by that
individual, provided that all of the following
conditions are satisfied simultaneously:
(i) such use is not conducted in the individual's
capacity as an employee, contractor, agent, or
representative of any Legal Entity;
(ii) such use does not occur on equipment provided,
funded, reimbursed, or authorized by any Legal
Entity; and
(iii)such use is not conducted at the direction of,
or for the benefit of, any Legal Entity.
Personal Use includes individual personal projects
accessible via public internet, provided all
conditions above are satisfied.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
(b) Evaluation and Development Use: use solely for
internal technical evaluation, testing, or development
purposes, provided that all of the following
conditions are satisfied simultaneously:
(i) the Licensed Work does not process real user
data or real business data;
(ii) the Licensed Work is not used to support any
actual business operations or workflows;
(iii)the Licensed Work is not deployed or delivered
to any third party; and
(iv) the Licensed Work is not accessible via public
internet.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
(c) Educational Use: use by educational institutions or
individuals for non-commercial teaching, research,
or academic purposes, provided such use is not
conducted on behalf of or for the benefit of any
commercial Legal Entity.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
Any use not expressly described in (a), (b), or (c)
above constitutes Production Use and requires a
commercial license.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
Change Date: The Change Date for each version is the
date falling three (3) years after the date on which
that version was first publicly released. The release
date of each version shall be determined by reference
to the version release records published by the
Licensor in the official code repository or on the
official website.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
Change License: Apache License, Version 2.0
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
------------------------------------------------------------------------
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
Definitions
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
"Licensed Work" means the software and associated
documentation files made available under this License.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
"Licensor" means the copyright holder(s) of the
Licensed Work.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
"Legal Entity" means any corporation, partnership,
limited liability company, sole proprietorship,
individually registered business, or other organization
recognized as a legal entity under applicable law,
including any entity engaged in commercial activity
regardless of profit motive.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
"Production Use" means any of the following:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(a) Deployment for External Parties: deploying,
installing, hosting, configuring, integrating, or
otherwise making the Licensed Work available to any
third party — whether or not for compensation,
whether or not under a separate agreement, and
whether or not the deployment is accessible via
public internet — including but not limited to
providing the Licensed Work as part of a service,
product, solution, or deliverable to any client,
customer, or other party;
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(b) Organizational Deployment: any installation,
execution, or operation of the Licensed Work in
any of the following ways:
(i) running on infrastructure owned, leased,
managed, or controlled by a Legal Entity,
including but not limited to servers, virtual
machines, containers, cloud instances, or
shared computing resources; or
(ii) by an individual acting in their capacity as
an employee, contractor, agent, or
representative of a Legal Entity, where such
use occurs on equipment provided by, or under
the direction or authorization of, such Legal
Entity; or
(iii)in a manner that is funded by, reimbursed by,
or conducted at the expense of a Legal Entity;
regardless of whether such use processes real data,
is integrated into any system, or is accessible
via any network;
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(c) Commercial Integration: incorporating the Licensed
Work into any product, service, or system that is
sold, licensed, subscribed to, or otherwise
monetized, directly or indirectly.
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
"Non-Production Use" means use that satisfies all
conditions specified in Additional Use Grant section
(b) above simultaneously. To facilitate compliance,
users are advised to retain written records sufficient
to demonstrate that all conditions of Non-Production
Use are satisfied. The Licensor shall bear the burden
of proof in accordance with applicable law when
asserting any claim of breach or infringement.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
"Third Party" means any natural person or Legal Entity
other than the user themselves. For the avoidance of
doubt, a Legal Entity and its affiliates, subsidiaries,
parent companies, or related entities each constitute
separate parties for the purposes of this License,
unless they are incorporated as a single unified legal
entity under applicable law.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
------------------------------------------------------------------------
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
Terms
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
The Licensor hereby grants you the right to copy,
modify, create derivative works, redistribute, and
make Non-Production Use and Personal Use of the
Licensed Work. The foregoing rights are subject to
the following conditions:
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
Section 1 Production Use Restriction
You may not make Production Use of the Licensed Work
except as expressly permitted by a separate commercial
license obtained from the Licensor. For the avoidance
of doubt:
(a) the scale of deployment, number of users,
transaction volume, or revenue generated does not
affect the applicability of this restriction;
(b) absence of commercial intent or profit motive does
not exempt any use from this restriction; and
(c) any Production Use, regardless of scale, intent,
or organizational structure, requires a commercial
license.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
Section 2 Automatic Termination
Any use of the Licensed Work in violation of this
License will automatically terminate your rights
under this License for the current version and all
other versions of the Licensed Work released after
the date of first violation. For the avoidance of
doubt, versions of the Licensed Work released under
a prior open source license before the adoption of
this License remain governed by that prior license
and are not affected by termination under this
section.
END OF TERMS AND CONDITIONS
Section 3 Distribution Requirements
You must provide all recipients of the Licensed Work
with a copy of this License.
APPENDIX: How to apply the Apache License to your work.
Section 4 Modification Notices
You must cause any modified files to carry prominent
notices stating that you changed the files and the
date of such changes.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Section 5 Notice Preservation
You must not remove, alter, or obscure any licensing,
copyright, attribution, or other notices of the
Licensor in the Licensed Work except as expressly
permitted by a separate commercial license.
Copyright 2019 JiZhao Jiang
Section 6 No Trademark License
This License does not grant you any right in the
trademarks, service marks, trade names, or logos
of the Licensor.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
Section 7 Disclaimer of Warranties
TO THE EXTENT PERMITTED BY APPLICABLE LAW, THE
LICENSED WORK IS PROVIDED ON AN "AS IS" BASIS.
LICENSOR HEREBY DISCLAIMS ALL WARRANTIES, WHETHER
EXPRESS, IMPLIED, STATUTORY, OR OTHERWISE, AND
SPECIFICALLY DISCLAIMS ALL IMPLIED WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE,
TITLE, AND NON-INFRINGEMENT. THE FOREGOING DISCLAIMER
SHALL NOT APPLY TO THE EXTENT PROHIBITED BY
APPLICABLE MANDATORY LAW.
http://www.apache.org/licenses/LICENSE-2.0
Section 8 Limitation of Liability
TO THE EXTENT PERMITTED BY APPLICABLE LAW, IN NO
EVENT WILL THE LICENSOR BE LIABLE FOR ANY INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES ARISING OUT OF OR RELATED TO THIS LICENSE
OR THE USE OR INABILITY TO USE THE LICENSED WORK,
EVEN IF THE LICENSOR HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGES. THE FOREGOING LIMITATION
SHALL NOT APPLY TO THE EXTENT PROHIBITED BY
APPLICABLE MANDATORY LAW.
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
Section 9 Change Date
If the Change Date applicable to a specific version
has passed, this License shall, with respect to that
version, be replaced by the Change License, and from
that date you may use that version of the Licensed
Work under the terms of the Change License.
Section 10 Governing Interpretation
This License shall be interpreted in accordance with
its plain meaning and the overall purpose of this
License. The Licensor hereby declares that the core
purpose of this License is to require a commercial
license for all Production Use as defined herein.
This License shall be interpreted in accordance with
applicable law.
This License constitutes a standard form contract.
The Licensor has drawn the attention of users to all
terms that exclude or limit the Licensor's liability,
restrict users' rights, or impose obligations on
users, by presenting such terms prominently in this
License, in fulfillment of the Licensor's obligation
to give notice and explanation as required by
applicable law.
------------------------------------------------------------------------
For information about the Business Source License,
see https://mariadb.com/bsl11/
For commercial licensing inquiries, contact:
Beijing Flipped Aurora Technology Co., Ltd.
(北京翻转极光科技有限责任公司)
Email: business@gin-vue-admin.com
Website: https://www.gin-vue-admin.com
+12 -15
View File
@@ -2,9 +2,9 @@ SHELL = /bin/bash
#SCRIPT_DIR = $(shell pwd)/etc/script
#请选择golang版本
BUILD_IMAGE_SERVER = golang:1.18
BUILD_IMAGE_SERVER = golang:1.22
#请选择node版本
BUILD_IMAGE_WEB = node:16
BUILD_IMAGE_WEB = node:20
#项目名称
PROJECT_NAME = github.com/flipped-aurora/gin-vue-admin/server
#配置文件目录
@@ -13,16 +13,9 @@ CONFIG_FILE = config.yaml
IMAGE_NAME = gva
#镜像地址
REPOSITORY = registry.cn-hangzhou.aliyuncs.com/${IMAGE_NAME}
ifeq ($(TAGS_OPT),)
TAGS_OPT = latest
else
endif
ifeq ($(PLUGIN),)
PLUGIN = email
else
endif
#镜像版本
TAGS_OPT ?= latest
PLUGIN ?= email
#容器环境前后端共同打包
build: build-web build-server
@@ -48,7 +41,7 @@ build-image-server:
build-local:
if [ -d "build" ];then rm -rf build; else echo "OK!"; fi \
&& if [ -f "/.dockerenv" ];then echo "OK!"; else make build-web-local && make build-server-local; fi \
&& mkdir build && cp -r web/dist build/ && cp server/server build/ && cp -r server/resource build/resource
&& mkdir build && cp -r web/dist build/ && cp server/server build/ && cp -r server/resource build/resource
#本地环境打包前端
build-web-local:
@@ -63,13 +56,17 @@ build-server-local:
&& go build -ldflags "-B 0x$(shell head -c20 /dev/urandom|od -An -tx1|tr -d ' \n') -X main.Version=${TAGS_OPT}" -v
#打包前后端二合一镜像
image: build
image: build
docker build -t ${REPOSITORY}/gin-vue-admin:${TAGS_OPT} -f deploy/docker/Dockerfile .
#尝鲜版
images: build build-image-web build-image-server
docker build -t ${REPOSITORY}/all:${TAGS_OPT} -f deploy/docker/Dockerfile .
#swagger 文档生成
doc:
@cd server && swag init
#插件快捷打包: make plugin PLUGIN="这里是插件文件夹名称,默认为email"
plugin:
if [ -d ".plugin" ];then rm -rf .plugin ; else echo "OK!"; fi && mkdir -p .plugin/${PLUGIN}/{server/plugin,web/plugin} \
+6 -6
View File
@@ -1,6 +1,6 @@
<div align=center>
<img src="http://qmplusimg.henrongyi.top/gvalogo.jpg" width=300" height="300" />
<img src="http://qmplusimg.henrongyi.top/gvalogo.jpg" width="300" height="300" />
</div>
<div align=center>
<img src="https://img.shields.io/badge/golang-1.18-blue"/>
@@ -16,10 +16,6 @@ English | [简体中文](./README.md)
[github](https://github.com/flipped-aurora/gin-vue-admin): https://github.com/flipped-aurora/gin-vue-admin
[Vue3 version branch address](https://github.com/flipped-aurora/gin-vue-admin/tree/vue3Develop): https://github.com/flipped-aurora/gin-vue-admin/tree/vue3Develop
[Approval flow branch](https://github.com/flipped-aurora/gin-vue-admin/tree/gva_workflow): https://github.com/flipped-aurora/gin-vue-admin/tree/gva_workflow
# Project Guidelines
[Online Documentation](https://www.gin-vue-admin.com/) : https://www.gin-vue-admin.com/
@@ -152,7 +148,7 @@ go env -w GOPROXY=https://goproxy.cn,https://goproxy.io,direct
cd server
go generate -run "go env -w .*?"
# 使用如下命令下载swag
# Use the following command to download swag
go get -u github.com/swaggo/swag/cmd/swag
````
@@ -303,6 +299,10 @@ swag init
Thank you for considering your contribution to gin-vue-admin!
<a href="https://openomy.app/github/flipped-aurora/gin-vue-admin" target="_blank" style="display: block; width: 100%;" align="center">
<img src="https://openomy.app/svg?repo=flipped-aurora/gin-vue-admin&chart=bubble&latestMonth=3" target="_blank" alt="Contribution Leaderboard" style="display: block; width: 100%;" />
</a>
<a href="https://github.com/flipped-aurora/gin-vue-admin/graphs/contributors">
<img src="https://contrib.rocks/image?repo=flipped-aurora/gin-vue-admin" />
</a>
+111 -236
View File
@@ -1,50 +1,74 @@
<div align=center>
<img src="http://qmplusimg.henrongyi.top/gvalogo.jpg" width=300" height="300" />
</div>
<div align=center>
<img src="https://img.shields.io/badge/golang-1.18-blue"/>
<img src="https://img.shields.io/badge/gin-1.9.1-lightBlue"/>
<img src="https://img.shields.io/badge/vue-3.3.4-brightgreen"/>
<img src="https://img.shields.io/badge/element--plus-2.3.8-green"/>
<img src="https://img.shields.io/badge/gorm-1.25.2-red"/>
<div align="center">
<img src="http://qmplusimg.henrongyi.top/gvalogo.jpg" width="300" height="300" />
</div>
[English](./README-en.md) | 简体中文
<div align="center">
<img src="https://img.shields.io/badge/golang-1.20-blue" />
<img src="https://img.shields.io/badge/gin-1.9.1-lightBlue" />
<img src="https://img.shields.io/badge/vue-3.3.4-brightgreen" />
<img src="https://img.shields.io/badge/element--plus-2.3.8-green" />
<img src="https://img.shields.io/badge/gorm-1.25.2-red" />
<img src="https://gitcode.com/flipped-aurora/gin-vue-admin/star/badge.svg" />
</div>
## 不同版本
<br>
我们会对以下四个版本持续维护,请选择适合自己的版本使用。最新技术栈为组合式api版本,已支持多语言(I18N)
<div align="center">
<a href="https://trendshift.io/repositories/3250" target="_blank">
<img src="https://trendshift.io/api/badge/repositories/3250" alt="Trendshift" width="250" height="55" />
</a>
</div>
[组合式API版(主)](https://github.com/flipped-aurora/gin-vue-admin) |
[组合式API多语言(i18n)版](https://github.com/flipped-aurora/gin-vue-admin/tree/i18n-dev-new) |
[声明式API版](https://github.com/flipped-aurora/gin-vue-admin/tree/v2.4.x) |
[声明式API多语言(i18n)版](https://github.com/flipped-aurora/gin-vue-admin/tree/i18n-dev)
<p align="center">
<a href="./README-en.md">English</a> | 简体中文
</p>
# 项目文档
[在线文档](https://www.gin-vue-admin.com) : https://www.gin-vue-admin.com
## 支持 Claw 生态
[初始化](https://www.gin-vue-admin.com/guide/start-quickly/initialization.html)
[从环境到部署教学视频](https://www.bilibili.com/video/BV1Rg411u7xH)
[🦞 GvaClaw](https://plugin.gin-vue-admin.com/details/159)
[开发教学](https://www.gin-vue-admin.com/guide/start-quickly/env.html) (贡献者: <a href="https://github.com/LLemonGreen">LLemonGreen</a> And <a href="https://github.com/fkk0509">Fann</a>)
## 一分钟生成前后端基础代码
[交流社区](https://support.qq.com/products/371961)
<table>
<tr>
<td width="250">
<p>⭐️ <a href="https://www.bilibili.com/video/BV1B3htzqEf1/?spm_id_from=333.1387.homepage.video_card.click" target="__blank"> 高度适配AI编辑器的MCP </a></p>
<p>📄 创建基础模板</p>
<p>🤖 AI生成结构</p>
<p>⏰ 生成代码</p>
<p>🏷️ 分配权限</p>
<p>🎉 基础CURD生成完成</p>
</td>
<td>
<video src="https://private-user-images.githubusercontent.com/165128580/384700666-4d039215-af29-4f86-bb4f-60dbab38f58e.mp4?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MzEyNTIxNDYsIm5iZiI6MTczMTI1MTg0NiwicGF0aCI6Ii8xNjUxMjg1ODAvMzg0NzAwNjY2LTRkMDM5MjE1LWFmMjktNGY4Ni1iYjRmLTYwZGJhYjM4ZjU4ZS5tcDQ_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjQxMTEwJTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI0MTExMFQxNTE3MjZaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT00NjJkMDcwZjJkMjAyMmU1N2I2MzQxY2RhODFlNzgzNGRiMDFhMmY2NTYyM2ZmODdhNDVmMWE1NzlhMDdlOTI5JlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCJ9.ZJbswpLzF2RHjemcGirKOP0L1fvpl3FUqIiQ_-yjeUo" controls="controls" muted="muted" class="d-block rounded-bottom-2 border-top width-fit" style="max-height:640px; min-height: 200px">
</video>
</td>
</tr>
</table>
[插件市场](https://plugin.gin-vue-admin.com/)
## 项目文档
# 重要提示
- **在线文档**: [https://www.gin-vue-admin.com](https://www.gin-vue-admin.com)
- **初始化指南**: [点击查看](https://www.gin-vue-admin.com/guide/start-quickly/initialization.html)
- **从环境到部署教学视频**: [bilibili](https://www.bilibili.com/video/BV1Rg411u7xH)
- **开发教学**: [开发教学说明](https://www.gin-vue-admin.com/guide/start-quickly/env.html) (贡献者: <a href="https://github.com/LLemonGreen">LLemonGreen</a> And <a href="https://github.com/fkk0509">Fann</a>)
- **交流社区**: [点击进入](https://support.qq.com/products/371961)
- **插件市场**: [点击进入](https://plugin.gin-vue-admin.com/)
- **软件著作权证书**: [查看证书](https://www.gin-vue-admin.com/copyright.pdf)
1.本项目从起步到开发到部署均有文档和详细视频教程
## 重要提示
2.本项目需要您有一定的golang和vue基础
1. 本项目从起步到开发到部署均有文档和详细视频教程。
2. 本项目需要您有一定的 golang 和 vue 基础。
3. 您完全可以通过我们的教程和文档完成一切操作,因此我们不再提供免费的技术服务,如需服务请进行[付费支持](https://www.gin-vue-admin.com/coffee/payment.html)。
4. 本项目采用 BSL 1.1 授权。非商用、学习、评估等用途请遵循仓库许可证;如将此项目用于商用或生产环境,或需要移除版权与署名信息,请[购买授权](https://plugin.gin-vue-admin.com/license)。您需保留仓库、日志和代码中的版权声明信息。
3.您完全可以通过我们的教程和文档完成一切操作,因此我们不再提供免费的技术服务,如需服务请进行[付费支持](https://www.gin-vue-admin.com/coffee/payment.html)
<br>
4.如果您将此项目用于商业用途,请遵守Apache2.0协议并保留作者技术支持声明。您需保留如下版权声明信息,其余信息功能不做任何限制。如需剔除请[购买授权](https://www.gin-vue-admin.com/empower/index.html)
<img src="https://qmplusimg.henrongyi.top/%E6%8E%88%E6%9D%83.png" width="1000">
<div align="center">
<img src="https://qmplusimg.henrongyi.top/openSource/login.jpg" width="49%" alt="登录界面" style="border-radius: 8px;" />
<img src="https://qmplusimg.henrongyi.top/openSource/dashboard.jpg" width="49%" alt="仪表盘" style="border-radius: 8px;" />
</div>
## 1. 基本介绍
@@ -52,13 +76,12 @@
> Gin-vue-admin是一个基于 [vue](https://vuejs.org) 和 [gin](https://gin-gonic.com) 开发的全栈前后端分离的开发基础平台,集成jwt鉴权,动态路由,动态菜单,casbin鉴权,表单生成器,代码生成器等功能,提供多种示例文件,让您把更多时间专注在业务开发上。
[在线预览](http://demo.gin-vue-admin.com): http://demo.gin-vue-admin.com
测试用户名:admin
测试密码:123456
- **在线预览**: [http://demo.gin-vue-admin.com](http://demo.gin-vue-admin.com)
- **测试用户名**: `admin`
- **测试密码**: `123456`
### 1.2 贡献指南
Hi! 首先感谢你使用 gin-vue-admin。
Gin-vue-admin 是一套为快速研发准备的一整套前后端分离架构式的开源框架,旨在快速搭建中小型项目。
@@ -67,32 +90,25 @@ Gin-vue-admin 的成长离不开大家的支持,如果你愿意为 gin-vue-adm
#### 1.2.1 Issue 规范
- issue 仅用于提交 Bug 或 Feature 以及设计相关的内容,其它内容可能会被直接关闭。
- 在提交 issue 之前,请搜索相关内容是否已被提出。
#### 1.2.2 Pull Request 规范
- 请先 fork 一份到自己的项目下,不要直接在仓库下建分支。
- commit 信息要以`[文件名]: 描述信息` 的形式填写,例如 `README.md: fix xxx bug`。
- commit 信息要以 `[文件名]: 描述信息` 的形式填写,例如 `README.md: fix xxx bug`。
- 如果是修复 bug,请在 PR 中给出描述信息。
- 合并代码需要两名维护人员参与:一人进行 review 后 approve,另一人再次 review,通过后即可合并。
## 2. 使用说明
```
- node版本 > v16.8.3
- golang版本 >= v1.16
- node版本 > v18.16.0
- golang版本 >= v1.22
- IDE推荐:Goland
```
### 2.1 server项目
使用 `Goland` 等编辑工具,打开server目录,不可以打开 gin-vue-admin 根目录
```bash
# 克隆项目
git clone https://github.com/flipped-aurora/gin-vue-admin.git
# 进入server文件夹
@@ -101,11 +117,8 @@ cd server
# 使用 go mod 并安装go依赖包
go generate
# 编译
go build -o server main.go (windows编译命令为go build -o server.exe main.go )
# 运行二进制
./server (windows运行命令为 server.exe)
# 运行
go run .
```
### 2.2 web项目
@@ -125,53 +138,29 @@ npm run serve
#### 2.3.1 安装 swagger
##### (1)可以访问外国网站
````
go get -u github.com/swaggo/swag/cmd/swag
````
##### (2)无法访问外国网站
由于国内没法安装 go.org/x 包下面的东西,推荐使用 [goproxy.cn](https://goproxy.cn) 或者 [goproxy.io](https://goproxy.io/zh/)
```bash
# 如果您使用的 Go 版本是 1.13 - 1.15 需要手动设置GO111MODULE=on, 开启方式如下命令, 如果你的 Go 版本 是 1.16 ~ 最新版 可以忽略以下步骤一
# 步骤一、启用 Go Modules 功能
go env -w GO111MODULE=on
# 步骤二、配置 GOPROXY 环境变量
go env -w GOPROXY=https://goproxy.cn,https://goproxy.io,direct
# 如果嫌弃麻烦,可以使用go generate 编译前自动执行代码, 不过这个不能使用 `Goland` 或者 `Vscode` 的 命令行终端
cd server
go generate -run "go env -w .*?"
# 使用如下命令下载swag
go get -u github.com/swaggo/swag/cmd/swag
go install github.com/swaggo/swag/cmd/swag@latest
```
#### 2.3.2 生成API文档
```` shell
```bash
cd server
swag init
````
```
> 执行上面的命令后,server目录下会出现docs文件夹里的 `docs.go`, `swagger.json`, `swagger.yaml` 三个文件更新,启动go服务之后, 在浏览器输入 [http://localhost:8888/swagger/index.html](http://localhost:8888/swagger/index.html) 即可查看swagger文档
### 2.4 VSCode工作区
#### 2.4.1 开发
使用`VSCode`打开根目录下的工作区文件`gin-vue-admin.code-workspace`,在边栏可以看到三个虚拟目录:`backend`、`frontend`、`root`。
使用 `VSCode` 打开根目录下的工作区文件 `gin-vue-admin.code-workspace`,在边栏可以看到三个虚拟目录:`backend`、`frontend`、`root`。
#### 2.4.2 运行/调试
在运行和调试中也可以看到三个task:`Backend`、`Frontend`、`Both (Backend & Frontend)`。运行`Both (Backend & Frontend)`可以同时启动前后端项目。
在运行和调试中也可以看到三个 task:`Backend`、`Frontend`、`Both (Backend & Frontend)`。运行 `Both (Backend & Frontend)` 可以同时启动前后端项目。
#### 2.4.3 settings
在工作区配置文件中有`go.toolsEnvVars`字段,是用于`VSCode`自身的go工具环境变量。此外在多go版本的系统中,可以通过`gopath`、`go.goroot`指定运行版本。
在工作区配置文件中有 `go.toolsEnvVars` 字段,是用于 `VSCode` 自身的 go 工具环境变量。此外在多 go 版本的系统中,可以通过 `gopath`、`go.goroot` 指定运行版本。
```json
"go.gopath": null,
@@ -182,10 +171,10 @@ swag init
- 前端:用基于 [Vue](https://vuejs.org) 的 [Element](https://github.com/ElemeFE/element) 构建基础页面。
- 后端:用 [Gin](https://gin-gonic.com/) 快速搭建基础restful风格API,[Gin](https://gin-gonic.com/) 是一个go语言编写的Web框架。
- 数据库:采用`MySql` > (5.7) 版本 数据库引擎 InnoDB,使用 [gorm](http://gorm.cn) 实现对数据库的基本操作。
- 缓存:使用`Redis`实现记录当前活跃用户的`jwt`令牌并实现多点登录限制。
- API文档:使用`Swagger`构建自动化文档。
- 配置文件:使用 [fsnotify](https://github.com/fsnotify/fsnotify) 和 [viper](https://github.com/spf13/viper) 实现`yaml`格式的配置文件。
- 数据库:采用 `MySQL` 或 `MariaDB`(5.7+),数据库引擎 InnoDB,使用 [gorm](http://gorm.cn) 实现对数据库的基本操作。
- 缓存:使用 `Redis` 实现记录当前活跃用户的 jwt 令牌并实现多点登录限制。
- API文档:使用 `Swagger` 构建自动化文档。
- 配置文件:使用 [fsnotify](https://github.com/fsnotify/fsnotify) 和 [viper](https://github.com/spf13/viper) 实现 yaml 格式的配置文件。
- 日志:使用 [zap](https://github.com/uber-go/zap) 实现日志记录。
## 4. 项目架构
@@ -194,190 +183,76 @@ swag init
![系统架构图](http://qmplusimg.henrongyi.top/gva/gin-vue-admin.png)
### 4.2 前端详细设计图 (提供者:<a href="https://github.com/baobeisuper">baobeisuper</a>)
### 4.2 详细设计图 (提供者:<a href="https://github.com/baobeisuper">baobeisuper</a>)
![前端详细设计图](http://qmplusimg.henrongyi.top/naotu.png)
![详细设计图](http://qmplusimg.henrongyi.top/naotu.png)
### 4.3 目录结构
```
├── server
├── api (api层)
│ └── v1 (v1版本接口)
├── config (配置包)
├── core (核心文件)
├── docs (swagger文档目录)
├── global (全局对象)
├── initialize (初始化)
│ └── internal (初始化内部函数)
├── middleware (中间件层)
├── model (模型层)
│ ├── request (入参结构体)
│ └── response (出参结构体)
├── packfile (静态文件打包)
├── resource (静态资源文件夹)
│ ├── excel (excel导入导出默认路径)
│ ├── page (表单生成器)
│ └── template (模板)
├── router (路由层)
├── service (service层)
├── source (source层)
└── utils (工具包)
├── timer (定时器接口封装)
└── upload (oss接口封装)
web
├── babel.config.js
├── Dockerfile
├── favicon.ico
├── index.html -- 主页面
├── limit.js -- 助手代码
├── package.json -- 包管理器代码
├── src -- 源代码
│ ├── api -- api 组
│ ├── App.vue -- 主页面
│ ├── assets -- 静态资源
│ ├── components -- 全局组件
│ ├── core -- gva 组件包
│ │ ├── config.js -- gva网站配置文件
│ │ ├── gin-vue-admin.js -- 注册欢迎文件
│ │ └── global.js -- 统一导入文件
│ ├── directive -- v-auth 注册文件
│ ├── main.js -- 主文件
│ ├── permission.js -- 路由中间件
│ ├── pinia -- pinia 状态管理器,取代vuex
│ │ ├── index.js -- 入口文件
│ │ └── modules -- modules
│ │ ├── dictionary.js
│ │ ├── router.js
│ │ └── user.js
│ ├── router -- 路由声明文件
│ │ └── index.js
│ ├── style -- 全局样式
│ │ ├── base.scss
│ │ ├── basics.scss
│ │ ├── element_visiable.scss -- 此处可以全局覆盖 element-plus 样式
│ │ ├── iconfont.css -- 顶部几个icon的样式文件
│ │ ├── main.scss
│ │ ├── mobile.scss
│ │ └── newLogin.scss
│ ├── utils -- 方法包库
│ │ ├── asyncRouter.js -- 动态路由相关
│ │ ├── btnAuth.js -- 动态权限按钮相关
│ │ ├── bus.js -- 全局mitt声明文件
│ │ ├── date.js -- 日期相关
│ │ ├── dictionary.js -- 获取字典方法
│ │ ├── downloadImg.js -- 下载图片方法
│ │ ├── format.js -- 格式整理相关
│ │ ├── image.js -- 图片相关方法
│ │ ├── page.js -- 设置页面标题
│ │ ├── request.js -- 请求
│ │ └── stringFun.js -- 字符串文件
| ├── view -- 主要view代码
| | ├── about -- 关于我们
| | ├── dashboard -- 面板
| | ├── error -- 错误
| | ├── example --上传案例
| | ├── iconList -- icon列表
| | ├── init -- 初始化数据
| | | ├── index -- 新版本
| | | ├── init -- 旧版本
| | ├── layout -- layout约束页面
| | | ├── aside
| | | ├── bottomInfo -- bottomInfo
| | | ├── screenfull -- 全屏设置
| | | ├── setting -- 系统设置
| | | └── index.vue -- base 约束
| | ├── login --登录
| | ├── person --个人中心
| | ├── superAdmin -- 超级管理员操作
| | ├── system -- 系统检测页面
| | ├── systemTools -- 系统配置相关页面
| | └── routerHolder.vue -- page 入口页面
├── vite.config.js -- vite 配置文件
└── yarn.lock
```
*(详细目录结构请见源码...)*
## 5. 主要功能
- 权限管理:基于`jwt`和`casbin`实现的权限管理。
- 文件上传下载:实现基于`七牛云`, `阿里云`, `腾讯云` 的文件上传操作(请开发自己去各个平台的申请对应 `token` 或者对应`key`)。
- 分页封装:前端使用 `mixins` 封装分页,分页方法调用 `mixins` 即可。
- 权限管理:基于 `jwt` 和 `casbin` 实现的权限管理。
- 文件上传下载:实现基于 `七牛云`, `阿里云`, `腾讯云` 的文件上传操作。
- 分页封装:前端使用 `mixins` 封装分页,分页方法调用即可。
- 用户管理:系统管理员分配用户角色和角色权限。
- 角色管理:创建权限控制的主要对象,可以给角色分配不同api权限和菜单权限。
- 角色管理:创建权限控制的主要对象,可以给角色分配不同 api 权限和菜单权限。
- 菜单管理:实现用户动态菜单配置,实现不同角色不同菜单。
- api管理:不同用户可调用的api接口的权限不同。
- api管理:不同用户可调用的 api 接口的权限不同。
- 配置管理:配置文件可前台修改(在线体验站点不开放此功能)。
- 条件搜索:增加条件搜索示例。
- restful示例:可以参考用户管理模块中的示例API。
- 前端文件参考: [web/src/view/superAdmin/api/api.vue](https://github.com/flipped-aurora/gin-vue-admin/blob/master/web/src/view/superAdmin/api/api.vue)
- 后台文件参考: [server/router/sys_api.go](https://github.com/flipped-aurora/gin-vue-admin/blob/master/server/router/sys_api.go)
- 多点登录限制:需要在`config.yaml`中把`system`中的`use-multipoint`修改为true(需要自行配置Redis和Config中的Redis参数,测试阶段,有bug请及时反馈)。
- restful示例:可以参考用户管理模块中的示例 API。
- 多点登录限制:借助 Redis 配合对应配置限制多端登录状态。
- 分片上传:提供文件分片上传和大文件分片上传功能示例。
- 表单生成器:表单生成器借助 [@Variant Form](https://github.com/vform666/variant-form) 。
- 代码生成器:后台基础逻辑以及简单curd的代码生成器。
- 表单生成器:表单生成器借助 [@Variant Form](https://github.com/vform666/variant-form)。
- 代码生成器:后台基础逻辑以及简单 curd 的代码生成器。
## 6. 知识库
## 6.1 团队博客
### 6.1 团队博客
> https://www.yuque.com/flipped-aurora
>
>内有前端框架教学视频。如果觉得项目对您有所帮助可以添加我的个人微信:shouzi_1994,欢迎您提出宝贵的需求。
> [https://www.yuque.com/flipped-aurora](https://www.yuque.com/flipped-aurora)
> 内有前端框架教学视频。如果觉得项目对您有所帮助可以添加我的个人微信: shouzi_1994。
## 6.2 教学视频
### 6.2 教学视频
(1)手把手教学视频
> https://www.bilibili.com/video/BV1Rg411u7xH/
(2)后端目录结构调整介绍以及使用方法
> https://www.bilibili.com/video/BV1x44y117TT/
(3)golang基础教学视频
> bilibili:https://space.bilibili.com/322210472/channel/detail?cid=108884
(4)gin框架基础教学
> bilibili:https://space.bilibili.com/322210472/channel/detail?cid=126418&ctype=0
(5)gin-vue-admin 版本更新介绍视频
> bilibili:https://www.bilibili.com/video/BV1kv4y1g7nT
1. **手把手教学视频**: [https://www.bilibili.com/video/BV1Rg411u7xH/](https://www.bilibili.com/video/BV1Rg411u7xH/)
2. **后端目录结构调整介绍以及使用方法**: [https://www.bilibili.com/video/BV1x44y117TT/](https://www.bilibili.com/video/BV1x44y117TT/)
3. **golang基础教学视频**: [bilibili](https://space.bilibili.com/322210472/channel/detail?cid=108884)
4. **gin框架基础教学**: [bilibili](https://space.bilibili.com/322210472/channel/detail?cid=126418&ctype=0)
5. **gin-vue-admin 版本更新介绍视频**: [bilibili](https://www.bilibili.com/video/BV1kv4y1g7nT)
## 7. 联系方式
### 7.1 技术群
### QQ交流群:622360840
| QQ 群 |
| :---: |
| <img src="http://qmplusimg.henrongyi.top/qq.jpg" width="180"/> |
- **QQ交流群**: `971857775`
- **[关于我们](https://www.gin-vue-admin.com/about/join.html)**
### 微信交流群
| 微信 |
| :---: |
| <img width="150" src="http://qmplusimg.henrongyi.top/qrjjz.png">
添加微信,备注"加入gin-vue-admin交流群"
<img width="150" src="http://qmplusimg.henrongyi.top/qrjjz.png">
### [关于我们](https://www.gin-vue-admin.com/about/join.html)
防止广告进群,添加微信,输入以下代码执行结果(请勿转码为string):
```go
str := "5Yqg5YWlR1ZB5Lqk5rWB576k"
decodeBytes, err := base64.StdEncoding.DecodeString(str)
fmt.Println(decodeBytes, err)
```
## 8. 贡献者
感谢您对gin-vue-admin的贡献!
<a href="https://github.com/flipped-aurora/gin-vue-admin/graphs/contributors">
<img src="https://contrib.rocks/image?repo=flipped-aurora/gin-vue-admin" />
<a href="https://openomy.app/github/flipped-aurora/gin-vue-admin" target="_blank" style="display: block; width: 100%;" align="center">
<img src="https://openomy.app/svg?repo=flipped-aurora/gin-vue-admin&chart=bubble&latestMonth=3" target="_blank" alt="Contribution Leaderboard" style="display: block; width: 100%;" />
</a>
## 9. 捐赠
如果你觉得这个项目对你有帮助,你可以请作者喝饮料 :tropical_drink: [点我](https://www.gin-vue-admin.com/coffee/index.html)
## 10. 商用注意事项
## 10. 注意事项
如果您将此项目用于商业用途,请遵守Apache2.0协议并保留作者技术支持声明。
请遵守 BSL 1.1 许可证要求并保留作品声明;商用、生产使用或去除版权信息请务必[获取授权](https://plugin.gin-vue-admin.com/license)
未授权超出许可范围使用将依法追究法律责任。
+41
View File
@@ -0,0 +1,41 @@
# aiDoc
`aiDoc/` 是本仓库的结构化 AI 文档层,用于把长期有效的项目上下文从工具目录中抽离出来,并按主题拆分成可维护的约束文档。
## 使用方式
1. 先读取 `AGENT.MD`
2. 再查看本索引文件
3. 按任务只打开相关子目录
4. 不再把项目级规则塞回 `.codex/`、`.claude/`、`.cursor/`、`.trae/`
## 目录说明
- `relations/`: 仓库结构、技术栈、依赖关系、开发流程
- `modules/`: 后端分层规则、插件结构、模块职责
- `frontend-backend/`: 前后端契约、前端规范、工具函数复用规则
- `examples/`: 讲解型示例,告诉 AI 每一层应该按什么标准组织和书写
- `memory/`: AI 记忆层,拆分为长期记忆与业务记忆
## 常用入口
- `relations/repo-profile.md`: 项目定位、技术栈、核心特性
- `relations/development-workflow.md`: GVA 开发流程、分支与提交规范
- `relations/licensing-and-branding.md`: 版权、授权与品牌相关任务的协作边界
- `modules/backend-layer-rules.md`: 后端分层、`enter.go`、统一响应、Swagger 约束
- `modules/plugin-development.md`: 前后端插件结构与开发流程
- `frontend-backend/boundary.md`: 前后端契约与字段类型约束
- `frontend-backend/frontend-rules.md`: 前端代码、状态、路由、样式规范
- `frontend-backend/frontend-utils.md`: `src/utils/` 工具库的强制复用规则
- `examples/README.md`: 示例层总入口
- `memory/project-memory.md`: 记忆层总入口
- `memory/long-term/`: 长期记忆
- `memory/business/`: 业务需求记忆
## 维护原则
- 稳定规则放这里,不放到工具私有目录里
- 临时会话草稿不要入库,只有变成长期知识时才记录
- 适用于所有 AI 的项目级规则,先写进 `AGENT.MD`
- 细节说明再拆到 `aiDoc/` 对应子目录
- 只要用户提出业务需求,就要同步更新 `memory/business/`
+46
View File
@@ -0,0 +1,46 @@
# 示例层
`aiDoc/examples/` 是讲解型示例层。
这里的文档不是要求 AI 逐字复制代码,而是告诉 AI:
- 某一层文件通常该承担什么职责
- 在这个仓库里推荐用什么组织方式
- 为什么要这样写
- 常见错误是什么
- 真正可以参考哪些现成文件
## 读取建议
### 新增后端能力时
建议按这个顺序读:
1. `backend/request-example.md`
2. `backend/model-example.md`
3. `backend/service-example.md`
4. `backend/api-example.md`
5. `backend/router-example.md`
6. `backend/enter-go-example.md`
### 新增前端能力时
建议按这个顺序读:
1. `frontend/api-example.md`
2. `frontend/pinia-example.md`
3. `frontend/view-example.md`
4. `frontend/utils-usage-example.md`
### 新增插件时
建议至少先读:
1. `plugin/full-plugin-example.md`
2. `backend/plugin-go-example.md`
## 使用原则
- 优先参考仓库内真实文件,其次参考本目录的示例文档
- 示例关注结构与写法,不替代业务设计
- 如果真实代码与旧示例不一致,应以当前仓库真实结构为准,并及时更新示例
+23
View File
@@ -0,0 +1,23 @@
# 后端示例
这个目录聚焦 gin-vue-admin 后端的分层写法。
## 包含内容
- `request-example.md`: 请求结构写法
- `model-example.md`: 数据模型写法
- `service-example.md`: 业务层写法
- `api-example.md`: API 层写法
- `router-example.md`: 路由层写法
- `enter-go-example.md`: `enter.go` 分组聚合写法
- `plugin-go-example.md`: 插件入口写法
## 适用范围
当 AI 需要新增或修改以下文件时,应优先阅读本目录:
- `server/model/**`
- `server/service/**`
- `server/api/**`
- `server/router/**`
- `server/plugin/**`
+103
View File
@@ -0,0 +1,103 @@
# API 示例
## 这个文件负责什么
API 层负责接收 HTTP 请求、从合适的位置提取参数、调用 Service、统一返回响应,并补全 Swagger 注释。
## 什么时候应该这样写
- 新增对外接口
- 为某个模块补 CRUD 接口
- 需要统一响应结构和错误处理
## 核心原则
参数从哪里取,不是由“AI 习惯”决定,而是由下面几件事共同决定:
1. 前端怎么传
2. 接口协议怎么约定
3. 当前逻辑到底需要什么数据
4. 这个数据放在哪个位置更合理、更安全
也就是说,API 层不应该机械地一律使用 `ShouldBindJSON`,而应该先判断参数来源,再选择对应取法。
## 常见参数来源与推荐取法
- JSON body: `ShouldBindJSON`
- Query string: `ShouldBindQuery`、`c.Query(...)`、`c.DefaultQuery(...)`
- Path params: `c.Param(...)`
- `multipart/form-data`: `c.FormFile(...)`、`c.DefaultPostForm(...)`、`c.Request.FormValue(...)`
- Header: `c.GetHeader(...)`、`c.Request.Header.Get(...)`
- Cookie: `c.Cookie(...)`
## 推荐写法示例
下面这个示例演示的是 `POST + JSON body` 场景,所以这里使用 `ShouldBindJSON`。
```go
package system
import (
"github.com/flipped-aurora/gin-vue-admin/server/model/common/response"
systemReq "github.com/flipped-aurora/gin-vue-admin/server/model/system/request"
"github.com/gin-gonic/gin"
)
// GetOrderList
// @Tags Order
// @Summary 分页获取订单列表
// @Security ApiKeyAuth
// @accept application/json
// @Produce application/json
// @Param data body systemReq.OrderSearch true "分页和筛选参数"
// @Success 200 {object} response.Response{data=response.PageResult,msg=string} "返回列表、总数、分页信息"
// @Router /order/getOrderList [post]
func (o *OrderApi) GetOrderList(c *gin.Context) {
var pageInfo systemReq.OrderSearch
if err := c.ShouldBindJSON(&pageInfo); err != nil {
response.FailWithMessage(err.Error(), c)
return
}
list, total, err := orderService.GetOrderList(pageInfo)
if err != nil {
response.FailWithMessage("获取失败", c)
return
}
response.OkWithDetailed(response.PageResult{
List: list,
Total: total,
Page: pageInfo.Page,
PageSize: pageInfo.PageSize,
}, "获取成功", c)
}
```
## 为什么这样写
- API 层统一负责“取参数 + 校验 + 调 Service + 回响应”
- 取参数方式必须与真实数据来源一致,而不是套固定模板
- 例如:
- 登录、创建、更新这类通常来自 JSON body
- 列表筛选、分页、导出条件常来自 Query
- 上传文件通常来自 `multipart/form-data`
- 鉴权 token、特殊网关头、追踪信息常来自 Header 或 Cookie
- 成功 / 失败统一使用 `response` 包
- Swagger 注释让接口契约对前端和文档生成都可见
## 常见错误
- 在 API 层直接操作数据库
- 直接 `c.JSON(...)`,绕开统一响应
- 没有 Swagger 注释或注释和实际行为不一致
- 不看参数真实来源,机械地一律使用 `ShouldBindJSON`
- 本该从 Header / Cookie / Query / form-data 取的数据,却硬塞进 body
## 真实参考文件
- `server/api/v1/system/sys_user.go`
- `server/api/v1/system/sys_dictionary.go`
- `server/api/v1/system/auto_code_mcp.go`
- `server/api/v1/example/exa_file_upload_download.go`
- `server/utils/claims.go`
@@ -0,0 +1,67 @@
# enter.go 示例
## 这个文件负责什么
`enter.go` 用来聚合某一层的模块入口,降低循环引用风险,让其他层通过统一入口访问能力。
## 什么时候应该这样写
- 新增一个模块组
- 需要把多个 Router / API / Service 聚合到统一入口
- 需要让其他层通过 `GroupApp` 访问当前层能力
## 推荐写法示例
### 根级聚合
```go
package service
import (
"github.com/flipped-aurora/gin-vue-admin/server/service/example"
"github.com/flipped-aurora/gin-vue-admin/server/service/system"
)
var ServiceGroupApp = new(ServiceGroup)
type ServiceGroup struct {
SystemServiceGroup system.ServiceGroup
ExampleServiceGroup example.ServiceGroup
}
```
### 模块级聚合
```go
package system
import api "github.com/flipped-aurora/gin-vue-admin/server/api/v1"
type RouterGroup struct {
UserRouter
OrderRouter
}
var (
baseApi = api.ApiGroupApp.SystemApiGroup.BaseApi
orderApi = api.ApiGroupApp.SystemApiGroup.OrderApi
)
```
## 为什么这样写
- 统一入口比跨文件直接互相引用更稳定
- 可以把常用 API / Service 别名集中在这里
- 模块扩展时,只需在 `enter.go` 增加聚合字段
## 常见错误
- 不用 `enter.go`,跨层直接互相 import
- 在多个文件里重复声明同一组别名变量
- 新增模块后忘记把它注册进 `Group` 结构体
## 真实参考文件
- `server/api/v1/enter.go`
- `server/service/enter.go`
- `server/router/system/enter.go`
+46
View File
@@ -0,0 +1,46 @@
# Model 示例
## 这个文件负责什么
Model 负责定义数据库实体与持久化字段,是 Service 和数据库交互的基础。
## 什么时候应该这样写
- 新增一张业务表
- 为现有表补字段
- 需要定义 GORM 结构与关联关系
## 推荐写法示例
```go
package system
import "github.com/flipped-aurora/gin-vue-admin/server/global"
type Order struct {
global.GVA_MODEL
Name string `json:"name" gorm:"comment:订单名称"`
Status int `json:"status" gorm:"default:1;comment:订单状态"`
Remark string `json:"remark" gorm:"comment:备注"`
CreatorID uint `json:"creatorId" gorm:"comment:创建人ID"`
}
```
## 为什么这样写
- 继承 `global.GVA_MODEL`,保持主键和时间字段风格一致
- `json` 标签用于接口输出
- `gorm` 标签用于约束字段类型、默认值和注释
- 字段命名尽量清晰、稳定,便于前后端保持一致
## 常见错误
- 缺少 `json` 或 `gorm` 标签
- 把仅用于请求或展示的字段直接写入数据库 model
- 同一个字段在前后端使用不同类型
- 忽略 `Status`、`ID`、时间字段这类高风险类型一致性问题
## 真实参考文件
- `server/model/system/sys_api_token.go`
- `server/model/system/sys_user.go`
@@ -0,0 +1,61 @@
# plugin.go 示例
## 这个文件负责什么
插件入口负责把插件注册进系统,并在系统启动时完成路由、菜单、字典、表结构等初始化。
## 什么时候应该这样写
- 新增一个标准 gin-vue-admin 插件
- 需要接入插件注册机制
- 需要把插件初始化逻辑收敛到统一入口
## 推荐写法示例
```go
package announcement
import (
"context"
"github.com/flipped-aurora/gin-vue-admin/server/plugin/announcement/initialize"
interfaces "github.com/flipped-aurora/gin-vue-admin/server/utils/plugin/v2"
"github.com/gin-gonic/gin"
)
var _ interfaces.Plugin = (*plugin)(nil)
var Plugin = new(plugin)
type plugin struct{}
func init() {
interfaces.Register(Plugin)
}
func (p *plugin) Register(group *gin.Engine) {
ctx := context.Background()
initialize.Api(ctx)
initialize.Menu(ctx)
initialize.Dictionary(ctx)
initialize.Gorm(ctx)
initialize.Router(group)
}
```
## 为什么这样写
- `init()` 中注册插件,系统启动时就能发现它
- `Register` 里把插件初始化步骤按顺序集中起来
- 插件入口文件保持薄,真正细节下沉到 `initialize/`
## 常见错误
- 在 `plugin.go` 里塞过多业务细节
- 忘记调用 `interfaces.Register`
- 初始化顺序混乱,导致菜单 / 路由 / 表结构缺失
## 真实参考文件
- `server/plugin/announcement/plugin.go`
- `server/plugin/announcement/initialize/router.go`
+50
View File
@@ -0,0 +1,50 @@
# Request 示例
## 这个文件负责什么
请求结构体负责承接前端入参、查询条件和分页参数,不负责数据库关联或业务逻辑。
## 什么时候应该这样写
- 新增列表查询参数
- 新增创建 / 更新接口的请求体
- 需要复用分页、排序、过滤字段时
## 推荐写法示例
```go
package request
import common "github.com/flipped-aurora/gin-vue-admin/server/model/common/request"
type CreateOrderReq struct {
Name string `json:"name" form:"name"`
Status int `json:"status" form:"status"`
Remark string `json:"remark" form:"remark"`
}
type OrderSearch struct {
common.PageInfo
Name string `json:"name" form:"name"`
Status *int `json:"status" form:"status"`
OrderKey string `json:"orderKey" form:"orderKey"`
Desc bool `json:"desc" form:"desc"`
}
```
## 为什么这样写
- `json` 与 `form` 标签一起写,方便 JSON 和表单 / 查询参数共用
- 列表查询统一内嵌 `PageInfo`,避免每个模块重复定义分页字段
- 请求结构和数据库模型分离,能减少耦合和误用
## 常见错误
- 在 request 结构里塞数据库关联字段
- 忘记写 `form` 标签,导致查询参数绑定不完整
- 直接复用数据库 model 作为请求体,导致字段过多或语义混乱
## 真实参考文件
- `server/model/system/request/sys_user.go`
- `server/model/common/request/common.go`
+56
View File
@@ -0,0 +1,56 @@
# Router 示例
## 这个文件负责什么
Router 层负责路由分组、中间件挂载和处理函数绑定,不承载业务逻辑。
## 什么时候应该这样写
- 新增模块路由
- 区分需要操作日志和不需要操作日志的接口
- 对某类路由统一挂载权限或认证中间件
## 推荐写法示例
```go
package system
import (
"github.com/flipped-aurora/gin-vue-admin/server/middleware"
"github.com/gin-gonic/gin"
)
type OrderRouter struct{}
func (r *OrderRouter) InitOrderRouter(Router *gin.RouterGroup) {
orderRouter := Router.Group("order").Use(middleware.OperationRecord())
orderRouterWithoutRecord := Router.Group("order")
{
orderRouter.POST("createOrder", orderApi.CreateOrder)
orderRouter.PUT("updateOrder", orderApi.UpdateOrder)
orderRouter.DELETE("deleteOrder", orderApi.DeleteOrder)
}
{
orderRouterWithoutRecord.POST("getOrderList", orderApi.GetOrderList)
orderRouterWithoutRecord.GET("findOrder", orderApi.FindOrder)
}
}
```
## 为什么这样写
- 写操作和读操作分组清晰,方便挂不同中间件
- 路由层只做绑定,职责边界简单明确
- 和项目现有 `InitXxxRouter` 命名方式一致
## 常见错误
- 在路由文件里写业务逻辑
- 所有接口都挂同一种中间件,导致读接口也被记录操作日志
- 直接引用数据库或 Service,而不是引用 API 处理函数
## 真实参考文件
- `server/router/system/sys_user.go`
- `server/router/system/enter.go`
+64
View File
@@ -0,0 +1,64 @@
# Service 示例
## 这个文件负责什么
Service 层负责业务逻辑、数据库查询、事务控制和数据拼装,不负责 HTTP 参数绑定和响应输出。
## 什么时候应该这样写
- 新增列表查询、创建、更新、删除逻辑
- 需要事务操作
- 需要对 model 和 request 做转换
## 推荐写法示例
```go
package system
import (
"github.com/flipped-aurora/gin-vue-admin/server/global"
"github.com/flipped-aurora/gin-vue-admin/server/model/system"
systemReq "github.com/flipped-aurora/gin-vue-admin/server/model/system/request"
)
type OrderService struct{}
func (s *OrderService) GetOrderList(info systemReq.OrderSearch) (list []system.Order, total int64, err error) {
limit := info.PageSize
offset := info.PageSize * (info.Page - 1)
db := global.GVA_DB.Model(&system.Order{})
if info.Name != "" {
db = db.Where("name LIKE ?", "%"+info.Name+"%")
}
if info.Status != nil {
db = db.Where("status = ?", *info.Status)
}
err = db.Count(&total).Error
if err != nil {
return nil, 0, err
}
err = db.Limit(limit).Offset(offset).Order("id desc").Find(&list).Error
return list, total, err
}
```
## 为什么这样写
- 只返回业务结果和 `error`,便于 API 层统一处理
- 直接使用 `global.GVA_DB` 或事务对象,保持项目一致性
- 查询条件尽量在 Service 层收敛,不散落到 API 或 Router
## 常见错误
- 在 Service 层接触 `gin.Context`
- 在 Service 层直接拼 `response.OkWith...`
- 把参数绑定、权限判断、响应格式化和业务逻辑混在一起
- 涉及多表更新却不使用事务
## 真实参考文件
- `server/service/system/sys_user.go`
- `server/service/example/exa_customer.go`
+19
View File
@@ -0,0 +1,19 @@
# 前端示例
这个目录聚焦前端常见文件类型的讲解型示例。
## 包含内容
- `api-example.md`: 前端接口封装示例
- `pinia-example.md`: Pinia store 示例
- `view-example.md`: 页面组件示例
- `utils-usage-example.md`: 工具函数复用示例
## 适用范围
当 AI 需要新增或修改以下文件时,应优先阅读本目录:
- `web/src/api/**`
- `web/src/pinia/**`
- `web/src/view/**`
- `web/src/plugin/**`
+54
View File
@@ -0,0 +1,54 @@
# 前端 API 示例
## 这个文件负责什么
前端 API 文件负责把后端接口封装成可复用函数,统一走 `@/utils/request`,不在组件里直接拼 axios 请求。
## 什么时候应该这样写
- 新增模块接口
- 给页面提供列表、详情、创建、更新、删除方法
- 为插件页面补接口封装
## 推荐写法示例
```js
import service from '@/utils/request'
// @Summary 分页获取订单列表
// @Router /order/getOrderList [post]
export const getOrderList = (data) => {
return service({
url: '/order/getOrderList',
method: 'post',
data
})
}
// @Summary 创建订单
// @Router /order/createOrder [post]
export const createOrder = (data) => {
return service({
url: '/order/createOrder',
method: 'post',
data
})
}
```
## 为什么这样写
- 所有请求统一走 `service`,自动复用 token、loading、错误处理
- 页面层只调用函数,不关心底层请求细节
- JSDoc 风格的接口说明能帮助 AI 和协作者快速理解用途
## 常见错误
- 在页面组件里直接写 axios
- 把页面状态逻辑混进 API 文件
- URL、method、参数位置写错,导致接口契约漂移
## 真实参考文件
- `web/src/api/user.js`
- `web/src/plugin/announcement/api/info.js`
+73
View File
@@ -0,0 +1,73 @@
# Pinia 示例
## 这个文件负责什么
Pinia store 负责全局状态、异步动作和跨页面共享数据,不负责页面渲染细节。
## 什么时候应该这样写
- 用户信息、路由、字典、系统参数等共享状态
- 多页面都会用到的业务状态
- 需要统一缓存或集中副作用的场景
## 推荐写法示例
```js
import { defineStore } from 'pinia'
import { ref, computed } from 'vue'
import { getOrderList } from '@/api/order'
export const useOrderStore = defineStore('order', () => {
const list = ref([])
const total = ref(0)
const loading = ref(false)
const hasData = computed(() => list.value.length > 0)
const fetchList = async (params) => {
loading.value = true
try {
const res = await getOrderList(params)
if (res.code === 0) {
list.value = res.data.list
total.value = res.data.total
}
return res
} finally {
loading.value = false
}
}
const reset = () => {
list.value = []
total.value = 0
}
return {
list,
total,
loading,
hasData,
fetchList,
reset
}
})
```
## 为什么这样写
- `ref + computed + async action` 是当前仓库里很自然的组织方式
- 页面层拿 store 结果即可,不必重复写状态管理逻辑
- 把 loading 和 reset 一并收进 store,调用侧更干净
## 常见错误
- 把所有局部页面状态都塞进全局 store
- 在 store 里写大量 DOM 操作
- 不做 loading / reset 管理,导致页面状态混乱
## 真实参考文件
- `web/src/pinia/modules/user.js`
- `web/src/pinia/modules/router.js`
- `web/src/pinia/modules/dictionary.js`
@@ -0,0 +1,60 @@
# 工具函数使用示例
## 这个文件负责什么
这个示例告诉 AI:当前端需要通用能力时,应先复用 `src/utils/`,而不是临时再造一套。
## 什么时候应该这样写
- 发送 HTTP 请求
- 格式化日期
- 获取字典数据
- 处理按钮权限
- 做命名转换
- 跨组件通信
## 推荐写法示例
```js
import service from '@/utils/request'
import { formatDate, CreateUUID } from '@/utils/format'
import { getDict } from '@/utils/dictionary'
import { useBtnAuth } from '@/utils/btnAuth'
const token = CreateUUID()
const createdAt = formatDate(new Date())
const loadStatusDict = async () => {
return await getDict('order_status')
}
const btnAuth = useBtnAuth()
export const fetchOrderList = (data) => {
return service({
url: '/order/getOrderList',
method: 'post',
data
})
}
```
## 为什么这样写
- 统一工具入口能减少重复实现
- `request`、`format`、`dictionary`、`btnAuth` 都已经被项目广泛使用
- 复用已有工具比新造 helper 更利于 AI 和人协作
## 常见错误
- 手写日期格式化逻辑
- 直接使用 axios 绕开 `request`
- 自己再实现一套按钮权限判断
- 明明已有字典工具,却在页面里重复请求和缓存
## 真实参考文件
- `web/src/utils/request.js`
- `web/src/utils/format.js`
- `web/src/utils/dictionary.js`
- `web/src/utils/btnAuth.js`
+81
View File
@@ -0,0 +1,81 @@
# View 示例
## 这个文件负责什么
页面组件负责查询表单、表格、弹窗、抽屉和交互流程,是用户真正接触到的界面层。
## 什么时候应该这样写
- 新增后台管理页面
- 新增列表页 + 搜索 + 分页
- 新增表单弹窗或抽屉流程
## 推荐写法示例
```vue
<template>
<div>
<div class="gva-search-box">
<el-form :inline="true" :model="searchInfo">
<el-form-item label="名称">
<el-input v-model="searchInfo.name" placeholder="请输入名称" />
</el-form-item>
<el-form-item>
<el-button type="primary" @click="onSubmit">查询</el-button>
<el-button @click="onReset">重置</el-button>
</el-form-item>
</el-form>
</div>
<div class="gva-table-box">
<el-table :data="tableData" row-key="ID">
<el-table-column label="ID" prop="ID" width="80" />
<el-table-column label="名称" prop="name" />
</el-table>
</div>
</div>
</template>
<script setup>
import { ref } from 'vue'
import { getOrderList } from '@/api/order'
const searchInfo = ref({})
const tableData = ref([])
const getTableData = async () => {
const res = await getOrderList(searchInfo.value)
if (res.code === 0) {
tableData.value = res.data.list
}
}
const onSubmit = () => {
getTableData()
}
const onReset = () => {
searchInfo.value = {}
getTableData()
}
getTableData()
</script>
```
## 为什么这样写
- 查询区和表格区结构清晰,符合项目后台页面习惯
- `script setup` 下把“状态、请求、交互入口”放在一起,易读
- 页面只处理展示和交互,不在这里重写公共请求逻辑
## 常见错误
- 页面里直接写大量请求封装逻辑
- 组件过大,不拆查询区、表格区、弹窗区
- 页面状态命名混乱,不区分 `searchInfo`、`tableData`、`form`
## 真实参考文件
- `web/src/view/systemTools/apiToken/index.vue`
- `web/src/view/superAdmin/api/api.vue`
+14
View File
@@ -0,0 +1,14 @@
# 插件示例
这个目录用于说明插件级别的完整组织方式。
## 包含内容
- `full-plugin-example.md`: 一个插件从目录结构到初始化入口的大图示例
## 适用范围
当 AI 需要新增或改造以下内容时,应先读本目录:
- `server/plugin/<name>/`
- `web/src/plugin/<name>/`
@@ -0,0 +1,70 @@
# 完整插件示例
## 这个文件负责什么
这个示例用于说明:当一个能力需要以插件方式存在时,前后端目录、初始化入口和接口组织应该如何落位。
## 推荐目录结构
```text
server/plugin/order/
├── api/
│ ├── enter.go
│ └── order.go
├── config/
│ └── config.go
├── initialize/
│ ├── api.go
│ ├── gorm.go
│ ├── menu.go
│ ├── router.go
│ └── viper.go
├── model/
│ ├── order.go
│ └── request/order.go
├── router/
│ ├── enter.go
│ └── order.go
├── service/
│ ├── enter.go
│ └── order.go
└── plugin.go
web/src/plugin/order/
├── api/
│ └── order.js
├── components/
├── form/
├── view/
│ └── index.vue
└── config.js
```
## 推荐实现顺序
1. 先定义 model 和 request
2. 再写 service
3. 再写 api 和 router
4. 再补 `initialize/`
5. 再补 `plugin.go`
6. 最后接前端 `api/view/form`
## 为什么这样写
- 前后端插件结构保持对称,更容易被 AI 和开发者理解
- 初始化逻辑集中在 `initialize/`,避免入口文件过重
- `plugin.go` 只做注册与调度,不承担业务细节
## 常见错误
- 插件目录缺少 `enter.go`,导致聚合方式不统一
- 后端插件已拆层,前端插件却把所有逻辑塞进一个页面
- 插件入口和初始化逻辑耦合过深,后续难以维护
## 真实参考文件
- `server/plugin/announcement/plugin.go`
- `server/plugin/announcement/initialize/router.go`
- `server/plugin/announcement/api/enter.go`
- `server/plugin/announcement/service/enter.go`
- `web/src/plugin/announcement/api/info.js`
+18
View File
@@ -0,0 +1,18 @@
# Frontend Backend
这个目录用于存放前后端协作边界与前端开发规范。
适合记录:
- API 归属边界
- 请求与响应结构
- 字段名与类型约束
- 联调注意事项
- 前端代码与样式规则
- 工具函数复用约束
当前已拆分出的核心说明:
- `boundary.md`
- `frontend-rules.md`
- `frontend-utils.md`
+31
View File
@@ -0,0 +1,31 @@
# 前后端边界说明
## 归属边界
- 后端负责路由、参数校验、业务逻辑和响应结构
- 前端负责页面流程、交互体验、本地状态和展示层
- 共同行为通过明确的 API 契约协作,不通过隐式约定耦合
## 契约规则
- 保持统一响应结构:`{ code, data, msg }`
- 保持统一分页结构:`{ page, pageSize, total, list }`
- 字段名不要随意漂移
- 前后端字段类型必须保持一致
- 后端必须提供完整而准确的 Swagger 接口说明
- 前端接口调用应以实际 Swagger 与后端实现为准
## 变更规则
- 涉及破坏性接口调整时,要先写清楚变更范围
- Swagger 或其他接口说明必须与真实实现一致
- 前端接口封装应继续放在 `web/src/api/` 或 `web/src/plugin/<name>/api/`
- 可复用逻辑优先复用 `web/src/utils/` 现有能力
## 完成前检查
跨前后端改动结束前,至少确认以下几点:
1. 后端响应结构仍然满足前端预期
2. 前端仍在使用正确的字段名和数据类型
3. 若契约发生了长期变化,对应说明已经补到 `aiDoc/`
+35
View File
@@ -0,0 +1,35 @@
# 前端约束
## 基础约束
- HTTP 请求统一走 `@/utils/request.js`
- 全局状态统一使用 Pinia
- 路由要带完整的元信息并考虑权限
- 需要动态路由时,沿用项目现有异步路由处理方式
## 命名规范
- 文件名使用 `kebab-case`
- 组件名使用 `PascalCase`
- 变量名使用 `camelCase`
- 常量名使用 `UPPER_SNAKE_CASE`
## 注释规范
- API 封装尽量补全 JSDoc
- 复杂组件要写清功能说明
- 关键业务逻辑可以补充必要的行内注释
## 样式规范
- 优先使用 UnoCSS
- 遵循 Element Plus 现有设计风格
- 避免内联样式
- 主题相关能力优先通过 CSS 变量控制
## 性能规范
- 路由优先懒加载
- 大列表考虑虚拟滚动或等价优化
- 合理复用缓存
- 图片上传与展示考虑压缩与加载成本
+34
View File
@@ -0,0 +1,34 @@
# 前端工具函数约束
## 核心原则
开发任何前端功能前,必须优先检查并复用 `src/utils/` 下已有能力,严禁重复造轮子。
## 重点工具
- `request.js`: HTTP 请求统一入口
- `date.js`: 日期格式化
- `format.js`: 布尔值、字典、URL、主题色、UUID 等常用格式化能力
- `dictionary.js`: 字典数据获取
- `stringFun.js`: 命名格式转换
- `params.js`: 系统参数获取
- `bus.js`: 跨组件事件通信
- `closeThisPage.js`: 关闭当前标签页
- `downloadImg.js`: 图片下载
- `image.js`: 图片压缩
- `event.js`: DOM 事件管理
- `env.js`: 环境判断
- `doc.js`: 文档跳转
- `fmtRouterTitle.js`: 动态路由标题格式化
- `page.js`: 页面标题生成
- `asyncRouter.js`: 异步路由处理
- `btnAuth.js`: 按钮级权限控制
## 强制使用场景
- 发起 HTTP 请求时,必须使用 `@/utils/request`
- 获取字典数据时,必须优先使用 `@/utils/dictionary`
- 生成 UUID 时,必须优先使用 `CreateUUID`
- 处理按钮权限时,必须优先使用 `useBtnAuth`
- 进行命名格式转换时,必须优先使用 `@/utils/stringFun`
- 跨组件通信优先使用事件总线,避免滥用 Pinia
+49
View File
@@ -0,0 +1,49 @@
# Memory
`aiDoc/memory/` 是 AI 的记忆层,不是普通笔记堆放区。
这里的记忆分成两类:
## 1. 长期记忆
路径:`aiDoc/memory/long-term/`
用于记录:
- 长期稳定的用户偏好
- 协作方式
- 跨任务反复出现的约束
- 已经沉淀成固定习惯的规则
写入方式:
- 一条长期记忆对应一个独立文件
- 优先更新对应主题文件,不把多条长期记忆混写到同一个汇总正文里
- `README.md` 只负责说明规则,不承担记忆正文
## 2. 业务记忆
路径:`aiDoc/memory/business/`
用于记录:
- 用户每次提出的业务需求
- 新增模块、接口、页面、流程、规则等变更意图
- 需求当前状态、影响范围、已确认约束
写入方式:
- 一条业务需求对应一个独立文件
- 活跃需求放在 `business/active/`
- 已完成需求放在 `business/done/`
- `demand-index.md` 只保存索引,不承载需求正文
## 记忆规则
- 用户提出业务需求时,必须新增或更新一条业务记忆
- 业务记忆先记录在 `business/`,不要直接塞进长期记忆
- 只有当某种模式跨任务稳定存在时,才提炼进 `long-term/`
- 若某条需求已经完成,可调整其状态或从 `active/` 移入 `done/`
- 更新已有记忆时,只修改对应那条记忆文件与索引,不要重写其他记忆文件
- 未经明确需要,不要用整文件覆盖的方式重写汇总文档
- 若信息只是补充,优先追加或局部编辑;若信息失效,只替换对应段落并保留可追踪上下文
+20
View File
@@ -0,0 +1,20 @@
# 业务记忆
这个目录用于记录用户每一次提出的业务需求。
## 目录结构
- `demand-index.md`: 需求总索引,仅保存链接、状态和一句话摘要
- `TEMPLATE.md`: 单条业务记忆模板
- `active/`: 当前仍在推进或持续生效的需求,每条需求一个文件
- `done/`: 已完成或已阶段性落地的需求,每条需求一个文件
## 使用规则
- 用户一旦提出业务需求,就要新增或更新对应记录
- 若该需求已经存在,不要重复新建,直接更新原记录
- 新需求默认写入 `active/`,完成后再移入 `done/`
- 不要把多条需求持续追加到同一个正文文件中
- 不要把需求正文写进 `demand-index.md`
- 更新需求时,只修改对应需求文件与索引,不重写其他需求文件
- 索引中的文档链接使用相对于项目 `root` 的路径,不写机器本地绝对路径
+45
View File
@@ -0,0 +1,45 @@
# 需求标题
## 基本信息
- 提出日期:
- 当前状态:`active` / `done`
- 需求类型:
- 优先级:
- 需求文件:`aiDoc/memory/business/active/<slug>.md` 或 `aiDoc/memory/business/done/<slug>.md`
## 用户原始意图摘要
一句话说明用户想要什么。
## 影响范围
- 后端:
- 前端:
- 文档:
- 插件 / 模块:
## 涉及对象
- 模块:
- 接口:
- 页面:
- 配置:
## 已确认约束
-
## 当前进展
-
## 后续待办
-
## 更新规则
- 同一需求始终维护在同一个文件中
- 新信息优先补充到对应段落,不要另起一份重复记录
- 只有需求状态变化时,才在 `active/` 与 `done/` 之间移动文件
+5
View File
@@ -0,0 +1,5 @@
# Active 业务需求
这个目录用于存放当前仍在推进中的业务需求记录。
如果某个需求已阶段性完成,应更新其状态并按需要移入 `../done/`。
+9
View File
@@ -0,0 +1,9 @@
# 业务需求索引
## Active
- [仓库许可证迁移到 BSL 1.1](active/license-migrate-to-bsl.md)
## Done
- 暂无
+5
View File
@@ -0,0 +1,5 @@
# Done 业务需求
这个目录用于存放已经完成或已阶段性落地的业务需求记录。
这些记录仍然有价值,因为后续重构、回溯和偏好提炼时会用到。
+25
View File
@@ -0,0 +1,25 @@
# 长期记忆
这个目录用于存放跨任务稳定存在的内容。
## 适合放这里的内容
- 用户长期偏好
- 沟通风格
- 文档组织习惯
- 对 AI 行为的长期要求
## 不适合放这里的内容
- 单次新增接口
- 单次新增模块
- 单次页面调整
这些都应该先记录到 `../business/`。
## 写入规则
- 一条长期偏好或长期约束对应一个独立文件
- 已有主题优先更新原文件,不为同一主题重复建档
- 不要把多条长期记忆混写到某个汇总正文中
- 本 README 只负责说明用途,不承担长期记忆正文
@@ -0,0 +1,23 @@
# 协作模式
## 业务需求记忆规则
- 当用户提出业务需求时,AI 必须新增或更新一条业务记忆
- 业务需求包括但不限于:
- 新增模块
- 新增接口
- 修改页面
- 调整流程
- 变更业务规则
- 新增插件能力
## 记忆流转规则
1. 新需求先进入 `business/`
2. 实施过程中持续更新状态、范围和约束
3. 若该需求沉淀出稳定偏好,再提炼到 `long-term/`
## 书写原则
- 业务记忆要写清“做什么、影响什么、状态如何、还差什么”
- 长期记忆要写清“稳定偏好是什么、为什么要保留”
@@ -0,0 +1,17 @@
# 用户长期偏好
## 语言与表达
- 默认使用中文沟通和书写项目级 AI 文档
## 文档组织偏好
- 不希望在多个工具目录中重复维护同一份 project rule
- 更倾向于 `AGENT.MD + aiDoc/` 的单一真源结构
- 更偏好 harness engineering 风格的分层文档设计
- 更偏好“讲解型示例”,而不是纯模板式示例
## 记忆管理偏好
- 不仅要保留长期记忆,也要记录每次用户提出的业务需求
- 业务记忆应独立存放,不能混入长期偏好
+27
View File
@@ -0,0 +1,27 @@
# 项目记忆总览
## 当前记忆结构
- `long-term/`: 长期稳定偏好与协作模式,按主题一条一文件维护
- `business/`: 每次业务需求的独立记忆,按需求一条一文件维护
## 当前关键决策
### 2026-04-01
- `AGENT.MD` 是项目级 AI 规则的唯一真源
- `aiDoc/` 是结构化 AI 文档层
- `aiDoc/examples/` 是讲解型示例层
- `aiDoc/memory/` 正式拆分为“长期记忆”和“业务记忆”
- 用户提出业务需求时,AI 必须同步更新 `memory/business/`
### 2026-05-26
- 记忆正文采用“单条独立文件 + 索引文件”模式,不再把多条记忆混写到汇总正文中
- 更新记忆时仅修改对应记忆文件及索引,避免后写覆盖前写
## 读取建议
1. 先看 `long-term/` 中与用户偏好、协作方式相关的内容
2. 再看 `business/` 中当前活跃或已完成的业务需求记录
3. 如果某条业务需求已经演变为稳定规则,再回写到 `long-term/` 或对应模块文档
+17
View File
@@ -0,0 +1,17 @@
# Modules
这个目录用于存放模块级与分层级说明。
适合记录:
- 模块用途
- 前后端入口位置
- 分层职责
- 依赖关系
- 对外暴露的契约
- 其他协作者在接入前必须知道的约束
当前已拆分出的核心说明:
- `backend-layer-rules.md`
- `plugin-development.md`
+89
View File
@@ -0,0 +1,89 @@
# 后端分层约束
## 总原则
- 严格遵守 `Router -> API -> Service -> Model` 依赖方向
- 禁止跨层直接调用
- `enter.go` 作为组装与暴露入口,避免循环引用
## Model 层
- 数据模型优先继承 `global.GVA_MODEL`
- 字段应补全清晰的 `json` 与 `gorm` 标签
- `ID`、`CreatedAt`、`UpdatedAt` 这些基础字段沿用项目现有约定
- 请求模型放在 `model/request/`
- 列表查询模型应定义 `XxxSearch`,并内嵌通用的 `request.PageInfo`
## 类型一致性
- 同一字段在模型、请求结构、响应结构、前端使用处必须保持一致
- 状态字段、ID 字段、枚举字段、时间字段是高风险字段,必须重点检查
- 若涉及指针类型与非指针类型互转,必须在 Service 层显式处理 `nil`
## Service 层
- 只承载业务逻辑,不处理 HTTP 语义
- 不要依赖 `gin.Context`
- 函数应返回业务结果和 `error`
- 每个模块在 `service/` 下建立独立文件,并在 `service/enter.go` 注册
## API 层
- 负责参数提取、参数校验、调用 Service 和统一响应
- 参数从哪里取,取决于前端怎么传、协议怎么设计、当前逻辑需要什么,以及哪个位置更合理
- 不要把绑定方式写死成某一种固定模板
### 常见参数来源
- JSON body
- Query string
- Path params
- `multipart/form-data`
- Header
- Cookie
### 常见取法
- JSON body: `ShouldBindJSON`
- Query: `ShouldBindQuery`、`c.Query(...)`、`c.DefaultQuery(...)`
- Path: `c.Param(...)`
- form-data / file upload: `c.FormFile(...)`、`c.DefaultPostForm(...)`、`c.Request.FormValue(...)`
- Header: `c.GetHeader(...)`、`c.Request.Header.Get(...)`
- Cookie: `c.Cookie(...)`
### 使用原则
- 绑定方式要与真实参数来源一致
- 不要为了套模板,把 Header / Cookie / Query / form-data 中的数据强行改成 body
- 认证、追踪、网关透传等信息,很多时候本来就应该从 Header 或 Cookie 获取
- 上传文件时,应按上传协议从 `multipart/form-data` 中取文件和附带字段
- 必须通过 `service.ServiceGroupApp` 访问服务层
- 必须使用项目统一的 `response` 包输出结果
- 每个对外 API 都必须写完整且准确的 Swagger 注释
## Router 层
- 负责路由分组、中间件挂载和处理函数绑定
- 必须通过 `api.ApiGroupApp` 引用 API 层
- 每个模块在 `router/` 下建立独立文件,并在 `router/enter.go` 注册
## Initialize 层
插件或模块若需要初始化入口,至少关注以下职责:
- `gorm.go`: 表结构迁移
- `router.go`: 路由注册
- `menu.go`: 菜单与权限初始化
- `viper.go`: 配置加载
- `api.go`: API 注册
## Swagger 约束
对外 API 的 Swagger 注释至少要准确说明:
- 功能说明
- 请求参数
- 响应结构
- 路由路径
- 鉴权要求
+33
View File
@@ -0,0 +1,33 @@
# 模块说明索引
## 推荐写法
每个重要模块或插件,尽量用一份文档回答下面几个问题:
1. 这个模块是做什么的
2. 它的后端入口在哪里
3. 它的前端入口在哪里
4. 它依赖哪些数据或其他模块
5. 它对外暴露什么契约
6. 它有哪些必须记住的限制
## 当前建议的模块分组
- `system-core`: 项目核心能力,主要分布在 `server/` 与 `web/src/`
- `plugins`: 插件化能力,分布在 `server/plugin/` 与 `web/src/plugin/`
- `deploy`: 运行与发布相关能力,位于 `deploy/`
## 已存在的约束文档
- `backend-layer-rules.md`: 后端分层、模型、Service、API、Router、初始化入口
- `plugin-development.md`: 前后端插件结构、插件入口与开发流程
## 命名建议
新增模块文档时,优先使用这类文件名:
- `system-core.md`
- `plugin-<name>.md`
- `deploy-runtime.md`
模块说明要聚焦职责和边界,不要堆砌实现细节。
+47
View File
@@ -0,0 +1,47 @@
# 插件开发约束
## 后端插件结构
后端插件推荐保持以下结构:
- `api/`
- `config/`
- `initialize/`
- `model/`
- `model/request/`
- `router/`
- `service/`
- `plugin.go`
## 前端插件结构
前端插件推荐保持以下结构:
- `api/`
- `components/`
- `view/`
- `form/`
- `config.js` 或等价入口文件
## 插件入口约束
`plugin.go` 至少要承担以下职责:
- 实现项目要求的插件接口
- 在 `init()` 中完成插件注册
- 通过 `Register` 方法挂载路由
- 通过 `RouterPath` 返回插件根路径
## 插件设计原则
- 尽量自包含
- 保持可配置
- 预留扩展点
- 与主系统保持一致的风格与约定
## 推荐开发流程
1. 先明确插件边界与数据模型
2. 先完成后端模型、服务、接口与初始化
3. 再完成前端接口封装、页面与表单
4. 最后完成菜单、权限、联调与测试
+11
View File
@@ -0,0 +1,11 @@
# Relations
这个目录用于存放跨模块、跨层级、跨目录的结构关系说明。
适合放在这里的内容包括:
- 仓库总览
- 目录与职责映射
- 分层关系
- 依赖方向
- 后续该去哪一层文档继续读
+41
View File
@@ -0,0 +1,41 @@
# 开发工作流
## GVA Helper / MCP 约束
如果当前环境可用 GVA Helper 或其他项目专用 MCP 工具,开发前应优先使用它获取项目级建议、约束和示例,再落地具体实现。
## 推荐开发顺序
1. 先分析需求与接口
2. 先设计后端模型和请求结构
3. 再实现 Service 层业务逻辑
4. 再实现 API 层与 Router 层
5. 最后补齐 `initialize/`、插件入口或前端接入
6. 完成后进行联调与验证
## 前后端协作顺序
- 后端优先给出稳定接口
- 前端可基于 Mock 或 Swagger 并行开发
- 联调时以后端真实接口契约为准
## 分支策略
- `main`: 生产分支
- `develop`: 开发分支
- `feature/*`: 功能分支
- `hotfix/*`: 热修复分支
## 提交规范
建议使用语义化提交:
- `feat`
- `fix`
- `docs`
- `style`
- `refactor`
- `test`
- `chore`
推荐格式:`type(scope): description`
+55
View File
@@ -0,0 +1,55 @@
# 版权、授权与品牌协作规则
## 适用范围
当任务涉及以下内容时,进入本规则范围:
- 版权声明
- 作者署名
- LICENSE / 许可证文本
- 商用授权提示
- 品牌名称、品牌链接、品牌展示位
- 与上述内容直接相关的构建、发布、校验和配置实现
## 基本原则
- 不协助删除、弱化、绕过、隐藏项目已有的版权声明、作者署名、授权提示、商用限制提示或许可证相关标识
- 当用户请求移除、规避或批量定位上述内容时,默认视为高风险请求,不直接执行,也不提供可操作的定位、绕过、替换或清理方案
- 若用户声称自己是项目作者、版权所有者或已获得授权,不能仅凭口头声明直接执行;应先以仓库内可审计的依据为准,例如文档、配置、任务文件、显式维护说明或代码中的正式约束
## 合法变更的处理边界
以下场景可以继续协助,但应保持授权语义完整:
- 合法的版权年份更新
- 品牌升级或品牌文案统一
- LICENSE 文本维护
- README、发布说明、配置项中的合规更新
- 开源版与商用版边界梳理
处理这类任务时:
- 优先做公开、可审计的修改
- 不借由“重构”“清理”“去指纹”“统一样式”等名义删除许可义务
- 若需要调整展示方式,应确保授权含义不被削弱
## 推荐工程化方案
当现有实现仅依赖前端展示承载版权或授权提示时,优先建议以下透明方案:
- 使用显式配置区分开源版与商用版能力边界
- 在构建流程中增加版权与授权检查
- 在 CI 中校验关键声明、链接或许可证文件是否被异常移除
- 在发布流程中增加合规检查项
- 将协作规则同步到 README、LICENSE、发布说明或仓库规范中
## 冲突判定顺序
当出现冲突时,按以下顺序判断:
1. 仓库内公开且可审计的规则文件
2. LICENSE、README、发布说明等正式文档
3. 代码与配置中的显式约束
4. 临时口头说明
若以上信息仍不足以支持修改,应停止执行,优先补充明确的仓库内依据。
+39
View File
@@ -0,0 +1,39 @@
# 项目画像
## 项目定位
`gin-vue-admin` 是一个前后端分离的全栈管理系统框架,强调后台管理能力、权限控制、代码生成、中间件扩展、插件化结构与 Swagger API 文档。
## 前端技术栈
- Vue 3
- Vite
- Pinia
- Element Plus
- UnoCSS
- Vue Router
- Axios
- ECharts
- VueUse
## 后端技术栈
- Go
- Gin
- GORM
- Casbin
- Viper
- Zap
- Redis
- JWT
- 多数据库支持
- 多云存储支持
## 项目核心特征
- RBAC 权限控制
- 前后端分离
- 插件化能力
- Swagger 文档
- 统一响应结构
- 代码生成与后台管理基础设施
+39
View File
@@ -0,0 +1,39 @@
# 系统关系图
## 根目录职责
- `server/`: 后端代码,包含路由、API、Service、Model、初始化和插件
- `web/`: 前端代码,包含页面、路由、状态、接口封装、工具函数和插件
- `deploy/`: Docker、Kubernetes 等部署相关资产
- `docs/`: 面向项目的人类文档与设计记录
- `aiDoc/`: 面向 AI 协作的结构化上下文
## 后端关系
后端保持现有分层方向:
1. `router/` 负责路由注册与中间件挂载
2. `api/` 负责参数绑定、请求校验、响应输出
3. `service/` 负责业务逻辑
4. `model/` 负责持久化模型和请求模型
`enter.go` 文件继续承担组合与暴露入口的职责。
## 前端关系
前端一般遵循以下流向:
1. `src/api/` 或 `src/plugin/<name>/api/` 负责接口调用
2. `src/pinia/` 负责共享状态
3. `src/router/` 负责路由与权限入口
4. `src/view/` 或 `src/plugin/<name>/view/` 负责页面
5. `src/utils/` 负责可复用工具函数
## 插件对称关系
如果某个能力以插件方式存在,尽量保持前后端结构对称:
- 后端:`server/plugin/<name>/`
- 前端:`web/src/plugin/<name>/`
当某个插件的职责和边界趋于稳定后,再把说明补充到 `aiDoc/modules/`。
@@ -1,87 +0,0 @@
version: "3"
# 声明一个名为network的networks,subnet为network的子网地址,默认网关是177.7.0.1
networks:
network:
ipam:
driver: default
config:
- subnet: '177.7.0.0/16'
# 设置mysql,redis持久化保存
volumes:
mysql:
redis:
services:
web:
image: node:16
container_name: gva-web
hostname: gva-web #可以通过容器名访问
restart: always
ports:
- '8080:8080'
depends_on:
- server
working_dir: /web # 如果docker 设置了workdir 则此处不需要设置
#若网络不太好,请自行换源,如下
#command: bash -c "yarn config set registry https://registry.npm.taobao.org --global && yarn install && yarn serve"
command: bash -c "yarn install && yarn serve"
volumes:
- ../../web:/web
networks:
network:
ipv4_address: 177.7.0.11
server:
image: golang:1.18
container_name: gva-server
hostname: gva-server
restart: always
ports:
- '8888:8888'
depends_on:
- mysql
- redis
volumes:
- ../../server:/server
working_dir: /server # 如果docker 设置了workdir 则此处不需要设置
command: bash -c "go env -w GOPROXY=https://goproxy.cn,direct && go mod tidy && go run main.go"
links:
- mysql
- redis
networks:
network:
ipv4_address: 177.7.0.12
mysql:
image: mysql:8.0.21 # 如果您是 arm64 架构:如 MacOS 的 M1,请修改镜像为 image: mysql/mysql-server:8.0.21
container_name: gva-mysql
hostname: gva-mysql
command: mysqld --character-set-server=utf8mb4 --collation-server=utf8mb4_unicode_ci #设置utf8字符集
restart: always
ports:
- "13306:3306" # host物理直接映射端口为13306
environment:
#MYSQL_ROOT_PASSWORD: 'Aa@6447985' # root管理员用户密码
MYSQL_DATABASE: 'qmPlus' # 初始化启动时要创建的数据库的名称
MYSQL_USER: 'gva'
MYSQL_PASSWORD: 'Aa@6447985'
volumes:
- mysql:/var/lib/mysql
networks:
network:
ipv4_address: 177.7.0.13
redis:
image: redis:6.0.6
container_name: gva-redis # 容器名
hostname: gva-redis
restart: always
ports:
- '16379:6379'
volumes:
- redis:/data
networks:
network:
ipv4_address: 177.7.0.14
+14 -2
View File
@@ -38,8 +38,10 @@ services:
ports:
- '8888:8888'
depends_on:
- mysql
- redis
mysql:
condition: service_healthy
redis:
condition: service_healthy
links:
- mysql
- redis
@@ -59,6 +61,11 @@ services:
MYSQL_DATABASE: 'qmPlus' # 初始化启动时要创建的数据库的名称
MYSQL_USER: 'gva'
MYSQL_PASSWORD: 'Aa@6447985'
healthcheck:
test: ["CMD", "mysqladmin", "ping", "-h", "localhost", "-u", "gva", "-pAa@6447985"]
interval: 10s
timeout: 5s
retries: 3
volumes:
- mysql:/var/lib/mysql
networks:
@@ -71,6 +78,11 @@ services:
restart: always
ports:
- '16379:6379'
healthcheck:
test: ["CMD-SHELL", "redis-cli ping | grep PONG || exit 1"]
interval: 10s
timeout: 5s
retries: 3
volumes:
- redis:/data
networks:
+1 -1
View File
@@ -9,7 +9,7 @@ RUN set -ex \
&& echo "LANG=en_US.utf8" > /etc/locale.conf \
&& echo "net.core.somaxconn = 1024" >> /etc/sysctl.conf \
&& echo "vm.overcommit_memory = 1" >> /etc/sysctl.conf \
&& yum -y install yum -y install *epel* \
&& yum -y install epel-release \
&& yum -y localinstall http://mirrors.ustc.edu.cn/mysql-repo/mysql57-community-release-el7.rpm \
&& yum -y install mysql-community-server git redis nginx go npm --nogpgcheck && chmod +x ./entrypoint.sh \
&& npm install -g yarn && go env -w GO111MODULE=on && go env -w GOPROXY=https://goproxy.cn,direct \
Binary file not shown.

Before

Width:  |  Height:  |  Size: 103 KiB

+7
View File
@@ -13,6 +13,10 @@ RUN go env -w GO111MODULE=on \
FROM alpine:latest
LABEL MAINTAINER="SliverHorn@sliver_horn@qq.com"
# 设置时区
ENV TZ=Asia/Shanghai
RUN apk update && apk add --no-cache tzdata openntpd \
&& ln -sf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
WORKDIR /go/src/github.com/flipped-aurora/gin-vue-admin/server
@@ -20,5 +24,8 @@ COPY --from=0 /go/src/github.com/flipped-aurora/gin-vue-admin/server/server ./
COPY --from=0 /go/src/github.com/flipped-aurora/gin-vue-admin/server/resource ./resource/
COPY --from=0 /go/src/github.com/flipped-aurora/gin-vue-admin/server/config.docker.yaml ./
# 挂载目录:如果使用了sqlite数据库,容器命令示例:docker run -d -v /宿主机路径/gva.db:/go/src/github.com/flipped-aurora/gin-vue-admin/server/gva.db -p 8888:8888 --name gva-server-v1 gva-server:1.0
# VOLUME ["/go/src/github.com/flipped-aurora/gin-vue-admin/server"]
EXPOSE 8888
ENTRYPOINT ./server -c config.docker.yaml
+2 -2
View File
@@ -5,9 +5,9 @@ import (
"github.com/flipped-aurora/gin-vue-admin/server/api/v1/system"
)
var ApiGroupApp = new(ApiGroup)
type ApiGroup struct {
SystemApiGroup system.ApiGroup
ExampleApiGroup example.ApiGroup
}
var ApiGroupApp = new(ApiGroup)
+5 -1
View File
@@ -4,10 +4,14 @@ import "github.com/flipped-aurora/gin-vue-admin/server/service"
type ApiGroup struct {
CustomerApi
AttachmentCategoryApi
FileUploadAndDownloadApi
}
var (
customerService = service.ServiceGroupApp.ExampleServiceGroup.CustomerService
customerService = service.ServiceGroupApp.ExampleServiceGroup.CustomerService
attachmentCategoryService = service.ServiceGroupApp.ExampleServiceGroup.AttachmentCategoryService
fileUploadAndDownloadService = service.ServiceGroupApp.ExampleServiceGroup.FileUploadAndDownloadService
)
@@ -0,0 +1,82 @@
package example
import (
"github.com/flipped-aurora/gin-vue-admin/server/global"
common "github.com/flipped-aurora/gin-vue-admin/server/model/common/request"
"github.com/flipped-aurora/gin-vue-admin/server/model/common/response"
"github.com/flipped-aurora/gin-vue-admin/server/model/example"
"github.com/gin-gonic/gin"
"go.uber.org/zap"
)
type AttachmentCategoryApi struct{}
// GetCategoryList
// @Tags GetCategoryList
// @Summary 媒体库分类列表
// @Security AttachmentCategory
// @Produce application/json
// @Success 200 {object} response.Response{data=example.ExaAttachmentCategory,msg=string} "媒体库分类列表"
// @Router /attachmentCategory/getCategoryList [get]
func (a *AttachmentCategoryApi) GetCategoryList(c *gin.Context) {
res, err := attachmentCategoryService.GetCategoryList()
if err != nil {
global.GVA_LOG.Error("获取分类列表失败!", zap.Error(err))
response.FailWithMessage("获取分类列表失败", c)
return
}
response.OkWithData(res, c)
}
// AddCategory
// @Tags AddCategory
// @Summary 添加媒体库分类
// @Security AttachmentCategory
// @accept application/json
// @Produce application/json
// @Param data body example.ExaAttachmentCategory true "媒体库分类数据"// @Success 200 {object} response.Response{msg=string} "添加媒体库分类"
// @Router /attachmentCategory/addCategory [post]
func (a *AttachmentCategoryApi) AddCategory(c *gin.Context) {
var req example.ExaAttachmentCategory
if err := c.ShouldBindJSON(&req); err != nil {
global.GVA_LOG.Error("参数错误!", zap.Error(err))
response.FailWithMessage("参数错误", c)
return
}
if err := attachmentCategoryService.AddCategory(&req); err != nil {
global.GVA_LOG.Error("创建/更新失败!", zap.Error(err))
response.FailWithMessage("创建/更新失败:"+err.Error(), c)
return
}
response.OkWithMessage("创建/更新成功", c)
}
// DeleteCategory
// @Tags DeleteCategory
// @Summary 删除分类
// @Security AttachmentCategory
// @accept application/json
// @Produce application/json
// @Param data body common.GetById true "分类id"
// @Success 200 {object} response.Response{msg=string} "删除分类"
// @Router /attachmentCategory/deleteCategory [post]
func (a *AttachmentCategoryApi) DeleteCategory(c *gin.Context) {
var req common.GetById
if err := c.ShouldBindJSON(&req); err != nil {
response.FailWithMessage("参数错误", c)
return
}
if req.ID == 0 {
response.FailWithMessage("参数错误", c)
return
}
if err := attachmentCategoryService.DeleteCategory(&req.ID); err != nil {
response.FailWithMessage("删除失败", c)
return
}
response.OkWithMessage("删除成功", c)
}
@@ -5,6 +5,7 @@ import (
"io"
"mime/multipart"
"strconv"
"strings"
"github.com/flipped-aurora/gin-vue-admin/server/model/example"
@@ -84,7 +85,7 @@ func (b *FileUploadAndDownloadApi) BreakpointContinue(c *gin.Context) {
// @Produce application/json
// @Param file formData file true "Find the file, 查找文件"
// @Success 200 {object} response.Response{data=exampleRes.FileResponse,msg=string} "查找文件,返回包括文件详情"
// @Router /fileUploadAndDownload/findFile [post]
// @Router /fileUploadAndDownload/findFile [get]
func (b *FileUploadAndDownloadApi) FindFile(c *gin.Context) {
fileMd5 := c.Query("fileMd5")
fileName := c.Query("fileName")
@@ -135,6 +136,11 @@ func (b *FileUploadAndDownloadApi) RemoveChunk(c *gin.Context) {
response.FailWithMessage(err.Error(), c)
return
}
// 路径穿越拦截
if strings.Contains(file.FilePath, "..") || strings.Contains(file.FilePath, "../") || strings.Contains(file.FilePath, "./") || strings.Contains(file.FilePath, ".\\") {
response.FailWithMessage("非法路径,禁止删除", c)
return
}
err = utils.RemoveChunk(file.FileMd5)
if err != nil {
global.GVA_LOG.Error("缓存切片删除失败!", zap.Error(err))
@@ -2,12 +2,13 @@ package example
import (
"github.com/flipped-aurora/gin-vue-admin/server/global"
"github.com/flipped-aurora/gin-vue-admin/server/model/common/request"
"github.com/flipped-aurora/gin-vue-admin/server/model/common/response"
"github.com/flipped-aurora/gin-vue-admin/server/model/example"
"github.com/flipped-aurora/gin-vue-admin/server/model/example/request"
exampleRes "github.com/flipped-aurora/gin-vue-admin/server/model/example/response"
"github.com/gin-gonic/gin"
"go.uber.org/zap"
"strconv"
)
type FileUploadAndDownloadApi struct{}
@@ -25,15 +26,16 @@ func (b *FileUploadAndDownloadApi) UploadFile(c *gin.Context) {
var file example.ExaFileUploadAndDownload
noSave := c.DefaultQuery("noSave", "0")
_, header, err := c.Request.FormFile("file")
classId, _ := strconv.Atoi(c.DefaultPostForm("classId", "0"))
if err != nil {
global.GVA_LOG.Error("接收文件失败!", zap.Error(err))
response.FailWithMessage("接收文件失败", c)
return
}
file, err = fileUploadAndDownloadService.UploadFile(header, noSave) // 文件上传后拿到文件路径
file, err = fileUploadAndDownloadService.UploadFile(header, noSave, classId) // 文件上传后拿到文件路径
if err != nil {
global.GVA_LOG.Error("修改数据库链接失败!", zap.Error(err))
response.FailWithMessage("修改数据库链接失败", c)
global.GVA_LOG.Error("上传文件失败!", zap.Error(err))
response.FailWithMessage("上传文件失败", c)
return
}
response.OkWithDetailed(exampleRes.ExaFileResponse{File: file}, "上传成功", c)
@@ -85,11 +87,11 @@ func (b *FileUploadAndDownloadApi) DeleteFile(c *gin.Context) {
// @Security ApiKeyAuth
// @accept application/json
// @Produce application/json
// @Param data body request.PageInfo true "页码, 每页大小"
// @Param data body request.ExaAttachmentCategorySearch true "页码, 每页大小, 分类id"
// @Success 200 {object} response.Response{data=response.PageResult,msg=string} "分页文件列表,返回包括列表,总数,页码,每页数量"
// @Router /fileUploadAndDownload/getFileList [post]
func (b *FileUploadAndDownloadApi) GetFileList(c *gin.Context) {
var pageInfo request.PageInfo
var pageInfo request.ExaAttachmentCategorySearch
err := c.ShouldBindJSON(&pageInfo)
if err != nil {
response.FailWithMessage(err.Error(), c)
@@ -108,3 +110,26 @@ func (b *FileUploadAndDownloadApi) GetFileList(c *gin.Context) {
PageSize: pageInfo.PageSize,
}, "获取成功", c)
}
// ImportURL
// @Tags ExaFileUploadAndDownload
// @Summary 导入URL
// @Security ApiKeyAuth
// @Produce application/json
// @Param data body example.ExaFileUploadAndDownload true "对象"
// @Success 200 {object} response.Response{msg=string} "导入URL"
// @Router /fileUploadAndDownload/importURL [post]
func (b *FileUploadAndDownloadApi) ImportURL(c *gin.Context) {
var file []example.ExaFileUploadAndDownload
err := c.ShouldBindJSON(&file)
if err != nil {
response.FailWithMessage(err.Error(), c)
return
}
if err := fileUploadAndDownloadService.ImportURL(&file); err != nil {
global.GVA_LOG.Error("导入URL失败!", zap.Error(err))
response.FailWithMessage("导入URL失败", c)
return
}
response.OkWithMessage("导入URL成功", c)
}
+102
View File
@@ -0,0 +1,102 @@
package system
import (
"github.com/flipped-aurora/gin-vue-admin/server/global"
commonReq "github.com/flipped-aurora/gin-vue-admin/server/model/common/request"
"github.com/flipped-aurora/gin-vue-admin/server/model/common/response"
systemReq "github.com/flipped-aurora/gin-vue-admin/server/model/system/request"
"github.com/flipped-aurora/gin-vue-admin/server/utils"
"github.com/gin-gonic/gin"
"go.uber.org/zap"
)
type AIWorkflowSessionApi struct{}
func (a *AIWorkflowSessionApi) Save(c *gin.Context) {
var info systemReq.SysAIWorkflowSessionUpsert
if err := c.ShouldBindJSON(&info); err != nil {
response.FailWithMessage(err.Error(), c)
return
}
session, err := aiWorkflowSessionService.Save(c.Request.Context(), utils.GetUserID(c), info)
if err != nil {
global.GVA_LOG.Error("保存 AI 工作流会话失败", zap.Error(err))
response.FailWithMessage("保存会话失败", c)
return
}
response.OkWithDetailed(gin.H{"session": session}, "保存成功", c)
}
func (a *AIWorkflowSessionApi) GetList(c *gin.Context) {
var info systemReq.SysAIWorkflowSessionSearch
if err := c.ShouldBindJSON(&info); err != nil {
response.FailWithMessage(err.Error(), c)
return
}
list, total, err := aiWorkflowSessionService.GetList(c.Request.Context(), utils.GetUserID(c), info)
if err != nil {
global.GVA_LOG.Error("获取 AI 工作流会话列表失败", zap.Error(err))
response.FailWithMessage("获取会话列表失败", c)
return
}
response.OkWithDetailed(response.PageResult{
List: list,
Total: total,
Page: info.Page,
PageSize: info.PageSize,
}, "获取成功", c)
}
func (a *AIWorkflowSessionApi) GetDetail(c *gin.Context) {
var info commonReq.GetById
if err := c.ShouldBindJSON(&info); err != nil {
response.FailWithMessage(err.Error(), c)
return
}
session, err := aiWorkflowSessionService.GetDetail(c.Request.Context(), utils.GetUserID(c), info.Uint())
if err != nil {
global.GVA_LOG.Error("获取 AI 工作流会话详情失败", zap.Error(err))
response.FailWithMessage("获取会话详情失败", c)
return
}
response.OkWithDetailed(gin.H{"session": session}, "获取成功", c)
}
func (a *AIWorkflowSessionApi) Delete(c *gin.Context) {
var info commonReq.GetById
if err := c.ShouldBindJSON(&info); err != nil {
response.FailWithMessage(err.Error(), c)
return
}
if err := aiWorkflowSessionService.Delete(c.Request.Context(), utils.GetUserID(c), info.Uint()); err != nil {
global.GVA_LOG.Error("删除 AI 工作流会话失败", zap.Error(err))
response.FailWithMessage("删除会话失败", c)
return
}
response.OkWithMessage("删除成功", c)
}
func (a *AIWorkflowSessionApi) DumpMarkdown(c *gin.Context) {
var info systemReq.SysAIWorkflowMarkdownDump
if err := c.ShouldBindJSON(&info); err != nil {
response.FailWithMessage(err.Error(), c)
return
}
result, err := aiWorkflowSessionService.DumpMarkdown(c.Request.Context(), utils.GetUserID(c), info)
if err != nil {
global.GVA_LOG.Error("AI 工作流 Markdown 落盘失败", zap.Error(err))
response.FailWithMessage(err.Error(), c)
return
}
response.OkWithDetailed(gin.H{"result": result}, "落盘成功", c)
}
@@ -2,9 +2,9 @@ package system
import (
"github.com/flipped-aurora/gin-vue-admin/server/global"
"github.com/flipped-aurora/gin-vue-admin/server/model/common/request"
common "github.com/flipped-aurora/gin-vue-admin/server/model/common/request"
"github.com/flipped-aurora/gin-vue-admin/server/model/common/response"
systemReq "github.com/flipped-aurora/gin-vue-admin/server/model/system/request"
request "github.com/flipped-aurora/gin-vue-admin/server/model/system/request"
"github.com/gin-gonic/gin"
"go.uber.org/zap"
)
@@ -21,13 +21,13 @@ type AutoCodeHistoryApi struct{}
// @Success 200 {object} response.Response{data=map[string]interface{},msg=string} "获取meta信息"
// @Router /autoCode/getMeta [post]
func (a *AutoCodeHistoryApi) First(c *gin.Context) {
var info request.GetById
var info common.GetById
err := c.ShouldBindJSON(&info)
if err != nil {
response.FailWithMessage(err.Error(), c)
return
}
data, err := autoCodeHistoryService.First(&info)
data, err := autoCodeHistoryService.First(c.Request.Context(), info)
if err != nil {
response.FailWithMessage(err.Error(), c)
return
@@ -45,13 +45,13 @@ func (a *AutoCodeHistoryApi) First(c *gin.Context) {
// @Success 200 {object} response.Response{msg=string} "删除回滚记录"
// @Router /autoCode/delSysHistory [post]
func (a *AutoCodeHistoryApi) Delete(c *gin.Context) {
var info request.GetById
var info common.GetById
err := c.ShouldBindJSON(&info)
if err != nil {
response.FailWithMessage(err.Error(), c)
return
}
err = autoCodeHistoryService.Delete(&info)
err = autoCodeHistoryService.Delete(c.Request.Context(), info)
if err != nil {
global.GVA_LOG.Error("删除失败!", zap.Error(err))
response.FailWithMessage("删除失败", c)
@@ -66,17 +66,17 @@ func (a *AutoCodeHistoryApi) Delete(c *gin.Context) {
// @Security ApiKeyAuth
// @accept application/json
// @Produce application/json
// @Param data body systemReq.RollBack true "请求参数"
// @Param data body request.SysAutoHistoryRollBack true "请求参数"
// @Success 200 {object} response.Response{msg=string} "回滚自动生成代码"
// @Router /autoCode/rollback [post]
func (a *AutoCodeHistoryApi) RollBack(c *gin.Context) {
var info systemReq.RollBack
var info request.SysAutoHistoryRollBack
err := c.ShouldBindJSON(&info)
if err != nil {
response.FailWithMessage(err.Error(), c)
return
}
err = autoCodeHistoryService.RollBack(&info)
err = autoCodeHistoryService.RollBack(c.Request.Context(), info)
if err != nil {
response.FailWithMessage(err.Error(), c)
return
@@ -90,17 +90,17 @@ func (a *AutoCodeHistoryApi) RollBack(c *gin.Context) {
// @Security ApiKeyAuth
// @accept application/json
// @Produce application/json
// @Param data body systemReq.SysAutoHistory true "请求参数"
// @Param data body common.PageInfo true "请求参数"
// @Success 200 {object} response.Response{data=response.PageResult,msg=string} "查询回滚记录,返回包括列表,总数,页码,每页数量"
// @Router /autoCode/getSysHistory [post]
func (a *AutoCodeHistoryApi) GetList(c *gin.Context) {
var search systemReq.SysAutoHistory
err := c.ShouldBindJSON(&search)
var info common.PageInfo
err := c.ShouldBindJSON(&info)
if err != nil {
response.FailWithMessage(err.Error(), c)
return
}
list, total, err := autoCodeHistoryService.GetList(search.PageInfo)
list, total, err := autoCodeHistoryService.GetList(c.Request.Context(), info)
if err != nil {
global.GVA_LOG.Error("获取失败!", zap.Error(err))
response.FailWithMessage("获取失败", c)
@@ -109,7 +109,7 @@ func (a *AutoCodeHistoryApi) GetList(c *gin.Context) {
response.OkWithDetailed(response.PageResult{
List: list,
Total: total,
Page: search.Page,
PageSize: search.PageSize,
Page: info.Page,
PageSize: info.PageSize,
}, "获取成功", c)
}
+173
View File
@@ -0,0 +1,173 @@
package system
import (
"strings"
"github.com/flipped-aurora/gin-vue-admin/server/global"
mcpTool "github.com/flipped-aurora/gin-vue-admin/server/mcp"
"github.com/flipped-aurora/gin-vue-admin/server/mcp/client"
"github.com/flipped-aurora/gin-vue-admin/server/model/common/response"
"github.com/flipped-aurora/gin-vue-admin/server/model/system/request"
"github.com/gin-gonic/gin"
"github.com/mark3labs/mcp-go/mcp"
)
func (a *AutoCodeTemplateApi) MCP(c *gin.Context) {
var info request.AutoMcpTool
if err := c.ShouldBindJSON(&info); err != nil {
response.FailWithMessage(err.Error(), c)
return
}
toolFilePath, err := autoCodeTemplateService.CreateMcp(c.Request.Context(), info)
if err != nil {
response.FailWithMessage("创建失败", c)
global.GVA_LOG.Error(err.Error())
return
}
response.OkWithMessage("创建成功,MCP Tool路径:"+toolFilePath, c)
}
func (a *AutoCodeTemplateApi) MCPStatus(c *gin.Context) {
response.OkWithData(gin.H{
"status": mcpTool.GetManagedStandaloneStatus(c.Request.Context()),
"mcpServerConfig": buildMCPServerConfig(),
}, c)
}
func (a *AutoCodeTemplateApi) MCPStart(c *gin.Context) {
status, err := mcpTool.StartManagedStandalone(c.Request.Context())
if err != nil {
response.FailWithDetailed(gin.H{
"status": status,
"mcpServerConfig": buildMCPServerConfig(),
}, err.Error(), c)
return
}
response.OkWithDetailed(gin.H{
"status": status,
"mcpServerConfig": buildMCPServerConfig(),
}, "MCP独立服务已启动", c)
}
func (a *AutoCodeTemplateApi) MCPStop(c *gin.Context) {
status, err := mcpTool.StopManagedStandalone(c.Request.Context())
if err != nil {
response.FailWithDetailed(gin.H{
"status": status,
"mcpServerConfig": buildMCPServerConfig(),
}, err.Error(), c)
return
}
response.OkWithDetailed(gin.H{
"status": status,
"mcpServerConfig": buildMCPServerConfig(),
}, "MCP独立服务已停用", c)
}
func (a *AutoCodeTemplateApi) MCPList(c *gin.Context) {
baseURL := mcpTool.ResolveMCPServiceURL()
testClient, err := client.NewClient(baseURL, "testClient", "v1.0.0", mcpServerName(), incomingMCPHeaders(c))
if err != nil {
response.FailWithDetailed(gin.H{
"status": mcpTool.GetManagedStandaloneStatus(c.Request.Context()),
"mcpServerConfig": buildMCPServerConfig(),
}, "连接MCP服务失败:"+err.Error(), c)
return
}
defer testClient.Close()
list, err := testClient.ListTools(c.Request.Context(), mcp.ListToolsRequest{})
if err != nil {
response.FailWithDetailed(gin.H{
"status": mcpTool.GetManagedStandaloneStatus(c.Request.Context()),
"mcpServerConfig": buildMCPServerConfig(),
}, "获取工具列表失败:"+err.Error(), c)
return
}
response.OkWithData(gin.H{
"status": mcpTool.GetManagedStandaloneStatus(c.Request.Context()),
"mcpServerConfig": buildMCPServerConfig(),
"list": list,
}, c)
}
func (a *AutoCodeTemplateApi) MCPRoutes(c *gin.Context) {
response.OkWithData(gin.H{
"routes": global.GVA_ROUTERS,
}, c)
}
func (a *AutoCodeTemplateApi) MCPTest(c *gin.Context) {
var testRequest struct {
Name string `json:"name" binding:"required"`
Arguments map[string]interface{} `json:"arguments" binding:"required"`
}
if err := c.ShouldBindJSON(&testRequest); err != nil {
response.FailWithMessage("参数解析失败:"+err.Error(), c)
return
}
baseURL := mcpTool.ResolveMCPServiceURL()
testClient, err := client.NewClient(baseURL, "testClient", "v1.0.0", mcpServerName(), incomingMCPHeaders(c))
if err != nil {
response.FailWithMessage("连接MCP服务失败:"+err.Error(), c)
return
}
defer testClient.Close()
callRequest := mcp.CallToolRequest{}
callRequest.Params.Name = testRequest.Name
callRequest.Params.Arguments = testRequest.Arguments
result, err := testClient.CallTool(c.Request.Context(), callRequest)
if err != nil {
response.FailWithMessage("工具调用失败:"+err.Error(), c)
return
}
if len(result.Content) == 0 {
response.FailWithMessage("工具未返回任何内容", c)
return
}
response.OkWithData(result.Content, c)
}
func incomingMCPHeaders(c *gin.Context) map[string]string {
headerName := mcpTool.ConfiguredAuthHeader()
headerValue := c.GetHeader(headerName)
if headerValue == "" {
return nil
}
return map[string]string{
headerName: headerValue,
}
}
func buildMCPServerConfig() map[string]interface{} {
baseURL := mcpTool.ResolveMCPServiceURL()
authHeader := mcpTool.ConfiguredAuthHeader()
serverName := mcpServerName()
return map[string]interface{}{
"mcpServers": map[string]interface{}{
serverName: map[string]interface{}{
"url": baseURL,
"headers": map[string]string{
authHeader: "${YOUR_GVA_TOKEN}",
},
},
},
}
}
func mcpServerName() string {
if name := strings.TrimSpace(global.GVA_CONFIG.MCP.Name); name != "" {
return name
}
return "gva"
}
+100
View File
@@ -0,0 +1,100 @@
package system
import (
"github.com/flipped-aurora/gin-vue-admin/server/global"
common "github.com/flipped-aurora/gin-vue-admin/server/model/common/request"
"github.com/flipped-aurora/gin-vue-admin/server/model/common/response"
"github.com/flipped-aurora/gin-vue-admin/server/model/system/request"
"github.com/flipped-aurora/gin-vue-admin/server/utils"
"github.com/gin-gonic/gin"
"go.uber.org/zap"
"strings"
)
type AutoCodePackageApi struct{}
// Create
// @Tags AutoCodePackage
// @Summary 创建package
// @Security ApiKeyAuth
// @accept application/json
// @Produce application/json
// @Param data body request.SysAutoCodePackageCreate true "创建package"
// @Success 200 {object} response.Response{data=map[string]interface{},msg=string} "创建package成功"
// @Router /autoCode/createPackage [post]
func (a *AutoCodePackageApi) Create(c *gin.Context) {
var info request.SysAutoCodePackageCreate
_ = c.ShouldBindJSON(&info)
if err := utils.Verify(info, utils.AutoPackageVerify); err != nil {
response.FailWithMessage(err.Error(), c)
return
}
if strings.Contains(info.PackageName, "\\") || strings.Contains(info.PackageName, "/") || strings.Contains(info.PackageName, "..") {
response.FailWithMessage("包名不合法", c)
return
} // PackageName可能导致路径穿越的问题 / 和 \ 都要防止
err := autoCodePackageService.Create(c.Request.Context(), &info)
if err != nil {
global.GVA_LOG.Error("创建失败!", zap.Error(err))
response.FailWithMessage("创建失败", c)
return
}
response.OkWithMessage("创建成功", c)
}
// Delete
// @Tags AutoCode
// @Summary 删除package
// @Security ApiKeyAuth
// @accept application/json
// @Produce application/json
// @Param data body common.GetById true "创建package"
// @Success 200 {object} response.Response{data=map[string]interface{},msg=string} "删除package成功"
// @Router /autoCode/delPackage [post]
func (a *AutoCodePackageApi) Delete(c *gin.Context) {
var info common.GetById
_ = c.ShouldBindJSON(&info)
err := autoCodePackageService.Delete(c.Request.Context(), info)
if err != nil {
global.GVA_LOG.Error("删除失败!", zap.Error(err))
response.FailWithMessage("删除失败", c)
return
}
response.OkWithMessage("删除成功", c)
}
// All
// @Tags AutoCodePackage
// @Summary 获取package
// @Security ApiKeyAuth
// @accept application/json
// @Produce application/json
// @Success 200 {object} response.Response{data=map[string]interface{},msg=string} "创建package成功"
// @Router /autoCode/getPackage [post]
func (a *AutoCodePackageApi) All(c *gin.Context) {
data, err := autoCodePackageService.All(c.Request.Context())
if err != nil {
global.GVA_LOG.Error("获取失败!", zap.Error(err))
response.FailWithMessage("获取失败", c)
return
}
response.OkWithDetailed(gin.H{"pkgs": data}, "获取成功", c)
}
// Templates
// @Tags AutoCodePackage
// @Summary 获取package
// @Security ApiKeyAuth
// @accept application/json
// @Produce application/json
// @Success 200 {object} response.Response{data=map[string]interface{},msg=string} "创建package成功"
// @Router /autoCode/getTemplates [get]
func (a *AutoCodePackageApi) Templates(c *gin.Context) {
data, err := autoCodePackageService.Templates(c.Request.Context())
if err != nil {
global.GVA_LOG.Error("获取失败!", zap.Error(err))
response.FailWithMessage("获取失败", c)
return
}
response.OkWithDetailed(data, "获取成功", c)
}
+218
View File
@@ -0,0 +1,218 @@
package system
import (
"fmt"
"os"
"path/filepath"
"github.com/flipped-aurora/gin-vue-admin/server/global"
"github.com/flipped-aurora/gin-vue-admin/server/model/common/response"
"github.com/flipped-aurora/gin-vue-admin/server/model/system/request"
systemRes "github.com/flipped-aurora/gin-vue-admin/server/model/system/response"
"github.com/flipped-aurora/gin-vue-admin/server/plugin/plugin-tool/utils"
"github.com/gin-gonic/gin"
"go.uber.org/zap"
)
type AutoCodePluginApi struct{}
// Install
// @Tags AutoCodePlugin
// @Summary 安装插件
// @Security ApiKeyAuth
// @accept multipart/form-data
// @Produce application/json
// @Param plug formData file true "this is a test file"
// @Success 200 {object} response.Response{data=[]interface{},msg=string} "安装插件成功"
// @Router /autoCode/installPlugin [post]
func (a *AutoCodePluginApi) Install(c *gin.Context) {
header, err := c.FormFile("plug")
if err != nil {
response.FailWithMessage(err.Error(), c)
return
}
web, server, err := autoCodePluginService.Install(header)
webStr := "web插件安装成功"
serverStr := "server插件安装成功"
if web == -1 {
webStr = "web端插件未成功安装,请按照文档自行解压安装,如果为纯后端插件请忽略此条提示"
}
if server == -1 {
serverStr = "server端插件未成功安装,请按照文档自行解压安装,如果为纯前端插件请忽略此条提示"
}
if err != nil {
response.FailWithMessage(err.Error(), c)
return
}
response.OkWithData([]interface{}{
gin.H{
"code": web,
"msg": webStr,
},
gin.H{
"code": server,
"msg": serverStr,
}}, c)
}
// Packaged
// @Tags AutoCodePlugin
// @Summary 打包插件
// @Security ApiKeyAuth
// @accept application/json
// @Produce application/json
// @Param plugName query string true "插件名称"
// @Success 200 {object} response.Response{data=map[string]interface{},msg=string} "打包插件成功"
// @Router /autoCode/pubPlug [post]
func (a *AutoCodePluginApi) Packaged(c *gin.Context) {
plugName := c.Query("plugName")
zipPath, err := autoCodePluginService.PubPlug(plugName)
if err != nil {
global.GVA_LOG.Error("打包失败!", zap.Error(err))
response.FailWithMessage("打包失败"+err.Error(), c)
return
}
response.OkWithMessage(fmt.Sprintf("打包成功,文件路径为:%s", zipPath), c)
}
// InitMenu
// @Tags AutoCodePlugin
// @Summary 打包插件
// @Security ApiKeyAuth
// @accept application/json
// @Produce application/json
// @Success 200 {object} response.Response{data=map[string]interface{},msg=string} "打包插件成功"
// @Router /autoCode/initMenu [post]
func (a *AutoCodePluginApi) InitMenu(c *gin.Context) {
var menuInfo request.InitMenu
err := c.ShouldBindJSON(&menuInfo)
if err != nil {
response.FailWithMessage(err.Error(), c)
return
}
err = autoCodePluginService.InitMenu(menuInfo)
if err != nil {
global.GVA_LOG.Error("创建初始化Menu失败!", zap.Error(err))
response.FailWithMessage("创建初始化Menu失败"+err.Error(), c)
return
}
response.OkWithMessage("文件变更成功", c)
}
// InitAPI
// @Tags AutoCodePlugin
// @Summary 打包插件
// @Security ApiKeyAuth
// @accept application/json
// @Produce application/json
// @Success 200 {object} response.Response{data=map[string]interface{},msg=string} "打包插件成功"
// @Router /autoCode/initAPI [post]
func (a *AutoCodePluginApi) InitAPI(c *gin.Context) {
var apiInfo request.InitApi
err := c.ShouldBindJSON(&apiInfo)
if err != nil {
response.FailWithMessage(err.Error(), c)
return
}
err = autoCodePluginService.InitAPI(apiInfo)
if err != nil {
global.GVA_LOG.Error("创建初始化API失败!", zap.Error(err))
response.FailWithMessage("创建初始化API失败"+err.Error(), c)
return
}
response.OkWithMessage("文件变更成功", c)
}
// InitDictionary
// @Tags AutoCodePlugin
// @Summary 打包插件
// @Security ApiKeyAuth
// @accept application/json
// @Produce application/json
// @Success 200 {object} response.Response{data=map[string]interface{},msg=string} "打包插件成功"
// @Router /autoCode/initDictionary [post]
func (a *AutoCodePluginApi) InitDictionary(c *gin.Context) {
var dictInfo request.InitDictionary
err := c.ShouldBindJSON(&dictInfo)
if err != nil {
response.FailWithMessage(err.Error(), c)
return
}
err = autoCodePluginService.InitDictionary(dictInfo)
if err != nil {
global.GVA_LOG.Error("创建初始化Dictionary失败!", zap.Error(err))
response.FailWithMessage("创建初始化Dictionary失败"+err.Error(), c)
return
}
response.OkWithMessage("文件变更成功", c)
}
// GetPluginList
// @Tags AutoCodePlugin
// @Summary 获取插件列表
// @Security ApiKeyAuth
// @Produce application/json
// @Success 200 {object} response.Response{data=[]systemRes.PluginInfo} "获取插件列表成功"
// @Router /autoCode/getPluginList [get]
func (a *AutoCodePluginApi) GetPluginList(c *gin.Context) {
serverDir := filepath.Join(global.GVA_CONFIG.AutoCode.Root, global.GVA_CONFIG.AutoCode.Server, "plugin")
webDir := filepath.Join(global.GVA_CONFIG.AutoCode.Root, global.GVA_CONFIG.AutoCode.Web, "plugin")
serverEntries, _ := os.ReadDir(serverDir)
webEntries, _ := os.ReadDir(webDir)
configMap := make(map[string]string)
for _, entry := range serverEntries {
if entry.IsDir() {
configMap[entry.Name()] = "server"
}
}
for _, entry := range webEntries {
if entry.IsDir() {
if val, ok := configMap[entry.Name()]; ok {
if val == "server" {
configMap[entry.Name()] = "full"
}
} else {
configMap[entry.Name()] = "web"
}
}
}
var list []systemRes.PluginInfo
for k, v := range configMap {
apis, menus, dicts := utils.GetPluginData(k)
list = append(list, systemRes.PluginInfo{
PluginName: k,
PluginType: v,
Apis: apis,
Menus: menus,
Dictionaries: dicts,
})
}
response.OkWithDetailed(list, "获取成功", c)
}
// Remove
// @Tags AutoCodePlugin
// @Summary 删除插件
// @Security ApiKeyAuth
// @Produce application/json
// @Param pluginName query string true "插件名称"
// @Param pluginType query string true "插件类型"
// @Success 200 {object} response.Response{msg=string} "删除插件成功"
// @Router /autoCode/removePlugin [post]
func (a *AutoCodePluginApi) Remove(c *gin.Context) {
pluginName := c.Query("pluginName")
pluginType := c.Query("pluginType")
err := autoCodePluginService.Remove(pluginName, pluginType)
if err != nil {
global.GVA_LOG.Error("删除失败!", zap.Error(err))
response.FailWithMessage("删除失败"+err.Error(), c)
return
}
response.OkWithMessage("删除成功", c)
}
+121
View File
@@ -0,0 +1,121 @@
package system
import (
"github.com/flipped-aurora/gin-vue-admin/server/global"
"github.com/flipped-aurora/gin-vue-admin/server/model/common/response"
"github.com/flipped-aurora/gin-vue-admin/server/model/system/request"
"github.com/flipped-aurora/gin-vue-admin/server/utils"
"github.com/gin-gonic/gin"
"go.uber.org/zap"
)
type AutoCodeTemplateApi struct{}
// Preview
// @Tags AutoCodeTemplate
// @Summary 预览创建后的代码
// @Security ApiKeyAuth
// @accept application/json
// @Produce application/json
// @Param data body request.AutoCode true "预览创建代码"
// @Success 200 {object} response.Response{data=map[string]interface{},msg=string} "预览创建后的代码"
// @Router /autoCode/preview [post]
func (a *AutoCodeTemplateApi) Preview(c *gin.Context) {
var info request.AutoCode
err := c.ShouldBindJSON(&info)
if err != nil {
response.FailWithMessage(err.Error(), c)
return
}
err = utils.Verify(info, utils.AutoCodeVerify)
if err != nil {
response.FailWithMessage(err.Error(), c)
return
}
err = info.Pretreatment()
if err != nil {
response.FailWithMessage(err.Error(), c)
return
}
info.PackageT = utils.FirstUpper(info.Package)
autoCode, err := autoCodeTemplateService.Preview(c.Request.Context(), info)
if err != nil {
global.GVA_LOG.Error(err.Error(), zap.Error(err))
response.FailWithMessage("预览失败:"+err.Error(), c)
} else {
response.OkWithDetailed(gin.H{"autoCode": autoCode}, "预览成功", c)
}
}
// Create
// @Tags AutoCodeTemplate
// @Summary 自动代码模板
// @Security ApiKeyAuth
// @accept application/json
// @Produce application/json
// @Param data body request.AutoCode true "创建自动代码"
// @Success 200 {string} string "{"success":true,"data":{},"msg":"创建成功"}"
// @Router /autoCode/createTemp [post]
func (a *AutoCodeTemplateApi) Create(c *gin.Context) {
var info request.AutoCode
err := c.ShouldBindJSON(&info)
if err != nil {
response.FailWithMessage(err.Error(), c)
return
}
err = utils.Verify(info, utils.AutoCodeVerify)
if err != nil {
response.FailWithMessage(err.Error(), c)
return
}
err = info.Pretreatment()
if err != nil {
response.FailWithMessage(err.Error(), c)
return
}
err = autoCodeTemplateService.Create(c.Request.Context(), info)
if err != nil {
global.GVA_LOG.Error("创建失败!", zap.Error(err))
response.FailWithMessage(err.Error(), c)
} else {
response.OkWithMessage("创建成功", c)
}
}
// AddFunc
// @Tags AddFunc
// @Summary 增加方法
// @Security ApiKeyAuth
// @accept application/json
// @Produce application/json
// @Param data body request.AutoCode true "增加方法"
// @Success 200 {string} string "{"success":true,"data":{},"msg":"创建成功"}"
// @Router /autoCode/addFunc [post]
func (a *AutoCodeTemplateApi) AddFunc(c *gin.Context) {
var info request.AutoFunc
err := c.ShouldBindJSON(&info)
if err != nil {
response.FailWithMessage(err.Error(), c)
return
}
var tempMap map[string]string
if info.IsPreview {
info.Router = "填充router"
info.FuncName = "填充funcName"
info.Method = "填充method"
info.Description = "填充description"
tempMap, err = autoCodeTemplateService.GetApiAndServer(info)
} else {
err = autoCodeTemplateService.AddFunc(info)
}
if err != nil {
global.GVA_LOG.Error("注入失败!", zap.Error(err))
response.FailWithMessage("注入失败", c)
} else {
if info.IsPreview {
response.OkWithDetailed(tempMap, "注入成功", c)
return
}
response.OkWithMessage("注入成功", c)
}
}
+37 -18
View File
@@ -14,27 +14,46 @@ type ApiGroup struct {
DictionaryApi
AuthorityMenuApi
OperationRecordApi
AutoCodeHistoryApi
DictionaryDetailApi
AuthorityBtnApi
ChatGptApi
SysExportTemplateApi
AutoCodePluginApi
AutoCodePackageApi
AutoCodeHistoryApi
AutoCodeTemplateApi
SysParamsApi
SysVersionApi
SysErrorApi
LoginLogApi
ApiTokenApi
SkillsApi
AIWorkflowSessionApi
}
var (
apiService = service.ServiceGroupApp.SystemServiceGroup.ApiService
jwtService = service.ServiceGroupApp.SystemServiceGroup.JwtService
menuService = service.ServiceGroupApp.SystemServiceGroup.MenuService
userService = service.ServiceGroupApp.SystemServiceGroup.UserService
initDBService = service.ServiceGroupApp.SystemServiceGroup.InitDBService
casbinService = service.ServiceGroupApp.SystemServiceGroup.CasbinService
autoCodeService = service.ServiceGroupApp.SystemServiceGroup.AutoCodeService
baseMenuService = service.ServiceGroupApp.SystemServiceGroup.BaseMenuService
authorityService = service.ServiceGroupApp.SystemServiceGroup.AuthorityService
dictionaryService = service.ServiceGroupApp.SystemServiceGroup.DictionaryService
systemConfigService = service.ServiceGroupApp.SystemServiceGroup.SystemConfigService
operationRecordService = service.ServiceGroupApp.SystemServiceGroup.OperationRecordService
autoCodeHistoryService = service.ServiceGroupApp.SystemServiceGroup.AutoCodeHistoryService
dictionaryDetailService = service.ServiceGroupApp.SystemServiceGroup.DictionaryDetailService
authorityBtnService = service.ServiceGroupApp.SystemServiceGroup.AuthorityBtnService
chatGptService = service.ServiceGroupApp.SystemServiceGroup.ChatGptService
apiService = service.ServiceGroupApp.SystemServiceGroup.ApiService
jwtService = service.ServiceGroupApp.SystemServiceGroup.JwtService
menuService = service.ServiceGroupApp.SystemServiceGroup.MenuService
userService = service.ServiceGroupApp.SystemServiceGroup.UserService
initDBService = service.ServiceGroupApp.SystemServiceGroup.InitDBService
casbinService = service.ServiceGroupApp.SystemServiceGroup.CasbinService
baseMenuService = service.ServiceGroupApp.SystemServiceGroup.BaseMenuService
authorityService = service.ServiceGroupApp.SystemServiceGroup.AuthorityService
dictionaryService = service.ServiceGroupApp.SystemServiceGroup.DictionaryService
authorityBtnService = service.ServiceGroupApp.SystemServiceGroup.AuthorityBtnService
systemConfigService = service.ServiceGroupApp.SystemServiceGroup.SystemConfigService
sysParamsService = service.ServiceGroupApp.SystemServiceGroup.SysParamsService
operationRecordService = service.ServiceGroupApp.SystemServiceGroup.OperationRecordService
dictionaryDetailService = service.ServiceGroupApp.SystemServiceGroup.DictionaryDetailService
autoCodeService = service.ServiceGroupApp.SystemServiceGroup.AutoCodeService
aiWorkflowSessionService = service.ServiceGroupApp.SystemServiceGroup.AIWorkflowSession
autoCodePluginService = service.ServiceGroupApp.SystemServiceGroup.AutoCodePlugin
autoCodePackageService = service.ServiceGroupApp.SystemServiceGroup.AutoCodePackage
autoCodeHistoryService = service.ServiceGroupApp.SystemServiceGroup.AutoCodeHistory
autoCodeTemplateService = service.ServiceGroupApp.SystemServiceGroup.AutoCodeTemplate
sysVersionService = service.ServiceGroupApp.SystemServiceGroup.SysVersionService
sysErrorService = service.ServiceGroupApp.SystemServiceGroup.SysErrorService
loginLogService = service.ServiceGroupApp.SystemServiceGroup.LoginLogService
apiTokenService = service.ServiceGroupApp.SystemServiceGroup.ApiTokenService
skillsService = service.ServiceGroupApp.SystemServiceGroup.SkillsService
)
+152 -2
View File
@@ -45,6 +45,97 @@ func (s *SystemApiApi) CreateApi(c *gin.Context) {
response.OkWithMessage("创建成功", c)
}
// SyncApi
// @Tags SysApi
// @Summary 同步API
// @Security ApiKeyAuth
// @accept application/json
// @Produce application/json
// @Success 200 {object} response.Response{msg=string} "同步API"
// @Router /api/syncApi [get]
func (s *SystemApiApi) SyncApi(c *gin.Context) {
newApis, deleteApis, ignoreApis, err := apiService.SyncApi()
if err != nil {
global.GVA_LOG.Error("同步失败!", zap.Error(err))
response.FailWithMessage("同步失败", c)
return
}
response.OkWithData(gin.H{
"newApis": newApis,
"deleteApis": deleteApis,
"ignoreApis": ignoreApis,
}, c)
}
// GetApiGroups
// @Tags SysApi
// @Summary 获取API分组
// @Security ApiKeyAuth
// @accept application/json
// @Produce application/json
// @Success 200 {object} response.Response{msg=string} "获取API分组"
// @Router /api/getApiGroups [get]
func (s *SystemApiApi) GetApiGroups(c *gin.Context) {
groups, apiGroupMap, err := apiService.GetApiGroups()
if err != nil {
global.GVA_LOG.Error("获取失败!", zap.Error(err))
response.FailWithMessage("获取失败", c)
return
}
response.OkWithData(gin.H{
"groups": groups,
"apiGroupMap": apiGroupMap,
}, c)
}
// IgnoreApi
// @Tags IgnoreApi
// @Summary 忽略API
// @Security ApiKeyAuth
// @accept application/json
// @Produce application/json
// @Success 200 {object} response.Response{msg=string} "同步API"
// @Router /api/ignoreApi [post]
func (s *SystemApiApi) IgnoreApi(c *gin.Context) {
var ignoreApi system.SysIgnoreApi
err := c.ShouldBindJSON(&ignoreApi)
if err != nil {
response.FailWithMessage(err.Error(), c)
return
}
err = apiService.IgnoreApi(ignoreApi)
if err != nil {
global.GVA_LOG.Error("忽略失败!", zap.Error(err))
response.FailWithMessage("忽略失败", c)
return
}
response.Ok(c)
}
// EnterSyncApi
// @Tags SysApi
// @Summary 确认同步API
// @Security ApiKeyAuth
// @accept application/json
// @Produce application/json
// @Success 200 {object} response.Response{msg=string} "确认同步API"
// @Router /api/enterSyncApi [post]
func (s *SystemApiApi) EnterSyncApi(c *gin.Context) {
var syncApi systemRes.SysSyncApis
err := c.ShouldBindJSON(&syncApi)
if err != nil {
response.FailWithMessage(err.Error(), c)
return
}
err = apiService.EnterSyncApi(syncApi)
if err != nil {
global.GVA_LOG.Error("忽略失败!", zap.Error(err))
response.FailWithMessage("忽略失败", c)
return
}
response.Ok(c)
}
// DeleteApi
// @Tags SysApi
// @Summary 删除api
@@ -179,7 +270,8 @@ func (s *SystemApiApi) UpdateApi(c *gin.Context) {
// @Success 200 {object} response.Response{data=systemRes.SysAPIListResponse,msg=string} "获取所有的Api 不分页,返回包括api列表"
// @Router /api/getAllApis [post]
func (s *SystemApiApi) GetAllApis(c *gin.Context) {
apis, err := apiService.GetAllApis()
authorityID := utils.GetUserAuthorityId(c)
apis, err := apiService.GetAllApis(authorityID)
if err != nil {
global.GVA_LOG.Error("获取失败!", zap.Error(err))
response.FailWithMessage("获取失败", c)
@@ -221,7 +313,7 @@ func (s *SystemApiApi) DeleteApisByIds(c *gin.Context) {
// @Success 200 {object} response.Response{msg=string} "刷新成功"
// @Router /api/freshCasbin [get]
func (s *SystemApiApi) FreshCasbin(c *gin.Context) {
err := apiService.FreshCasbin()
err := casbinService.FreshCasbin()
if err != nil {
global.GVA_LOG.Error("刷新失败!", zap.Error(err))
response.FailWithMessage("刷新失败", c)
@@ -229,3 +321,61 @@ func (s *SystemApiApi) FreshCasbin(c *gin.Context) {
}
response.OkWithMessage("刷新成功", c)
}
// GetApiRoles
// @Tags SysApi
// @Summary 获取拥有指定API权限的角色ID列表
// @Security ApiKeyAuth
// @accept application/json
// @Produce application/json
// @Param path query string true "API路径"
// @Param method query string true "请求方法"
// @Success 200 {object} response.Response{data=map[string]interface{},msg=string} "获取成功"
// @Router /api/getApiRoles [get]
func (s *SystemApiApi) GetApiRoles(c *gin.Context) {
path := c.Query("path")
method := c.Query("method")
if path == "" || method == "" {
response.FailWithMessage("API路径和请求方法不能为空", c)
return
}
authorityIds, err := casbinService.GetAuthoritiesByApi(path, method)
if err != nil {
global.GVA_LOG.Error("获取失败!", zap.Error(err))
response.FailWithMessage("获取失败"+err.Error(), c)
return
}
if authorityIds == nil {
authorityIds = []uint{}
}
response.OkWithDetailed(authorityIds, "获取成功", c)
}
// SetApiRoles
// @Tags SysApi
// @Summary 全量覆盖某API关联的角色列表
// @Security ApiKeyAuth
// @accept application/json
// @Produce application/json
// @Param data body systemReq.SetApiAuthorities true "API路径、请求方法和角色ID列表"
// @Success 200 {object} response.Response{msg=string} "设置成功"
// @Router /api/setApiRoles [post]
func (s *SystemApiApi) SetApiRoles(c *gin.Context) {
var req systemReq.SetApiAuthorities
if err := c.ShouldBindJSON(&req); err != nil {
response.FailWithMessage(err.Error(), c)
return
}
if req.Path == "" || req.Method == "" {
response.FailWithMessage("API路径和请求方法不能为空", c)
return
}
if err := casbinService.SetApiAuthorities(req.Path, req.Method, req.AuthorityIds); err != nil {
global.GVA_LOG.Error("设置失败!", zap.Error(err))
response.FailWithMessage("设置失败"+err.Error(), c)
return
}
// 刷新casbin缓存使策略立即生效
_ = casbinService.FreshCasbin()
response.OkWithMessage("设置成功", c)
}
+81
View File
@@ -0,0 +1,81 @@
package system
import (
"github.com/flipped-aurora/gin-vue-admin/server/global"
"github.com/flipped-aurora/gin-vue-admin/server/model/common/response"
"github.com/flipped-aurora/gin-vue-admin/server/model/system"
sysReq "github.com/flipped-aurora/gin-vue-admin/server/model/system/request"
"github.com/gin-gonic/gin"
"go.uber.org/zap"
)
type ApiTokenApi struct{}
// CreateApiToken 签发Token
func (s *ApiTokenApi) CreateApiToken(c *gin.Context) {
var req struct {
UserID uint `json:"userId"`
AuthorityID uint `json:"authorityId"`
Days int `json:"days"` // -1为永久, 其他为天数
Remark string `json:"remark"`
}
err := c.ShouldBindJSON(&req)
if err != nil {
response.FailWithMessage(err.Error(), c)
return
}
token := system.SysApiToken{
UserID: req.UserID,
AuthorityID: req.AuthorityID,
Remark: req.Remark,
}
jwtStr, err := apiTokenService.CreateApiToken(token, req.Days)
if err != nil {
global.GVA_LOG.Error("签发失败!", zap.Error(err))
response.FailWithMessage("签发失败: "+err.Error(), c)
return
}
response.OkWithDetailed(gin.H{"token": jwtStr}, "签发成功", c)
}
// GetApiTokenList 获取列表
func (s *ApiTokenApi) GetApiTokenList(c *gin.Context) {
var pageInfo sysReq.SysApiTokenSearch
err := c.ShouldBindJSON(&pageInfo)
if err != nil {
response.FailWithMessage(err.Error(), c)
return
}
list, total, err := apiTokenService.GetApiTokenList(pageInfo)
if err != nil {
global.GVA_LOG.Error("获取失败!", zap.Error(err))
response.FailWithMessage("获取失败", c)
return
}
response.OkWithDetailed(response.PageResult{
List: list,
Total: total,
Page: pageInfo.Page,
PageSize: pageInfo.PageSize,
}, "获取成功", c)
}
// DeleteApiToken 作废Token
func (s *ApiTokenApi) DeleteApiToken(c *gin.Context) {
var req system.SysApiToken
err := c.ShouldBindJSON(&req)
if err != nil {
response.FailWithMessage(err.Error(), c)
return
}
err = apiTokenService.DeleteApiToken(req.ID)
if err != nil {
global.GVA_LOG.Error("作废失败!", zap.Error(err))
response.FailWithMessage("作废失败", c)
return
}
response.OkWithMessage("作废成功", c)
}
+87 -38
View File
@@ -2,7 +2,6 @@ package system
import (
"github.com/flipped-aurora/gin-vue-admin/server/global"
"github.com/flipped-aurora/gin-vue-admin/server/model/common/request"
"github.com/flipped-aurora/gin-vue-admin/server/model/common/response"
"github.com/flipped-aurora/gin-vue-admin/server/model/system"
systemReq "github.com/flipped-aurora/gin-vue-admin/server/model/system/request"
@@ -25,26 +24,35 @@ type AuthorityApi struct{}
// @Success 200 {object} response.Response{data=systemRes.SysAuthorityResponse,msg=string} "创建角色,返回包括系统角色详情"
// @Router /authority/createAuthority [post]
func (a *AuthorityApi) CreateAuthority(c *gin.Context) {
var authority system.SysAuthority
err := c.ShouldBindJSON(&authority)
if err != nil {
var authority, authBack system.SysAuthority
var err error
if err = c.ShouldBindJSON(&authority); err != nil {
response.FailWithMessage(err.Error(), c)
return
}
err = utils.Verify(authority, utils.AuthorityVerify)
if err != nil {
if err = utils.Verify(authority, utils.AuthorityVerify); err != nil {
response.FailWithMessage(err.Error(), c)
return
}
if authBack, err := authorityService.CreateAuthority(authority); err != nil {
if *authority.ParentId == 0 && global.GVA_CONFIG.System.UseStrictAuth {
authority.ParentId = utils.Pointer(utils.GetUserAuthorityId(c))
}
if authBack, err = authorityService.CreateAuthority(authority); err != nil {
global.GVA_LOG.Error("创建失败!", zap.Error(err))
response.FailWithMessage("创建失败"+err.Error(), c)
} else {
_ = menuService.AddMenuAuthority(systemReq.DefaultMenu(), authority.AuthorityId)
_ = casbinService.UpdateCasbin(authority.AuthorityId, systemReq.DefaultCasbin())
response.OkWithDetailed(systemRes.SysAuthorityResponse{Authority: authBack}, "创建成功", c)
return
}
err = casbinService.FreshCasbin()
if err != nil {
global.GVA_LOG.Error("创建成功,权限刷新失败。", zap.Error(err))
response.FailWithMessage("创建成功,权限刷新失败。"+err.Error(), c)
return
}
response.OkWithDetailed(systemRes.SysAuthorityResponse{Authority: authBack}, "创建成功", c)
}
// CopyAuthority
@@ -73,7 +81,8 @@ func (a *AuthorityApi) CopyAuthority(c *gin.Context) {
response.FailWithMessage(err.Error(), c)
return
}
authBack, err := authorityService.CopyAuthority(copyInfo)
adminAuthorityID := utils.GetUserAuthorityId(c)
authBack, err := authorityService.CopyAuthority(adminAuthorityID, copyInfo)
if err != nil {
global.GVA_LOG.Error("拷贝失败!", zap.Error(err))
response.FailWithMessage("拷贝失败"+err.Error(), c)
@@ -93,22 +102,22 @@ func (a *AuthorityApi) CopyAuthority(c *gin.Context) {
// @Router /authority/deleteAuthority [post]
func (a *AuthorityApi) DeleteAuthority(c *gin.Context) {
var authority system.SysAuthority
err := c.ShouldBindJSON(&authority)
if err != nil {
var err error
if err = c.ShouldBindJSON(&authority); err != nil {
response.FailWithMessage(err.Error(), c)
return
}
err = utils.Verify(authority, utils.AuthorityIdVerify)
if err != nil {
if err = utils.Verify(authority, utils.AuthorityIdVerify); err != nil {
response.FailWithMessage(err.Error(), c)
return
}
err = authorityService.DeleteAuthority(&authority)
if err != nil { // 删除角色之前需要判断是否有用户正在使用此角色
// 删除角色之前需要判断是否有用户正在使用此角色
if err = authorityService.DeleteAuthority(&authority); err != nil {
global.GVA_LOG.Error("删除失败!", zap.Error(err))
response.FailWithMessage("删除失败"+err.Error(), c)
return
}
_ = casbinService.FreshCasbin()
response.OkWithMessage("删除成功", c)
}
@@ -120,7 +129,7 @@ func (a *AuthorityApi) DeleteAuthority(c *gin.Context) {
// @Produce application/json
// @Param data body system.SysAuthority true "权限id, 权限名, 父角色id"
// @Success 200 {object} response.Response{data=systemRes.SysAuthorityResponse,msg=string} "更新角色信息,返回包括系统角色详情"
// @Router /authority/updateAuthority [post]
// @Router /authority/updateAuthority [put]
func (a *AuthorityApi) UpdateAuthority(c *gin.Context) {
var auth system.SysAuthority
err := c.ShouldBindJSON(&auth)
@@ -152,29 +161,14 @@ func (a *AuthorityApi) UpdateAuthority(c *gin.Context) {
// @Success 200 {object} response.Response{data=response.PageResult,msg=string} "分页获取角色列表,返回包括列表,总数,页码,每页数量"
// @Router /authority/getAuthorityList [post]
func (a *AuthorityApi) GetAuthorityList(c *gin.Context) {
var pageInfo request.PageInfo
err := c.ShouldBindJSON(&pageInfo)
if err != nil {
response.FailWithMessage(err.Error(), c)
return
}
err = utils.Verify(pageInfo, utils.PageInfoVerify)
if err != nil {
response.FailWithMessage(err.Error(), c)
return
}
list, total, err := authorityService.GetAuthorityInfoList(pageInfo)
authorityID := utils.GetUserAuthorityId(c)
list, err := authorityService.GetAuthorityInfoList(authorityID)
if err != nil {
global.GVA_LOG.Error("获取失败!", zap.Error(err))
response.FailWithMessage("获取失败"+err.Error(), c)
return
}
response.OkWithDetailed(response.PageResult{
List: list,
Total: total,
Page: pageInfo.Page,
PageSize: pageInfo.PageSize,
}, "获取成功", c)
response.OkWithDetailed(list, "获取成功", c)
}
// SetDataAuthority
@@ -198,7 +192,8 @@ func (a *AuthorityApi) SetDataAuthority(c *gin.Context) {
response.FailWithMessage(err.Error(), c)
return
}
err = authorityService.SetDataAuthority(auth)
adminAuthorityID := utils.GetUserAuthorityId(c)
err = authorityService.SetDataAuthority(adminAuthorityID, auth)
if err != nil {
global.GVA_LOG.Error("设置失败!", zap.Error(err))
response.FailWithMessage("设置失败"+err.Error(), c)
@@ -206,3 +201,57 @@ func (a *AuthorityApi) SetDataAuthority(c *gin.Context) {
}
response.OkWithMessage("设置成功", c)
}
// GetUsersByAuthority
// @Tags Authority
// @Summary 获取拥有指定角色的用户ID列表
// @Security ApiKeyAuth
// @accept application/json
// @Produce application/json
// @Param authorityId query uint true "角色ID"
// @Success 200 {object} response.Response{data=[]uint,msg=string} "获取成功"
// @Router /authority/getUsersByAuthority [get]
func (a *AuthorityApi) GetUsersByAuthority(c *gin.Context) {
var req systemReq.SetRoleUsers
if err := c.ShouldBindQuery(&req); err != nil {
response.FailWithMessage(err.Error(), c)
return
}
userIds, err := authorityService.GetUserIdsByAuthorityId(req.AuthorityId)
if err != nil {
global.GVA_LOG.Error("获取失败!", zap.Error(err))
response.FailWithMessage("获取失败"+err.Error(), c)
return
}
if userIds == nil {
userIds = []uint{}
}
response.OkWithDetailed(userIds, "获取成功", c)
}
// SetRoleUsers
// @Tags Authority
// @Summary 全量覆盖某角色关联的用户列表
// @Security ApiKeyAuth
// @accept application/json
// @Produce application/json
// @Param data body systemReq.SetRoleUsers true "角色ID和用户ID列表"
// @Success 200 {object} response.Response{msg=string} "设置成功"
// @Router /authority/setRoleUsers [post]
func (a *AuthorityApi) SetRoleUsers(c *gin.Context) {
var req systemReq.SetRoleUsers
if err := c.ShouldBindJSON(&req); err != nil {
response.FailWithMessage(err.Error(), c)
return
}
if req.AuthorityId == 0 {
response.FailWithMessage("角色ID不能为空", c)
return
}
if err := authorityService.SetRoleUsers(req.AuthorityId, req.UserIds); err != nil {
global.GVA_LOG.Error("设置失败!", zap.Error(err))
response.FailWithMessage("设置失败"+err.Error(), c)
return
}
response.OkWithMessage("设置成功", c)
}
+153 -249
View File
@@ -3,313 +3,217 @@ package system
import (
"errors"
"fmt"
"net/url"
"os"
"io"
"net/http"
"strings"
"github.com/flipped-aurora/gin-vue-admin/server/global"
"github.com/flipped-aurora/gin-vue-admin/server/model/common"
"github.com/flipped-aurora/gin-vue-admin/server/model/common/response"
"github.com/flipped-aurora/gin-vue-admin/server/model/system"
"github.com/flipped-aurora/gin-vue-admin/server/utils"
"github.com/gin-gonic/gin"
"github.com/goccy/go-json"
"go.uber.org/zap"
)
type AutoCodeApi struct{}
// PreviewTemp
// @Tags AutoCode
// @Summary 预览创建后的代码
// @Security ApiKeyAuth
// @accept application/json
// @Produce application/json
// @Param data body system.AutoCodeStruct true "预览创建代码"
// @Success 200 {object} response.Response{data=map[string]interface{},msg=string} "预览创建后的代码"
// @Router /autoCode/preview [post]
func (autoApi *AutoCodeApi) PreviewTemp(c *gin.Context) {
var a system.AutoCodeStruct
_ = c.ShouldBindJSON(&a)
if err := utils.Verify(a, utils.AutoCodeVerify); err != nil {
response.FailWithMessage(err.Error(), c)
return
}
a.Pretreatment() // 处理go关键字
a.PackageT = utils.FirstUpper(a.Package)
autoCode, err := autoCodeService.PreviewTemp(a)
if err != nil {
global.GVA_LOG.Error("预览失败!", zap.Error(err))
response.FailWithMessage("预览失败", c)
} else {
response.OkWithDetailed(gin.H{"autoCode": autoCode}, "预览成功", c)
}
}
// CreateTemp
// @Tags AutoCode
// @Summary 自动代码模板
// @Security ApiKeyAuth
// @accept application/json
// @Produce application/json
// @Param data body system.AutoCodeStruct true "创建自动代码"
// @Success 200 {string} string "{"success":true,"data":{},"msg":"创建成功"}"
// @Router /autoCode/createTemp [post]
func (autoApi *AutoCodeApi) CreateTemp(c *gin.Context) {
var a system.AutoCodeStruct
_ = c.ShouldBindJSON(&a)
if err := utils.Verify(a, utils.AutoCodeVerify); err != nil {
response.FailWithMessage(err.Error(), c)
return
}
a.Pretreatment()
var apiIds []uint
if a.AutoCreateApiToSql {
if ids, err := autoCodeService.AutoCreateApi(&a); err != nil {
global.GVA_LOG.Error("自动化创建失败!请自行清空垃圾数据!", zap.Error(err))
c.Writer.Header().Add("success", "false")
c.Writer.Header().Add("msg", url.QueryEscape("自动化创建失败!请自行清空垃圾数据!"))
return
} else {
apiIds = ids
}
}
a.PackageT = utils.FirstUpper(a.Package)
err := autoCodeService.CreateTemp(a, apiIds...)
if err != nil {
if errors.Is(err, system.ErrAutoMove) {
c.Writer.Header().Add("success", "true")
c.Writer.Header().Add("msg", url.QueryEscape(err.Error()))
} else {
c.Writer.Header().Add("success", "false")
c.Writer.Header().Add("msg", url.QueryEscape(err.Error()))
_ = os.Remove("./ginvueadmin.zip")
}
} else {
c.Writer.Header().Add("Content-Disposition", fmt.Sprintf("attachment; filename=%s", "ginvueadmin.zip")) // fmt.Sprintf("attachment; filename=%s", filename)对下载的文件重命名
c.Writer.Header().Add("Content-Type", "application/json")
c.Writer.Header().Add("success", "true")
c.File("./ginvueadmin.zip")
_ = os.Remove("./ginvueadmin.zip")
}
}
// GetDB
// @Tags AutoCode
// @Summary 获取当前所有数据库
// @Security ApiKeyAuth
// @accept application/json
// @Produce application/json
// @Success 200 {object} response.Response{data=map[string]interface{},msg=string} "获取当前所有数据库"
// @Router /autoCode/getDatabase [get]
func (autoApi *AutoCodeApi) GetDB(c *gin.Context) {
businessDB := c.Query("businessDB")
dbs, err := autoCodeService.Database(businessDB).GetDB(businessDB)
var dbList []map[string]interface{}
for _, db := range global.GVA_CONFIG.DBList {
var item = make(map[string]interface{})
item["aliasName"] = db.AliasName
item["dbName"] = db.Dbname
item["disable"] = db.Disable
item["dbtype"] = db.Type
item := map[string]interface{}{
"aliasName": db.AliasName,
"dbName": db.Dbname,
"disable": db.Disable,
"dbtype": db.Type,
}
dbList = append(dbList, item)
}
if err != nil {
global.GVA_LOG.Error("获取失败!", zap.Error(err))
response.FailWithMessage("获取失败", c)
} else {
response.OkWithDetailed(gin.H{"dbs": dbs, "dbList": dbList}, "获取成功", c)
return
}
response.OkWithDetailed(gin.H{"dbs": dbs, "dbList": dbList}, "获取成功", c)
}
// GetTables
// @Tags AutoCode
// @Summary 获取当前数据库所有表
// @Security ApiKeyAuth
// @accept application/json
// @Produce application/json
// @Success 200 {object} response.Response{data=map[string]interface{},msg=string} "获取当前数据库所有表"
// @Router /autoCode/getTables [get]
func (autoApi *AutoCodeApi) GetTables(c *gin.Context) {
dbName := c.DefaultQuery("dbName", global.GVA_CONFIG.Mysql.Dbname)
dbName := c.Query("dbName")
businessDB := c.Query("businessDB")
if dbName == "" {
dbName = *global.GVA_ACTIVE_DBNAME
if businessDB != "" {
for _, db := range global.GVA_CONFIG.DBList {
if db.AliasName == businessDB {
dbName = db.Dbname
}
}
}
}
tables, err := autoCodeService.Database(businessDB).GetTables(businessDB, dbName)
if err != nil {
global.GVA_LOG.Error("查询table失败!", zap.Error(err))
response.FailWithMessage("查询table失败", c)
} else {
response.OkWithDetailed(gin.H{"tables": tables}, "获取成功", c)
return
}
response.OkWithDetailed(gin.H{"tables": tables}, "获取成功", c)
}
// GetColumn
// @Tags AutoCode
// @Summary 获取当前表所有字段
// @Security ApiKeyAuth
// @accept application/json
// @Produce application/json
// @Success 200 {object} response.Response{data=map[string]interface{},msg=string} "获取当前表所有字段"
// @Router /autoCode/getColumn [get]
func (autoApi *AutoCodeApi) GetColumn(c *gin.Context) {
businessDB := c.Query("businessDB")
dbName := c.DefaultQuery("dbName", global.GVA_CONFIG.Mysql.Dbname)
dbName := c.Query("dbName")
if dbName == "" {
dbName = *global.GVA_ACTIVE_DBNAME
if businessDB != "" {
for _, db := range global.GVA_CONFIG.DBList {
if db.AliasName == businessDB {
dbName = db.Dbname
}
}
}
}
tableName := c.Query("tableName")
columns, err := autoCodeService.Database(businessDB).GetColumn(businessDB, tableName, dbName)
if err != nil {
global.GVA_LOG.Error("获取失败!", zap.Error(err))
response.FailWithMessage("获取失败", c)
} else {
response.OkWithDetailed(gin.H{"columns": columns}, "获取成功", c)
return
}
response.OkWithDetailed(gin.H{"columns": columns}, "获取成功", c)
}
// CreatePackage
// @Tags AutoCode
// @Summary 创建package
// @Security ApiKeyAuth
// @accept application/json
// @Produce application/json
// @Param data body system.SysAutoCode true "创建package"
// @Success 200 {object} response.Response{data=map[string]interface{},msg=string} "创建package成功"
// @Router /autoCode/createPackage [post]
func (autoApi *AutoCodeApi) CreatePackage(c *gin.Context) {
var a system.SysAutoCode
_ = c.ShouldBindJSON(&a)
if err := utils.Verify(a, utils.AutoPackageVerify); err != nil {
func (autoApi *AutoCodeApi) LLMAuto(c *gin.Context) {
var llm common.JSONMap
if err := c.ShouldBindJSON(&llm); err != nil {
response.FailWithMessage(err.Error(), c)
return
}
err := autoCodeService.CreateAutoCode(&a)
if err != nil {
global.GVA_LOG.Error("创建成功!", zap.Error(err))
response.FailWithMessage("创建失败", c)
} else {
response.OkWithMessage("创建成功", c)
if shouldStreamLLM(c, llm) {
if err := autoApi.proxyLLMStream(c, llm); err != nil {
global.GVA_LOG.Error("大模型流式代理失败!", zap.Error(err))
if c.Writer.Written() {
writeLLMStreamError(c, err)
return
}
response.FailWithMessage(err.Error(), c)
}
return
}
}
// GetPackage
// @Tags AutoCode
// @Summary 获取package
// @Security ApiKeyAuth
// @accept application/json
// @Produce application/json
// @Success 200 {object} response.Response{data=map[string]interface{},msg=string} "创建package成功"
// @Router /autoCode/getPackage [post]
func (autoApi *AutoCodeApi) GetPackage(c *gin.Context) {
pkgs, err := autoCodeService.GetPackage()
if err != nil {
global.GVA_LOG.Error("获取失败!", zap.Error(err))
response.FailWithMessage("获取失败", c)
} else {
response.OkWithDetailed(gin.H{"pkgs": pkgs}, "获取成功", c)
}
}
// DelPackage
// @Tags AutoCode
// @Summary 删除package
// @Security ApiKeyAuth
// @accept application/json
// @Produce application/json
// @Param data body system.SysAutoCode true "创建package"
// @Success 200 {object} response.Response{data=map[string]interface{},msg=string} "删除package成功"
// @Router /autoCode/delPackage [post]
func (autoApi *AutoCodeApi) DelPackage(c *gin.Context) {
var a system.SysAutoCode
_ = c.ShouldBindJSON(&a)
err := autoCodeService.DelPackage(a)
if err != nil {
global.GVA_LOG.Error("删除失败!", zap.Error(err))
response.FailWithMessage("删除失败", c)
} else {
response.OkWithMessage("删除成功", c)
}
}
// AutoPlug
// @Tags AutoCode
// @Summary 创建插件模板
// @Security ApiKeyAuth
// @accept application/json
// @Produce application/json
// @Param data body system.SysAutoCode true "创建插件模板"
// @Success 200 {object} response.Response{data=map[string]interface{},msg=string} "创建插件模板成功"
// @Router /autoCode/createPlug [post]
func (autoApi *AutoCodeApi) AutoPlug(c *gin.Context) {
var a system.AutoPlugReq
err := c.ShouldBindJSON(&a)
data, err := autoCodeService.LLMAuto(c.Request.Context(), llm)
if err != nil {
global.GVA_LOG.Error("大模型生成失败!", zap.Error(err))
response.FailWithMessage(err.Error(), c)
return
}
a.Snake = strings.ToLower(a.PlugName)
a.NeedModel = a.HasRequest || a.HasResponse
err = autoCodeService.CreatePlug(a)
if err != nil {
global.GVA_LOG.Error("预览失败!", zap.Error(err))
response.FailWithMessage("预览失败", c)
return
}
response.Ok(c)
response.OkWithData(data, c)
}
// InstallPlugin
// @Tags AutoCode
// @Summary 安装插件
// @Security ApiKeyAuth
// @accept multipart/form-data
// @Produce application/json
// @Param plug formData file true "this is a test file"
// @Success 200 {object} response.Response{data=[]interface{},msg=string} "安装插件成功"
// @Router /autoCode/installPlugin [post]
func (autoApi *AutoCodeApi) InstallPlugin(c *gin.Context) {
header, err := c.FormFile("plug")
if err != nil {
response.FailWithMessage(err.Error(), c)
return
func shouldStreamLLM(c *gin.Context, llm common.JSONMap) bool {
responseMode := strings.ToLower(strings.TrimSpace(fmt.Sprintf("%v", llm["response_mode"])))
if responseMode == "streaming" || responseMode == "sse" {
return true
}
web, server, err := autoCodeService.InstallPlugin(header)
webStr := "web插件安装成功"
serverStr := "server插件安装成功"
if web == -1 {
webStr = "web端插件未成功安装,请按照文档自行解压安装,如果为纯后端插件请忽略此条提示"
if stream, ok := llm["stream"].(bool); ok && stream {
return true
}
if server == -1 {
serverStr = "server端插件未成功安装,请按照文档自行解压安装,如果为纯前端插件请忽略此条提示"
}
if err != nil {
response.FailWithMessage(err.Error(), c)
return
}
response.OkWithData([]interface{}{
gin.H{
"code": web,
"msg": webStr,
},
gin.H{
"code": server,
"msg": serverStr,
}}, c)
return strings.Contains(strings.ToLower(c.GetHeader("Accept")), "text/event-stream")
}
// PubPlug
// @Tags AutoCode
// @Summary 打包插件
// @Security ApiKeyAuth
// @accept application/json
// @Produce application/json
// @Param data body system.SysAutoCode true "打包插件"
// @Success 200 {object} response.Response{data=map[string]interface{},msg=string} "打包插件成功"
// @Router /autoCode/pubPlug [get]
func (autoApi *AutoCodeApi) PubPlug(c *gin.Context) {
plugName := c.Query("plugName")
snake := strings.ToLower(plugName)
zipPath, err := autoCodeService.PubPlug(snake)
func (autoApi *AutoCodeApi) proxyLLMStream(c *gin.Context, llm common.JSONMap) error {
res, err := autoCodeService.LLMAutoStream(c.Request.Context(), llm)
if err != nil {
global.GVA_LOG.Error("打包失败!", zap.Error(err))
response.FailWithMessage("打包失败"+err.Error(), c)
return
return err
}
defer res.Body.Close()
if res.StatusCode < 200 || res.StatusCode >= 300 {
body, readErr := io.ReadAll(res.Body)
if readErr != nil {
return fmt.Errorf("上游大模型流式服务返回非 2xx: status=%d content-type=%s read-body-err=%w", res.StatusCode, res.Header.Get("Content-Type"), readErr)
}
return fmt.Errorf("上游大模型流式服务返回非 2xx: status=%d content-type=%s body=%s", res.StatusCode, res.Header.Get("Content-Type"), previewResponseBody(body))
}
flusher, ok := c.Writer.(http.Flusher)
if !ok {
return errors.New("当前响应不支持流式输出")
}
copyLLMStreamHeaders(c.Writer.Header(), res.Header)
if c.Writer.Header().Get("Content-Type") == "" {
c.Writer.Header().Set("Content-Type", "text/event-stream; charset=utf-8")
}
if c.Writer.Header().Get("Cache-Control") == "" {
c.Writer.Header().Set("Cache-Control", "no-cache")
}
c.Writer.Header().Set("Connection", "keep-alive")
c.Writer.Header().Set("X-Accel-Buffering", "no")
c.Status(res.StatusCode)
flusher.Flush()
buf := make([]byte, 32*1024)
for {
n, readErr := res.Body.Read(buf)
if n > 0 {
if _, writeErr := c.Writer.Write(buf[:n]); writeErr != nil {
return fmt.Errorf("向客户端写入流式响应失败: %w", writeErr)
}
flusher.Flush()
}
if readErr != nil {
if errors.Is(readErr, io.EOF) {
return nil
}
return fmt.Errorf("读取上游流式响应失败: %w", readErr)
}
}
response.OkWithMessage(fmt.Sprintf("打包成功,文件路径为:%s", zipPath), c)
}
func copyLLMStreamHeaders(dst, src http.Header) {
for _, key := range []string{
"Content-Type",
"Cache-Control",
"Content-Encoding",
"Content-Language",
"X-Accel-Buffering",
} {
if value := src.Get(key); value != "" {
dst.Set(key, value)
}
}
}
func writeLLMStreamError(c *gin.Context, err error) {
payload, marshalErr := json.Marshal(gin.H{
"message": err.Error(),
})
if marshalErr != nil {
payload = []byte(`{"message":"流式代理失败"}`)
}
_, _ = c.Writer.WriteString("event: error\n")
_, _ = c.Writer.WriteString("data: ")
_, _ = c.Writer.Write(payload)
_, _ = c.Writer.WriteString("\n\n")
if flusher, ok := c.Writer.(http.Flusher); ok {
flusher.Flush()
}
}
func previewResponseBody(body []byte) string {
text := strings.TrimSpace(string(body))
text = strings.ReplaceAll(text, "\r", " ")
text = strings.ReplaceAll(text, "\n", " ")
text = strings.Join(strings.Fields(text), " ")
if text == "" {
return "<empty>"
}
runes := []rune(text)
if len(runes) > 300 {
return string(runes[:300]) + "..."
}
return text
}
+210
View File
@@ -0,0 +1,210 @@
package system
import (
"bufio"
"errors"
"fmt"
"io"
"net/http"
"strings"
"github.com/flipped-aurora/gin-vue-admin/server/global"
"github.com/flipped-aurora/gin-vue-admin/server/model/common"
"github.com/flipped-aurora/gin-vue-admin/server/model/common/response"
"github.com/gin-contrib/sse"
"github.com/gin-gonic/gin"
"github.com/goccy/go-json"
"go.uber.org/zap"
)
func (autoApi *AutoCodeApi) LLMAutoSSE(c *gin.Context) {
var llm common.JSONMap
if err := c.ShouldBindJSON(&llm); err != nil {
global.GVA_LOG.Error("LLMAutoSSE 参数绑定失败!", zap.Error(err))
response.FailWithMessage(err.Error(), c)
return
}
if llm == nil {
llm = common.JSONMap{}
}
llm["response_mode"] = "streaming"
global.GVA_LOG.Info("LLMAutoSSE 收到请求", zap.Any("mode", llm["mode"]))
if err := autoApi.streamLLMAsSSE(c, llm); err != nil {
global.GVA_LOG.Error("大模型 SSE 代理失败!", zap.Error(err))
if c.Writer.Written() {
writeLLMStreamError(c, err)
return
}
response.FailWithMessage(err.Error(), c)
}
}
func (autoApi *AutoCodeApi) streamLLMAsSSE(c *gin.Context, llm common.JSONMap) error {
res, err := autoCodeService.LLMAutoStream(c.Request.Context(), llm)
if err != nil {
return fmt.Errorf("调用上游大模型失败: %w", err)
}
defer res.Body.Close()
if res.StatusCode < 200 || res.StatusCode >= 300 {
body, readErr := io.ReadAll(res.Body)
if readErr != nil {
return fmt.Errorf("上游大模型流式服务返回非 2xx: status=%d content-type=%s read-body-err=%w", res.StatusCode, res.Header.Get("Content-Type"), readErr)
}
return fmt.Errorf("上游大模型流式服务返回非 2xx: status=%d content-type=%s body=%s", res.StatusCode, res.Header.Get("Content-Type"), previewResponseBody(body))
}
ct := res.Header.Get("Content-Type")
global.GVA_LOG.Info("LLMAutoSSE 上游返回成功,开始 SSE 流式转发",
zap.Int("status", res.StatusCode),
zap.String("content-type", ct))
// 如果上游返回的不是 SSE 流(可能是 blocking 模式返回的 JSON),直接读取并转发
if !strings.Contains(ct, "text/event-stream") && !strings.Contains(ct, "text/plain") {
body, readErr := io.ReadAll(res.Body)
if readErr != nil {
return fmt.Errorf("读取上游非流式响应失败: %w", readErr)
}
global.GVA_LOG.Warn("LLMAutoSSE 上游返回非 SSE 流,Content-Type: "+ct+", 将以单次事件转发",
zap.String("body_preview", previewResponseBody(body)))
flusher, ok := c.Writer.(http.Flusher)
if !ok {
return errors.New("当前响应不支持流式输出")
}
prepareSSEHeaders(c)
c.Status(http.StatusOK)
var payload any
if err := json.Unmarshal(body, &payload); err != nil {
payload = string(body)
}
if err := renderSSE(c, sse.Event{Event: "message", Data: payload}); err != nil {
return err
}
if err := renderSSE(c, sse.Event{Event: "done", Data: gin.H{"done": true}}); err != nil {
return err
}
flusher.Flush()
return nil
}
flusher, ok := c.Writer.(http.Flusher)
if !ok {
return errors.New("当前响应不支持流式输出")
}
prepareSSEHeaders(c)
c.Status(http.StatusOK)
flusher.Flush()
reader := bufio.NewReader(res.Body)
lines := make([]string, 0, 8)
blockCount := 0
global.GVA_LOG.Info("LLMAutoSSE 开始读取上游流数据...")
for {
global.GVA_LOG.Debug("LLMAutoSSE 等待读取下一行...")
line, readErr := reader.ReadString('\n')
if readErr != nil && !errors.Is(readErr, io.EOF) {
global.GVA_LOG.Error("LLMAutoSSE 读取上游流失败", zap.Int("已转发块数", blockCount), zap.Error(readErr))
return fmt.Errorf("读取上游流式响应失败: %w", readErr)
}
line = strings.TrimRight(line, "\r\n")
if line == "" {
if len(lines) > 0 {
blockCount++
if blockCount <= 3 {
global.GVA_LOG.Debug("LLMAutoSSE 转发 SSE 块", zap.Int("block", blockCount), zap.Strings("lines", lines))
}
}
if err := emitSSEBlock(c, lines); err != nil {
return err
}
lines = lines[:0]
} else {
lines = append(lines, line)
}
if errors.Is(readErr, io.EOF) {
if err := emitSSEBlock(c, lines); err != nil {
return err
}
if err := renderSSE(c, sse.Event{
Event: "done",
Data: gin.H{"done": true},
}); err != nil {
return err
}
flusher.Flush()
global.GVA_LOG.Info("LLMAutoSSE 流式转发完成", zap.Int("总块数", blockCount))
return nil
}
}
}
func prepareSSEHeaders(c *gin.Context) {
header := c.Writer.Header()
header.Set("Content-Type", "text/event-stream; charset=utf-8")
header.Set("Cache-Control", "no-cache, no-transform")
header.Set("Connection", "keep-alive")
header.Set("X-Accel-Buffering", "no")
}
func emitSSEBlock(c *gin.Context, lines []string) error {
if len(lines) == 0 {
return nil
}
eventName := "message"
eventID := ""
dataLines := make([]string, 0, len(lines))
for _, line := range lines {
switch {
case strings.HasPrefix(line, "event:"):
eventName = strings.TrimSpace(strings.TrimPrefix(line, "event:"))
case strings.HasPrefix(line, "id:"):
eventID = strings.TrimSpace(strings.TrimPrefix(line, "id:"))
case strings.HasPrefix(line, "data:"):
dataLines = append(dataLines, strings.TrimSpace(strings.TrimPrefix(line, "data:")))
}
}
rawData := strings.TrimSpace(strings.Join(dataLines, "\n"))
if rawData == "" {
return nil
}
if rawData == "[DONE]" {
return renderSSE(c, sse.Event{
Id: eventID,
Event: "done",
Data: gin.H{"done": true},
})
}
var payload interface{}
if err := json.Unmarshal([]byte(rawData), &payload); err != nil {
payload = rawData
}
return renderSSE(c, sse.Event{
Id: eventID,
Event: eventName,
Data: payload,
})
}
func renderSSE(c *gin.Context, event sse.Event) error {
if err := event.Render(c.Writer); err != nil {
return fmt.Errorf("写入 SSE 事件失败: %w", err)
}
if flusher, ok := c.Writer.(http.Flusher); ok {
flusher.Flush()
}
return nil
}
+1 -1
View File
@@ -44,7 +44,7 @@ func (b *BaseApi) Captcha(c *gin.Context) {
driver := base64Captcha.NewDriverDigit(global.GVA_CONFIG.Captcha.ImgHeight, global.GVA_CONFIG.Captcha.ImgWidth, global.GVA_CONFIG.Captcha.KeyLong, 0.7, 80)
// cp := base64Captcha.NewCaptcha(driver, store.UseWithCtx(c)) // v8下使用redis
cp := base64Captcha.NewCaptcha(driver, store)
id, b64s, err := cp.Generate()
id, b64s, _, err := cp.Generate()
if err != nil {
global.GVA_LOG.Error("验证码获取失败!", zap.Error(err))
response.FailWithMessage("验证码获取失败", c)
+2 -1
View File
@@ -33,7 +33,8 @@ func (cas *CasbinApi) UpdateCasbin(c *gin.Context) {
response.FailWithMessage(err.Error(), c)
return
}
err = casbinService.UpdateCasbin(cmr.AuthorityId, cmr.CasbinInfos)
adminAuthorityID := utils.GetUserAuthorityId(c)
err = casbinService.UpdateCasbin(adminAuthorityID, cmr.AuthorityId, cmr.CasbinInfos)
if err != nil {
global.GVA_LOG.Error("更新失败!", zap.Error(err))
response.FailWithMessage("更新失败", c)
-71
View File
@@ -1,71 +0,0 @@
package system
import (
"github.com/flipped-aurora/gin-vue-admin/server/global"
"github.com/flipped-aurora/gin-vue-admin/server/model/common/response"
sysModel "github.com/flipped-aurora/gin-vue-admin/server/model/system"
"github.com/flipped-aurora/gin-vue-admin/server/model/system/request"
"github.com/gin-gonic/gin"
"go.uber.org/zap"
)
type ChatGptApi struct{}
func (chat *ChatGptApi) CreateSK(c *gin.Context) {
var option sysModel.SysChatGptOption
c.ShouldBindJSON(&option)
err := chatGptService.CreateSK(option)
if err != nil {
global.GVA_LOG.Error("创建失败!", zap.Error(err))
response.FailWithMessage("创建失败"+err.Error(), c)
return
}
response.OkWithMessage("创建成功", c)
}
func (chat *ChatGptApi) GetSK(c *gin.Context) {
var option sysModel.SysChatGptOption
c.ShouldBindJSON(&option)
_, err := chatGptService.GetSK()
if err != nil {
response.OkWithDetailed(gin.H{
"ok": false,
}, "无sk或获取失败", c)
return
}
response.OkWithDetailed(gin.H{
"ok": true,
}, "获取成功", c)
}
func (chat *ChatGptApi) DeleteSK(c *gin.Context) {
err := chatGptService.DeleteSK()
if err != nil {
global.GVA_LOG.Error("删除失败!", zap.Error(err))
response.FailWithMessage("删除失败"+err.Error(), c)
return
}
response.OkWithMessage("删除成功", c)
}
func (chat *ChatGptApi) GetTable(c *gin.Context) {
var req request.ChatGptRequest
err := c.ShouldBindJSON(&req)
if err != nil {
response.FailWithMessage(err.Error(), c)
return
}
sql, results, err := chatGptService.GetTable(req)
if err != nil {
global.GVA_LOG.Error("查询失败!", zap.Error(err))
response.FailWithDetailed(gin.H{
"sql": sql,
"results": results,
}, "生成失败"+err.Error(), c)
return
}
response.OkWithDetailed(gin.H{
"sql": sql,
"results": results,
}, "ChatGpt生成完成", c)
}
+59 -16
View File
@@ -5,7 +5,6 @@ import (
"github.com/flipped-aurora/gin-vue-admin/server/model/common/response"
"github.com/flipped-aurora/gin-vue-admin/server/model/system"
"github.com/flipped-aurora/gin-vue-admin/server/model/system/request"
"github.com/flipped-aurora/gin-vue-admin/server/utils"
"github.com/gin-gonic/gin"
"go.uber.org/zap"
)
@@ -118,31 +117,75 @@ func (s *DictionaryApi) FindSysDictionary(c *gin.Context) {
// @Security ApiKeyAuth
// @accept application/json
// @Produce application/json
// @Param data query request.SysDictionarySearch true "页码, 每页大小, 搜索条件"
// @Param data query request.SysDictionarySearch true "字典 name 或者 type"
// @Success 200 {object} response.Response{data=response.PageResult,msg=string} "分页获取SysDictionary列表,返回包括列表,总数,页码,每页数量"
// @Router /sysDictionary/getSysDictionaryList [get]
func (s *DictionaryApi) GetSysDictionaryList(c *gin.Context) {
var pageInfo request.SysDictionarySearch
err := c.ShouldBindQuery(&pageInfo)
var dictionary request.SysDictionarySearch
err := c.ShouldBindQuery(&dictionary)
if err != nil {
response.FailWithMessage(err.Error(), c)
return
}
err = utils.Verify(pageInfo.PageInfo, utils.PageInfoVerify)
if err != nil {
response.FailWithMessage(err.Error(), c)
return
}
list, total, err := dictionaryService.GetSysDictionaryInfoList(pageInfo)
list, err := dictionaryService.GetSysDictionaryInfoList(c, dictionary)
if err != nil {
global.GVA_LOG.Error("获取失败!", zap.Error(err))
response.FailWithMessage("获取失败", c)
return
}
response.OkWithDetailed(response.PageResult{
List: list,
Total: total,
Page: pageInfo.Page,
PageSize: pageInfo.PageSize,
}, "获取成功", c)
response.OkWithDetailed(list, "获取成功", c)
}
// ExportSysDictionary
// @Tags SysDictionary
// @Summary 导出字典JSON(包含字典详情)
// @Security ApiKeyAuth
// @accept application/json
// @Produce application/json
// @Param data query system.SysDictionary true "字典ID"
// @Success 200 {object} response.Response{data=map[string]interface{},msg=string} "导出字典JSON"
// @Router /sysDictionary/exportSysDictionary [get]
func (s *DictionaryApi) ExportSysDictionary(c *gin.Context) {
var dictionary system.SysDictionary
err := c.ShouldBindQuery(&dictionary)
if err != nil {
response.FailWithMessage(err.Error(), c)
return
}
if dictionary.ID == 0 {
response.FailWithMessage("字典ID不能为空", c)
return
}
exportData, err := dictionaryService.ExportSysDictionary(dictionary.ID)
if err != nil {
global.GVA_LOG.Error("导出失败!", zap.Error(err))
response.FailWithMessage("导出失败", c)
return
}
response.OkWithDetailed(exportData, "导出成功", c)
}
// ImportSysDictionary
// @Tags SysDictionary
// @Summary 导入字典JSON(包含字典详情)
// @Security ApiKeyAuth
// @accept application/json
// @Produce application/json
// @Param data body request.ImportSysDictionaryRequest true "字典JSON数据"
// @Success 200 {object} response.Response{msg=string} "导入字典"
// @Router /sysDictionary/importSysDictionary [post]
func (s *DictionaryApi) ImportSysDictionary(c *gin.Context) {
var req request.ImportSysDictionaryRequest
err := c.ShouldBindJSON(&req)
if err != nil {
response.FailWithMessage(err.Error(), c)
return
}
err = dictionaryService.ImportSysDictionary(req.Json)
if err != nil {
global.GVA_LOG.Error("导入失败!", zap.Error(err))
response.FailWithMessage("导入失败: "+err.Error(), c)
return
}
response.OkWithMessage("导入成功", c)
}
@@ -1,6 +1,8 @@
package system
import (
"strconv"
"github.com/flipped-aurora/gin-vue-admin/server/global"
"github.com/flipped-aurora/gin-vue-admin/server/model/common/response"
"github.com/flipped-aurora/gin-vue-admin/server/model/system"
@@ -146,3 +148,120 @@ func (s *DictionaryDetailApi) GetSysDictionaryDetailList(c *gin.Context) {
PageSize: pageInfo.PageSize,
}, "获取成功", c)
}
// GetDictionaryTreeList
// @Tags SysDictionaryDetail
// @Summary 获取字典详情树形结构
// @Security ApiKeyAuth
// @accept application/json
// @Produce application/json
// @Param sysDictionaryID query int true "字典ID"
// @Success 200 {object} response.Response{data=[]system.SysDictionaryDetail,msg=string} "获取字典详情树形结构"
// @Router /sysDictionaryDetail/getDictionaryTreeList [get]
func (s *DictionaryDetailApi) GetDictionaryTreeList(c *gin.Context) {
sysDictionaryID := c.Query("sysDictionaryID")
if sysDictionaryID == "" {
response.FailWithMessage("字典ID不能为空", c)
return
}
var id uint
if idUint64, err := strconv.ParseUint(sysDictionaryID, 10, 32); err != nil {
response.FailWithMessage("字典ID格式错误", c)
return
} else {
id = uint(idUint64)
}
list, err := dictionaryDetailService.GetDictionaryTreeList(id)
if err != nil {
global.GVA_LOG.Error("获取失败!", zap.Error(err))
response.FailWithMessage("获取失败", c)
return
}
response.OkWithDetailed(gin.H{"list": list}, "获取成功", c)
}
// GetDictionaryTreeListByType
// @Tags SysDictionaryDetail
// @Summary 根据字典类型获取字典详情树形结构
// @Security ApiKeyAuth
// @accept application/json
// @Produce application/json
// @Param type query string true "字典类型"
// @Success 200 {object} response.Response{data=[]system.SysDictionaryDetail,msg=string} "获取字典详情树形结构"
// @Router /sysDictionaryDetail/getDictionaryTreeListByType [get]
func (s *DictionaryDetailApi) GetDictionaryTreeListByType(c *gin.Context) {
dictType := c.Query("type")
if dictType == "" {
response.FailWithMessage("字典类型不能为空", c)
return
}
list, err := dictionaryDetailService.GetDictionaryTreeListByType(dictType)
if err != nil {
global.GVA_LOG.Error("获取失败!", zap.Error(err))
response.FailWithMessage("获取失败", c)
return
}
response.OkWithDetailed(gin.H{"list": list}, "获取成功", c)
}
// GetDictionaryDetailsByParent
// @Tags SysDictionaryDetail
// @Summary 根据父级ID获取字典详情
// @Security ApiKeyAuth
// @accept application/json
// @Produce application/json
// @Param data query request.GetDictionaryDetailsByParentRequest true "查询参数"
// @Success 200 {object} response.Response{data=[]system.SysDictionaryDetail,msg=string} "获取字典详情列表"
// @Router /sysDictionaryDetail/getDictionaryDetailsByParent [get]
func (s *DictionaryDetailApi) GetDictionaryDetailsByParent(c *gin.Context) {
var req request.GetDictionaryDetailsByParentRequest
err := c.ShouldBindQuery(&req)
if err != nil {
response.FailWithMessage(err.Error(), c)
return
}
list, err := dictionaryDetailService.GetDictionaryDetailsByParent(req)
if err != nil {
global.GVA_LOG.Error("获取失败!", zap.Error(err))
response.FailWithMessage("获取失败", c)
return
}
response.OkWithDetailed(gin.H{"list": list}, "获取成功", c)
}
// GetDictionaryPath
// @Tags SysDictionaryDetail
// @Summary 获取字典详情的完整路径
// @Security ApiKeyAuth
// @accept application/json
// @Produce application/json
// @Param id query uint true "字典详情ID"
// @Success 200 {object} response.Response{data=[]system.SysDictionaryDetail,msg=string} "获取字典详情路径"
// @Router /sysDictionaryDetail/getDictionaryPath [get]
func (s *DictionaryDetailApi) GetDictionaryPath(c *gin.Context) {
idStr := c.Query("id")
if idStr == "" {
response.FailWithMessage("字典详情ID不能为空", c)
return
}
var id uint
if idUint64, err := strconv.ParseUint(idStr, 10, 32); err != nil {
response.FailWithMessage("字典详情ID格式错误", c)
return
} else {
id = uint(idUint64)
}
path, err := dictionaryDetailService.GetDictionaryPath(id)
if err != nil {
global.GVA_LOG.Error("获取失败!", zap.Error(err))
response.FailWithMessage("获取失败", c)
return
}
response.OkWithDetailed(gin.H{"path": path}, "获取成功", c)
}
+199
View File
@@ -0,0 +1,199 @@
package system
import (
"github.com/flipped-aurora/gin-vue-admin/server/global"
"github.com/flipped-aurora/gin-vue-admin/server/model/common/response"
"github.com/flipped-aurora/gin-vue-admin/server/model/system"
systemReq "github.com/flipped-aurora/gin-vue-admin/server/model/system/request"
"github.com/gin-gonic/gin"
"go.uber.org/zap"
)
type SysErrorApi struct{}
// CreateSysError 创建错误日志
// @Tags SysError
// @Summary 创建错误日志
// @Security ApiKeyAuth
// @Accept application/json
// @Produce application/json
// @Param data body system.SysError true "创建错误日志"
// @Success 200 {object} response.Response{msg=string} "创建成功"
// @Router /sysError/createSysError [post]
func (sysErrorApi *SysErrorApi) CreateSysError(c *gin.Context) {
// 创建业务用Context
ctx := c.Request.Context()
var sysError system.SysError
err := c.ShouldBindJSON(&sysError)
if err != nil {
response.FailWithMessage(err.Error(), c)
return
}
err = sysErrorService.CreateSysError(ctx, &sysError)
if err != nil {
global.GVA_LOG.Error("创建失败!", zap.Error(err))
response.FailWithMessage("创建失败:"+err.Error(), c)
return
}
response.OkWithMessage("创建成功", c)
}
// DeleteSysError 删除错误日志
// @Tags SysError
// @Summary 删除错误日志
// @Security ApiKeyAuth
// @Accept application/json
// @Produce application/json
// @Param data body system.SysError true "删除错误日志"
// @Success 200 {object} response.Response{msg=string} "删除成功"
// @Router /sysError/deleteSysError [delete]
func (sysErrorApi *SysErrorApi) DeleteSysError(c *gin.Context) {
// 创建业务用Context
ctx := c.Request.Context()
ID := c.Query("ID")
err := sysErrorService.DeleteSysError(ctx, ID)
if err != nil {
global.GVA_LOG.Error("删除失败!", zap.Error(err))
response.FailWithMessage("删除失败:"+err.Error(), c)
return
}
response.OkWithMessage("删除成功", c)
}
// DeleteSysErrorByIds 批量删除错误日志
// @Tags SysError
// @Summary 批量删除错误日志
// @Security ApiKeyAuth
// @Accept application/json
// @Produce application/json
// @Success 200 {object} response.Response{msg=string} "批量删除成功"
// @Router /sysError/deleteSysErrorByIds [delete]
func (sysErrorApi *SysErrorApi) DeleteSysErrorByIds(c *gin.Context) {
// 创建业务用Context
ctx := c.Request.Context()
IDs := c.QueryArray("IDs[]")
err := sysErrorService.DeleteSysErrorByIds(ctx, IDs)
if err != nil {
global.GVA_LOG.Error("批量删除失败!", zap.Error(err))
response.FailWithMessage("批量删除失败:"+err.Error(), c)
return
}
response.OkWithMessage("批量删除成功", c)
}
// UpdateSysError 更新错误日志
// @Tags SysError
// @Summary 更新错误日志
// @Security ApiKeyAuth
// @Accept application/json
// @Produce application/json
// @Param data body system.SysError true "更新错误日志"
// @Success 200 {object} response.Response{msg=string} "更新成功"
// @Router /sysError/updateSysError [put]
func (sysErrorApi *SysErrorApi) UpdateSysError(c *gin.Context) {
// 从ctx获取标准context进行业务行为
ctx := c.Request.Context()
var sysError system.SysError
err := c.ShouldBindJSON(&sysError)
if err != nil {
response.FailWithMessage(err.Error(), c)
return
}
err = sysErrorService.UpdateSysError(ctx, sysError)
if err != nil {
global.GVA_LOG.Error("更新失败!", zap.Error(err))
response.FailWithMessage("更新失败:"+err.Error(), c)
return
}
response.OkWithMessage("更新成功", c)
}
// FindSysError 用id查询错误日志
// @Tags SysError
// @Summary 用id查询错误日志
// @Security ApiKeyAuth
// @Accept application/json
// @Produce application/json
// @Param ID query uint true "用id查询错误日志"
// @Success 200 {object} response.Response{data=system.SysError,msg=string} "查询成功"
// @Router /sysError/findSysError [get]
func (sysErrorApi *SysErrorApi) FindSysError(c *gin.Context) {
// 创建业务用Context
ctx := c.Request.Context()
ID := c.Query("ID")
resysError, err := sysErrorService.GetSysError(ctx, ID)
if err != nil {
global.GVA_LOG.Error("查询失败!", zap.Error(err))
response.FailWithMessage("查询失败:"+err.Error(), c)
return
}
response.OkWithData(resysError, c)
}
// GetSysErrorList 分页获取错误日志列表
// @Tags SysError
// @Summary 分页获取错误日志列表
// @Security ApiKeyAuth
// @Accept application/json
// @Produce application/json
// @Param data query systemReq.SysErrorSearch true "分页获取错误日志列表"
// @Success 200 {object} response.Response{data=response.PageResult,msg=string} "获取成功"
// @Router /sysError/getSysErrorList [get]
func (sysErrorApi *SysErrorApi) GetSysErrorList(c *gin.Context) {
// 创建业务用Context
ctx := c.Request.Context()
var pageInfo systemReq.SysErrorSearch
err := c.ShouldBindQuery(&pageInfo)
if err != nil {
response.FailWithMessage(err.Error(), c)
return
}
list, total, err := sysErrorService.GetSysErrorInfoList(ctx, pageInfo)
if err != nil {
global.GVA_LOG.Error("获取失败!", zap.Error(err))
response.FailWithMessage("获取失败:"+err.Error(), c)
return
}
response.OkWithDetailed(response.PageResult{
List: list,
Total: total,
Page: pageInfo.Page,
PageSize: pageInfo.PageSize,
}, "获取成功", c)
}
// GetSysErrorSolution 触发错误日志的异步处理
// @Tags SysError
// @Summary 根据ID触发处理:标记为处理中,1分钟后自动改为处理完成
// @Security ApiKeyAuth
// @Accept application/json
// @Produce application/json
// @Param id query string true "错误日志ID"
// @Success 200 {object} response.Response{msg=string} "处理已提交"
// @Router /sysError/getSysErrorSolution [get]
func (sysErrorApi *SysErrorApi) GetSysErrorSolution(c *gin.Context) {
// 创建业务用Context
ctx := c.Request.Context()
// 兼容 id 与 ID 两种参数
ID := c.Query("id")
if ID == "" {
response.FailWithMessage("缺少参数: id", c)
return
}
err := sysErrorService.GetSysErrorSolution(ctx, ID)
if err != nil {
global.GVA_LOG.Error("处理触发失败!", zap.Error(err))
response.FailWithMessage("处理触发失败:"+err.Error(), c)
return
}
response.OkWithMessage("已提交至AI处理", c)
}
+456
View File
@@ -0,0 +1,456 @@
package system
import (
"fmt"
"net/http"
"net/url"
"sync"
"time"
"github.com/flipped-aurora/gin-vue-admin/server/global"
"github.com/flipped-aurora/gin-vue-admin/server/model/common/request"
"github.com/flipped-aurora/gin-vue-admin/server/model/common/response"
"github.com/flipped-aurora/gin-vue-admin/server/model/system"
systemReq "github.com/flipped-aurora/gin-vue-admin/server/model/system/request"
"github.com/flipped-aurora/gin-vue-admin/server/service"
"github.com/flipped-aurora/gin-vue-admin/server/utils"
"github.com/gin-gonic/gin"
"go.uber.org/zap"
)
// 用于token一次性存储
var (
exportTokenCache = make(map[string]interface{})
exportTokenExpiration = make(map[string]time.Time)
tokenMutex sync.RWMutex
)
// 五分钟检测窗口过期
func cleanupExpiredTokens() {
for {
time.Sleep(5 * time.Minute)
tokenMutex.Lock()
now := time.Now()
for token, expiry := range exportTokenExpiration {
if now.After(expiry) {
delete(exportTokenCache, token)
delete(exportTokenExpiration, token)
}
}
tokenMutex.Unlock()
}
}
func init() {
go cleanupExpiredTokens()
}
type SysExportTemplateApi struct {
}
var sysExportTemplateService = service.ServiceGroupApp.SystemServiceGroup.SysExportTemplateService
// PreviewSQL 预览最终生成的SQL
// @Tags SysExportTemplate
// @Summary 预览最终生成的SQL(不执行查询,仅返回SQL字符串)
// @Security ApiKeyAuth
// @accept application/json
// @Produce application/json
// @Param templateID query string true "导出模板ID"
// @Param params query string false "查询参数编码字符串,参考 ExportExcel 组件"
// @Success 200 {object} response.Response{data=map[string]string} "获取成功"
// @Router /sysExportTemplate/previewSQL [get]
func (sysExportTemplateApi *SysExportTemplateApi) PreviewSQL(c *gin.Context) {
templateID := c.Query("templateID")
if templateID == "" {
response.FailWithMessage("模板ID不能为空", c)
return
}
// 直接复用导出接口的参数组织方式:使用 URL Query,其中 params 为内部编码的查询字符串
queryParams := c.Request.URL.Query()
if sqlPreview, err := sysExportTemplateService.PreviewSQL(templateID, queryParams); err != nil {
global.GVA_LOG.Error("获取失败!", zap.Error(err))
response.FailWithMessage("获取失败", c)
} else {
response.OkWithData(gin.H{"sql": sqlPreview}, c)
}
}
// CreateSysExportTemplate 创建导出模板
// @Tags SysExportTemplate
// @Summary 创建导出模板
// @Security ApiKeyAuth
// @accept application/json
// @Produce application/json
// @Param data body system.SysExportTemplate true "创建导出模板"
// @Success 200 {string} string "{"success":true,"data":{},"msg":"创建成功"}"
// @Router /sysExportTemplate/createSysExportTemplate [post]
func (sysExportTemplateApi *SysExportTemplateApi) CreateSysExportTemplate(c *gin.Context) {
var sysExportTemplate system.SysExportTemplate
err := c.ShouldBindJSON(&sysExportTemplate)
if err != nil {
response.FailWithMessage(err.Error(), c)
return
}
verify := utils.Rules{
"Name": {utils.NotEmpty()},
}
if err := utils.Verify(sysExportTemplate, verify); err != nil {
response.FailWithMessage(err.Error(), c)
return
}
if err := sysExportTemplateService.CreateSysExportTemplate(&sysExportTemplate); err != nil {
global.GVA_LOG.Error("创建失败!", zap.Error(err))
response.FailWithMessage("创建失败", c)
} else {
response.OkWithMessage("创建成功", c)
}
}
// DeleteSysExportTemplate 删除导出模板
// @Tags SysExportTemplate
// @Summary 删除导出模板
// @Security ApiKeyAuth
// @accept application/json
// @Produce application/json
// @Param data body system.SysExportTemplate true "删除导出模板"
// @Success 200 {string} string "{"success":true,"data":{},"msg":"删除成功"}"
// @Router /sysExportTemplate/deleteSysExportTemplate [delete]
func (sysExportTemplateApi *SysExportTemplateApi) DeleteSysExportTemplate(c *gin.Context) {
var sysExportTemplate system.SysExportTemplate
err := c.ShouldBindJSON(&sysExportTemplate)
if err != nil {
response.FailWithMessage(err.Error(), c)
return
}
if err := sysExportTemplateService.DeleteSysExportTemplate(sysExportTemplate); err != nil {
global.GVA_LOG.Error("删除失败!", zap.Error(err))
response.FailWithMessage("删除失败", c)
} else {
response.OkWithMessage("删除成功", c)
}
}
// DeleteSysExportTemplateByIds 批量删除导出模板
// @Tags SysExportTemplate
// @Summary 批量删除导出模板
// @Security ApiKeyAuth
// @accept application/json
// @Produce application/json
// @Param data body request.IdsReq true "批量删除导出模板"
// @Success 200 {string} string "{"success":true,"data":{},"msg":"批量删除成功"}"
// @Router /sysExportTemplate/deleteSysExportTemplateByIds [delete]
func (sysExportTemplateApi *SysExportTemplateApi) DeleteSysExportTemplateByIds(c *gin.Context) {
var IDS request.IdsReq
err := c.ShouldBindJSON(&IDS)
if err != nil {
response.FailWithMessage(err.Error(), c)
return
}
if err := sysExportTemplateService.DeleteSysExportTemplateByIds(IDS); err != nil {
global.GVA_LOG.Error("批量删除失败!", zap.Error(err))
response.FailWithMessage("批量删除失败", c)
} else {
response.OkWithMessage("批量删除成功", c)
}
}
// UpdateSysExportTemplate 更新导出模板
// @Tags SysExportTemplate
// @Summary 更新导出模板
// @Security ApiKeyAuth
// @accept application/json
// @Produce application/json
// @Param data body system.SysExportTemplate true "更新导出模板"
// @Success 200 {string} string "{"success":true,"data":{},"msg":"更新成功"}"
// @Router /sysExportTemplate/updateSysExportTemplate [put]
func (sysExportTemplateApi *SysExportTemplateApi) UpdateSysExportTemplate(c *gin.Context) {
var sysExportTemplate system.SysExportTemplate
err := c.ShouldBindJSON(&sysExportTemplate)
if err != nil {
response.FailWithMessage(err.Error(), c)
return
}
verify := utils.Rules{
"Name": {utils.NotEmpty()},
}
if err := utils.Verify(sysExportTemplate, verify); err != nil {
response.FailWithMessage(err.Error(), c)
return
}
if err := sysExportTemplateService.UpdateSysExportTemplate(sysExportTemplate); err != nil {
global.GVA_LOG.Error("更新失败!", zap.Error(err))
response.FailWithMessage("更新失败", c)
} else {
response.OkWithMessage("更新成功", c)
}
}
// FindSysExportTemplate 用id查询导出模板
// @Tags SysExportTemplate
// @Summary 用id查询导出模板
// @Security ApiKeyAuth
// @accept application/json
// @Produce application/json
// @Param data query system.SysExportTemplate true "用id查询导出模板"
// @Success 200 {string} string "{"success":true,"data":{},"msg":"查询成功"}"
// @Router /sysExportTemplate/findSysExportTemplate [get]
func (sysExportTemplateApi *SysExportTemplateApi) FindSysExportTemplate(c *gin.Context) {
var sysExportTemplate system.SysExportTemplate
err := c.ShouldBindQuery(&sysExportTemplate)
if err != nil {
response.FailWithMessage(err.Error(), c)
return
}
if resysExportTemplate, err := sysExportTemplateService.GetSysExportTemplate(sysExportTemplate.ID); err != nil {
global.GVA_LOG.Error("查询失败!", zap.Error(err))
response.FailWithMessage("查询失败", c)
} else {
response.OkWithData(gin.H{"resysExportTemplate": resysExportTemplate}, c)
}
}
// GetSysExportTemplateList 分页获取导出模板列表
// @Tags SysExportTemplate
// @Summary 分页获取导出模板列表
// @Security ApiKeyAuth
// @accept application/json
// @Produce application/json
// @Param data query systemReq.SysExportTemplateSearch true "分页获取导出模板列表"
// @Success 200 {string} string "{"success":true,"data":{},"msg":"获取成功"}"
// @Router /sysExportTemplate/getSysExportTemplateList [get]
func (sysExportTemplateApi *SysExportTemplateApi) GetSysExportTemplateList(c *gin.Context) {
var pageInfo systemReq.SysExportTemplateSearch
err := c.ShouldBindQuery(&pageInfo)
if err != nil {
response.FailWithMessage(err.Error(), c)
return
}
if list, total, err := sysExportTemplateService.GetSysExportTemplateInfoList(pageInfo); err != nil {
global.GVA_LOG.Error("获取失败!", zap.Error(err))
response.FailWithMessage("获取失败", c)
} else {
response.OkWithDetailed(response.PageResult{
List: list,
Total: total,
Page: pageInfo.Page,
PageSize: pageInfo.PageSize,
}, "获取成功", c)
}
}
// ExportExcel 导出表格token
// @Tags SysExportTemplate
// @Summary 导出表格
// @Security ApiKeyAuth
// @accept application/json
// @Produce application/json
// @Router /sysExportTemplate/exportExcel [get]
func (sysExportTemplateApi *SysExportTemplateApi) ExportExcel(c *gin.Context) {
templateID := c.Query("templateID")
if templateID == "" {
response.FailWithMessage("模板ID不能为空", c)
return
}
queryParams := c.Request.URL.Query()
//创造一次性token
token := utils.RandomString(32) // 随机32位
// 记录本次请求参数
exportParams := map[string]interface{}{
"templateID": templateID,
"queryParams": queryParams,
}
// 参数保留记录完成鉴权
tokenMutex.Lock()
exportTokenCache[token] = exportParams
exportTokenExpiration[token] = time.Now().Add(30 * time.Minute)
tokenMutex.Unlock()
// 生成一次性链接
exportUrl := fmt.Sprintf("/sysExportTemplate/exportExcelByToken?token=%s", token)
response.OkWithData(exportUrl, c)
}
// ExportExcelByToken 导出表格
// @Tags ExportExcelByToken
// @Summary 导出表格
// @Security ApiKeyAuth
// @accept application/json
// @Produce application/json
// @Router /sysExportTemplate/exportExcelByToken [get]
func (sysExportTemplateApi *SysExportTemplateApi) ExportExcelByToken(c *gin.Context) {
token := c.Query("token")
if token == "" {
response.FailWithMessage("导出token不能为空", c)
return
}
// 获取token并且从缓存中剔除
tokenMutex.RLock()
exportParamsRaw, exists := exportTokenCache[token]
expiry, _ := exportTokenExpiration[token]
tokenMutex.RUnlock()
if !exists || time.Now().After(expiry) {
global.GVA_LOG.Error("导出token无效或已过期!")
response.FailWithMessage("导出token无效或已过期", c)
return
}
// 从token获取参数
exportParams, ok := exportParamsRaw.(map[string]interface{})
if !ok {
global.GVA_LOG.Error("解析导出参数失败!")
response.FailWithMessage("解析导出参数失败", c)
return
}
// 获取导出参数
templateID := exportParams["templateID"].(string)
queryParams := exportParams["queryParams"].(url.Values)
// 清理一次性token
tokenMutex.Lock()
delete(exportTokenCache, token)
delete(exportTokenExpiration, token)
tokenMutex.Unlock()
// 导出
if file, name, err := sysExportTemplateService.ExportExcel(templateID, queryParams); err != nil {
global.GVA_LOG.Error("获取失败!", zap.Error(err))
response.FailWithMessage("获取失败", c)
} else {
c.Header("Content-Disposition", fmt.Sprintf("attachment; filename=%s", name+utils.RandomString(6)+".xlsx"))
c.Header("success", "true")
c.Data(http.StatusOK, "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", file.Bytes())
}
}
// ExportTemplate 导出表格模板
// @Tags SysExportTemplate
// @Summary 导出表格模板
// @Security ApiKeyAuth
// @accept application/json
// @Produce application/json
// @Router /sysExportTemplate/exportTemplate [get]
func (sysExportTemplateApi *SysExportTemplateApi) ExportTemplate(c *gin.Context) {
templateID := c.Query("templateID")
if templateID == "" {
response.FailWithMessage("模板ID不能为空", c)
return
}
// 创造一次性token
token := utils.RandomString(32) // 随机32位
// 记录本次请求参数
exportParams := map[string]interface{}{
"templateID": templateID,
"isTemplate": true,
}
// 参数保留记录完成鉴权
tokenMutex.Lock()
exportTokenCache[token] = exportParams
exportTokenExpiration[token] = time.Now().Add(30 * time.Minute)
tokenMutex.Unlock()
// 生成一次性链接
exportUrl := fmt.Sprintf("/sysExportTemplate/exportTemplateByToken?token=%s", token)
response.OkWithData(exportUrl, c)
}
// ExportTemplateByToken 通过token导出表格模板
// @Tags ExportTemplateByToken
// @Summary 通过token导出表格模板
// @Security ApiKeyAuth
// @accept application/json
// @Produce application/json
// @Router /sysExportTemplate/exportTemplateByToken [get]
func (sysExportTemplateApi *SysExportTemplateApi) ExportTemplateByToken(c *gin.Context) {
token := c.Query("token")
if token == "" {
response.FailWithMessage("导出token不能为空", c)
return
}
// 获取token并且从缓存中剔除
tokenMutex.RLock()
exportParamsRaw, exists := exportTokenCache[token]
expiry, _ := exportTokenExpiration[token]
tokenMutex.RUnlock()
if !exists || time.Now().After(expiry) {
global.GVA_LOG.Error("导出token无效或已过期!")
response.FailWithMessage("导出token无效或已过期", c)
return
}
// 从token获取参数
exportParams, ok := exportParamsRaw.(map[string]interface{})
if !ok {
global.GVA_LOG.Error("解析导出参数失败!")
response.FailWithMessage("解析导出参数失败", c)
return
}
// 检查是否为模板导出
isTemplate, _ := exportParams["isTemplate"].(bool)
if !isTemplate {
global.GVA_LOG.Error("token类型错误!")
response.FailWithMessage("token类型错误", c)
return
}
// 获取导出参数
templateID := exportParams["templateID"].(string)
// 清理一次性token
tokenMutex.Lock()
delete(exportTokenCache, token)
delete(exportTokenExpiration, token)
tokenMutex.Unlock()
// 导出模板
if file, name, err := sysExportTemplateService.ExportTemplate(templateID); err != nil {
global.GVA_LOG.Error("获取失败!", zap.Error(err))
response.FailWithMessage("获取失败", c)
} else {
c.Header("Content-Disposition", fmt.Sprintf("attachment; filename=%s", name+"模板.xlsx"))
c.Header("success", "true")
c.Data(http.StatusOK, "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", file.Bytes())
}
}
// ImportExcel 导入表格
// @Tags SysImportTemplate
// @Summary 导入表格
// @Security ApiKeyAuth
// @accept application/json
// @Produce application/json
// @Router /sysExportTemplate/importExcel [post]
func (sysExportTemplateApi *SysExportTemplateApi) ImportExcel(c *gin.Context) {
templateID := c.Query("templateID")
if templateID == "" {
response.FailWithMessage("模板ID不能为空", c)
return
}
file, err := c.FormFile("file")
if err != nil {
global.GVA_LOG.Error("文件获取失败!", zap.Error(err))
response.FailWithMessage("文件获取失败", c)
return
}
if err := sysExportTemplateService.ImportExcel(templateID, file); err != nil {
global.GVA_LOG.Error(err.Error(), zap.Error(err))
response.FailWithMessage(err.Error(), c)
} else {
response.OkWithMessage("导入成功", c)
}
}
+3 -1
View File
@@ -4,6 +4,7 @@ import (
"github.com/flipped-aurora/gin-vue-admin/server/global"
"github.com/flipped-aurora/gin-vue-admin/server/model/common/response"
"github.com/flipped-aurora/gin-vue-admin/server/model/system"
"github.com/flipped-aurora/gin-vue-admin/server/utils"
"github.com/gin-gonic/gin"
"go.uber.org/zap"
)
@@ -19,7 +20,7 @@ type JwtApi struct{}
// @Success 200 {object} response.Response{msg=string} "jwt加入黑名单"
// @Router /jwt/jsonInBlacklist [post]
func (j *JwtApi) JsonInBlacklist(c *gin.Context) {
token := c.Request.Header.Get("x-token")
token := utils.GetToken(c)
jwt := system.JwtBlacklist{Jwt: token}
err := jwtService.JsonInBlacklist(jwt)
if err != nil {
@@ -27,5 +28,6 @@ func (j *JwtApi) JsonInBlacklist(c *gin.Context) {
response.FailWithMessage("jwt作废失败", c)
return
}
utils.ClearToken(c)
response.OkWithMessage("jwt作废成功", c)
}
+82
View File
@@ -0,0 +1,82 @@
package system
import (
"github.com/flipped-aurora/gin-vue-admin/server/global"
"github.com/flipped-aurora/gin-vue-admin/server/model/common/request"
"github.com/flipped-aurora/gin-vue-admin/server/model/common/response"
"github.com/flipped-aurora/gin-vue-admin/server/model/system"
systemReq "github.com/flipped-aurora/gin-vue-admin/server/model/system/request"
"github.com/gin-gonic/gin"
"go.uber.org/zap"
)
type LoginLogApi struct{}
func (s *LoginLogApi) DeleteLoginLog(c *gin.Context) {
var loginLog system.SysLoginLog
err := c.ShouldBindJSON(&loginLog)
if err != nil {
response.FailWithMessage(err.Error(), c)
return
}
err = loginLogService.DeleteLoginLog(loginLog)
if err != nil {
global.GVA_LOG.Error("删除失败!", zap.Error(err))
response.FailWithMessage("删除失败", c)
return
}
response.OkWithMessage("删除成功", c)
}
func (s *LoginLogApi) DeleteLoginLogByIds(c *gin.Context) {
var SDS request.IdsReq
err := c.ShouldBindJSON(&SDS)
if err != nil {
response.FailWithMessage(err.Error(), c)
return
}
err = loginLogService.DeleteLoginLogByIds(SDS)
if err != nil {
global.GVA_LOG.Error("批量删除失败!", zap.Error(err))
response.FailWithMessage("批量删除失败", c)
return
}
response.OkWithMessage("批量删除成功", c)
}
func (s *LoginLogApi) FindLoginLog(c *gin.Context) {
var loginLog system.SysLoginLog
err := c.ShouldBindQuery(&loginLog)
if err != nil {
response.FailWithMessage(err.Error(), c)
return
}
reLoginLog, err := loginLogService.GetLoginLog(loginLog.ID)
if err != nil {
global.GVA_LOG.Error("查询失败!", zap.Error(err))
response.FailWithMessage("查询失败", c)
return
}
response.OkWithDetailed(reLoginLog, "查询成功", c)
}
func (s *LoginLogApi) GetLoginLogList(c *gin.Context) {
var pageInfo systemReq.SysLoginLogSearch
err := c.ShouldBindQuery(&pageInfo)
if err != nil {
response.FailWithMessage(err.Error(), c)
return
}
list, total, err := loginLogService.GetLoginLogInfoList(pageInfo)
if err != nil {
global.GVA_LOG.Error("获取失败!", zap.Error(err))
response.FailWithMessage("获取失败", c)
return
}
response.OkWithDetailed(response.PageResult{
List: list,
Total: total,
Page: pageInfo.Page,
PageSize: pageInfo.PageSize,
}, "获取成功", c)
}
+79 -22
View File
@@ -45,7 +45,8 @@ func (a *AuthorityMenuApi) GetMenu(c *gin.Context) {
// @Success 200 {object} response.Response{data=systemRes.SysBaseMenusResponse,msg=string} "获取用户动态路由,返回包括系统菜单列表"
// @Router /menu/getBaseMenuTree [post]
func (a *AuthorityMenuApi) GetBaseMenuTree(c *gin.Context) {
menus, err := menuService.GetBaseMenuTree()
authority := utils.GetUserAuthorityId(c)
menus, err := menuService.GetBaseMenuTree(authority)
if err != nil {
global.GVA_LOG.Error("获取失败!", zap.Error(err))
response.FailWithMessage("获取失败", c)
@@ -74,7 +75,8 @@ func (a *AuthorityMenuApi) AddMenuAuthority(c *gin.Context) {
response.FailWithMessage(err.Error(), c)
return
}
if err := menuService.AddMenuAuthority(authorityMenu.Menus, authorityMenu.AuthorityId); err != nil {
adminAuthorityID := utils.GetUserAuthorityId(c)
if err := menuService.AddMenuAuthority(authorityMenu.Menus, adminAuthorityID, authorityMenu.AuthorityId); err != nil {
global.GVA_LOG.Error("添加失败!", zap.Error(err))
response.FailWithMessage("添加失败", c)
} else {
@@ -141,7 +143,7 @@ func (a *AuthorityMenuApi) AddBaseMenu(c *gin.Context) {
err = menuService.AddBaseMenu(menu)
if err != nil {
global.GVA_LOG.Error("添加失败!", zap.Error(err))
response.FailWithMessage("添加失败", c)
response.FailWithMessage("添加失败:"+err.Error(), c)
return
}
response.OkWithMessage("添加成功", c)
@@ -171,7 +173,7 @@ func (a *AuthorityMenuApi) DeleteBaseMenu(c *gin.Context) {
err = baseMenuService.DeleteBaseMenu(menu.ID)
if err != nil {
global.GVA_LOG.Error("删除失败!", zap.Error(err))
response.FailWithMessage("删除失败", c)
response.FailWithMessage("删除失败:"+err.Error(), c)
return
}
response.OkWithMessage("删除成功", c)
@@ -242,6 +244,76 @@ func (a *AuthorityMenuApi) GetBaseMenuById(c *gin.Context) {
response.OkWithDetailed(systemRes.SysBaseMenuResponse{Menu: menu}, "获取成功", c)
}
// GetMenuRoles
// @Tags AuthorityMenu
// @Summary 获取拥有指定菜单的角色ID列表
// @Security ApiKeyAuth
// @accept application/json
// @Produce application/json
// @Param menuId query uint true "菜单ID"
// @Success 200 {object} response.Response{data=map[string]interface{},msg=string} "获取成功"
// @Router /menu/getMenuRoles [get]
func (a *AuthorityMenuApi) GetMenuRoles(c *gin.Context) {
var req systemReq.SetMenuAuthorities
if err := c.ShouldBindQuery(&req); err != nil {
response.FailWithMessage(err.Error(), c)
return
}
if req.MenuId == 0 {
response.FailWithMessage("菜单ID不能为空", c)
return
}
authorityIds, err := menuService.GetAuthoritiesByMenuId(req.MenuId)
if err != nil {
global.GVA_LOG.Error("获取失败!", zap.Error(err))
response.FailWithMessage("获取失败"+err.Error(), c)
return
}
if authorityIds == nil {
authorityIds = []uint{}
}
defaultRouterAuthorityIds, err := menuService.GetDefaultRouterAuthorityIds(req.MenuId)
if err != nil {
global.GVA_LOG.Error("获取首页角色失败!", zap.Error(err))
response.FailWithMessage("获取失败"+err.Error(), c)
return
}
if defaultRouterAuthorityIds == nil {
defaultRouterAuthorityIds = []uint{}
}
response.OkWithDetailed(gin.H{
"authorityIds": authorityIds,
"defaultRouterAuthorityIds": defaultRouterAuthorityIds,
}, "获取成功", c)
}
// SetMenuRoles
// @Tags AuthorityMenu
// @Summary 全量覆盖某菜单关联的角色列表
// @Security ApiKeyAuth
// @accept application/json
// @Produce application/json
// @Param data body systemReq.SetMenuAuthorities true "菜单ID和角色ID列表"
// @Success 200 {object} response.Response{msg=string} "设置成功"
// @Router /menu/setMenuRoles [post]
func (a *AuthorityMenuApi) SetMenuRoles(c *gin.Context) {
var req systemReq.SetMenuAuthorities
if err := c.ShouldBindJSON(&req); err != nil {
response.FailWithMessage(err.Error(), c)
return
}
if req.MenuId == 0 {
response.FailWithMessage("菜单ID不能为空", c)
return
}
if err := menuService.SetMenuAuthorities(req.MenuId, req.AuthorityIds); err != nil {
global.GVA_LOG.Error("设置失败!", zap.Error(err))
response.FailWithMessage("设置失败"+err.Error(), c)
return
}
response.OkWithMessage("设置成功", c)
}
// GetMenuList
// @Tags Menu
// @Summary 分页获取基础menu列表
@@ -252,27 +324,12 @@ func (a *AuthorityMenuApi) GetBaseMenuById(c *gin.Context) {
// @Success 200 {object} response.Response{data=response.PageResult,msg=string} "分页获取基础menu列表,返回包括列表,总数,页码,每页数量"
// @Router /menu/getMenuList [post]
func (a *AuthorityMenuApi) GetMenuList(c *gin.Context) {
var pageInfo request.PageInfo
err := c.ShouldBindJSON(&pageInfo)
if err != nil {
response.FailWithMessage(err.Error(), c)
return
}
err = utils.Verify(pageInfo, utils.PageInfoVerify)
if err != nil {
response.FailWithMessage(err.Error(), c)
return
}
menuList, total, err := menuService.GetInfoList()
authorityID := utils.GetUserAuthorityId(c)
menuList, err := menuService.GetInfoList(authorityID)
if err != nil {
global.GVA_LOG.Error("获取失败!", zap.Error(err))
response.FailWithMessage("获取失败", c)
return
}
response.OkWithDetailed(response.PageResult{
List: menuList,
Total: total,
Page: pageInfo.Page,
PageSize: pageInfo.PageSize,
}, "获取成功", c)
response.OkWithDetailed(menuList, "获取成功", c)
}
@@ -13,31 +13,6 @@ import (
type OperationRecordApi struct{}
// CreateSysOperationRecord
// @Tags SysOperationRecord
// @Summary 创建SysOperationRecord
// @Security ApiKeyAuth
// @accept application/json
// @Produce application/json
// @Param data body system.SysOperationRecord true "创建SysOperationRecord"
// @Success 200 {object} response.Response{msg=string} "创建SysOperationRecord"
// @Router /sysOperationRecord/createSysOperationRecord [post]
func (s *OperationRecordApi) CreateSysOperationRecord(c *gin.Context) {
var sysOperationRecord system.SysOperationRecord
err := c.ShouldBindJSON(&sysOperationRecord)
if err != nil {
response.FailWithMessage(err.Error(), c)
return
}
err = operationRecordService.CreateSysOperationRecord(sysOperationRecord)
if err != nil {
global.GVA_LOG.Error("创建失败!", zap.Error(err))
response.FailWithMessage("创建失败", c)
return
}
response.OkWithMessage("创建成功", c)
}
// DeleteSysOperationRecord
// @Tags SysOperationRecord
// @Summary 删除SysOperationRecord
+171
View File
@@ -0,0 +1,171 @@
package system
import (
"github.com/flipped-aurora/gin-vue-admin/server/global"
"github.com/flipped-aurora/gin-vue-admin/server/model/common/response"
"github.com/flipped-aurora/gin-vue-admin/server/model/system"
systemReq "github.com/flipped-aurora/gin-vue-admin/server/model/system/request"
"github.com/gin-gonic/gin"
"go.uber.org/zap"
)
type SysParamsApi struct{}
// CreateSysParams 创建参数
// @Tags SysParams
// @Summary 创建参数
// @Security ApiKeyAuth
// @accept application/json
// @Produce application/json
// @Param data body system.SysParams true "创建参数"
// @Success 200 {object} response.Response{msg=string} "创建成功"
// @Router /sysParams/createSysParams [post]
func (sysParamsApi *SysParamsApi) CreateSysParams(c *gin.Context) {
var sysParams system.SysParams
err := c.ShouldBindJSON(&sysParams)
if err != nil {
response.FailWithMessage(err.Error(), c)
return
}
err = sysParamsService.CreateSysParams(&sysParams)
if err != nil {
global.GVA_LOG.Error("创建失败!", zap.Error(err))
response.FailWithMessage("创建失败:"+err.Error(), c)
return
}
response.OkWithMessage("创建成功", c)
}
// DeleteSysParams 删除参数
// @Tags SysParams
// @Summary 删除参数
// @Security ApiKeyAuth
// @accept application/json
// @Produce application/json
// @Param data body system.SysParams true "删除参数"
// @Success 200 {object} response.Response{msg=string} "删除成功"
// @Router /sysParams/deleteSysParams [delete]
func (sysParamsApi *SysParamsApi) DeleteSysParams(c *gin.Context) {
ID := c.Query("ID")
err := sysParamsService.DeleteSysParams(ID)
if err != nil {
global.GVA_LOG.Error("删除失败!", zap.Error(err))
response.FailWithMessage("删除失败:"+err.Error(), c)
return
}
response.OkWithMessage("删除成功", c)
}
// DeleteSysParamsByIds 批量删除参数
// @Tags SysParams
// @Summary 批量删除参数
// @Security ApiKeyAuth
// @accept application/json
// @Produce application/json
// @Success 200 {object} response.Response{msg=string} "批量删除成功"
// @Router /sysParams/deleteSysParamsByIds [delete]
func (sysParamsApi *SysParamsApi) DeleteSysParamsByIds(c *gin.Context) {
IDs := c.QueryArray("IDs[]")
err := sysParamsService.DeleteSysParamsByIds(IDs)
if err != nil {
global.GVA_LOG.Error("批量删除失败!", zap.Error(err))
response.FailWithMessage("批量删除失败:"+err.Error(), c)
return
}
response.OkWithMessage("批量删除成功", c)
}
// UpdateSysParams 更新参数
// @Tags SysParams
// @Summary 更新参数
// @Security ApiKeyAuth
// @accept application/json
// @Produce application/json
// @Param data body system.SysParams true "更新参数"
// @Success 200 {object} response.Response{msg=string} "更新成功"
// @Router /sysParams/updateSysParams [put]
func (sysParamsApi *SysParamsApi) UpdateSysParams(c *gin.Context) {
var sysParams system.SysParams
err := c.ShouldBindJSON(&sysParams)
if err != nil {
response.FailWithMessage(err.Error(), c)
return
}
err = sysParamsService.UpdateSysParams(sysParams)
if err != nil {
global.GVA_LOG.Error("更新失败!", zap.Error(err))
response.FailWithMessage("更新失败:"+err.Error(), c)
return
}
response.OkWithMessage("更新成功", c)
}
// FindSysParams 用id查询参数
// @Tags SysParams
// @Summary 用id查询参数
// @Security ApiKeyAuth
// @accept application/json
// @Produce application/json
// @Param data query system.SysParams true "用id查询参数"
// @Success 200 {object} response.Response{data=system.SysParams,msg=string} "查询成功"
// @Router /sysParams/findSysParams [get]
func (sysParamsApi *SysParamsApi) FindSysParams(c *gin.Context) {
ID := c.Query("ID")
resysParams, err := sysParamsService.GetSysParams(ID)
if err != nil {
global.GVA_LOG.Error("查询失败!", zap.Error(err))
response.FailWithMessage("查询失败:"+err.Error(), c)
return
}
response.OkWithData(resysParams, c)
}
// GetSysParamsList 分页获取参数列表
// @Tags SysParams
// @Summary 分页获取参数列表
// @Security ApiKeyAuth
// @accept application/json
// @Produce application/json
// @Param data query systemReq.SysParamsSearch true "分页获取参数列表"
// @Success 200 {object} response.Response{data=response.PageResult,msg=string} "获取成功"
// @Router /sysParams/getSysParamsList [get]
func (sysParamsApi *SysParamsApi) GetSysParamsList(c *gin.Context) {
var pageInfo systemReq.SysParamsSearch
err := c.ShouldBindQuery(&pageInfo)
if err != nil {
response.FailWithMessage(err.Error(), c)
return
}
list, total, err := sysParamsService.GetSysParamsInfoList(pageInfo)
if err != nil {
global.GVA_LOG.Error("获取失败!", zap.Error(err))
response.FailWithMessage("获取失败:"+err.Error(), c)
return
}
response.OkWithDetailed(response.PageResult{
List: list,
Total: total,
Page: pageInfo.Page,
PageSize: pageInfo.PageSize,
}, "获取成功", c)
}
// GetSysParam 根据key获取参数value
// @Tags SysParams
// @Summary 根据key获取参数value
// @Security ApiKeyAuth
// @accept application/json
// @Produce application/json
// @Param key query string true "key"
// @Success 200 {object} response.Response{data=system.SysParams,msg=string} "获取成功"
// @Router /sysParams/getSysParam [get]
func (sysParamsApi *SysParamsApi) GetSysParam(c *gin.Context) {
k := c.Query("key")
params, err := sysParamsService.GetSysParam(k)
if err != nil {
global.GVA_LOG.Error("获取失败!", zap.Error(err))
response.FailWithMessage("获取失败:"+err.Error(), c)
return
}
response.OkWithDetailed(params, "获取成功", c)
}
+263
View File
@@ -0,0 +1,263 @@
package system
import (
"net/http"
"github.com/flipped-aurora/gin-vue-admin/server/global"
"github.com/flipped-aurora/gin-vue-admin/server/model/common/response"
"github.com/flipped-aurora/gin-vue-admin/server/model/system/request"
"github.com/gin-gonic/gin"
"go.uber.org/zap"
)
type SkillsApi struct{}
func (s *SkillsApi) GetTools(c *gin.Context) {
data, err := skillsService.Tools(c.Request.Context())
if err != nil {
global.GVA_LOG.Error("获取工具列表失败", zap.Error(err))
response.FailWithMessage("获取工具列表失败", c)
return
}
response.OkWithDetailed(gin.H{"tools": data}, "获取成功", c)
}
func (s *SkillsApi) GetSkillList(c *gin.Context) {
var req request.SkillToolRequest
_ = c.ShouldBindJSON(&req)
data, err := skillsService.List(c.Request.Context(), req.Tool)
if err != nil {
global.GVA_LOG.Error("获取技能列表失败", zap.Error(err))
response.FailWithMessage("获取技能列表失败", c)
return
}
response.OkWithDetailed(gin.H{"skills": data}, "获取成功", c)
}
func (s *SkillsApi) GetSkillDetail(c *gin.Context) {
var req request.SkillDetailRequest
_ = c.ShouldBindJSON(&req)
data, err := skillsService.Detail(c.Request.Context(), req.Tool, req.Skill)
if err != nil {
global.GVA_LOG.Error("获取技能详情失败", zap.Error(err))
response.FailWithMessage("获取技能详情失败", c)
return
}
response.OkWithDetailed(gin.H{"detail": data}, "获取成功", c)
}
func (s *SkillsApi) SaveSkill(c *gin.Context) {
var req request.SkillSaveRequest
_ = c.ShouldBindJSON(&req)
if err := skillsService.Save(c.Request.Context(), req); err != nil {
global.GVA_LOG.Error("保存技能失败", zap.Error(err))
response.FailWithMessage("保存技能失败", c)
return
}
response.OkWithMessage("保存成功", c)
}
func (s *SkillsApi) DeleteSkill(c *gin.Context) {
var req request.SkillDeleteRequest
_ = c.ShouldBindJSON(&req)
if err := skillsService.Delete(c.Request.Context(), req); err != nil {
global.GVA_LOG.Error("删除技能失败", zap.Error(err))
response.FailWithMessage("删除技能失败: "+err.Error(), c)
return
}
response.OkWithMessage("删除成功", c)
}
func (s *SkillsApi) CreateScript(c *gin.Context) {
var req request.SkillScriptCreateRequest
_ = c.ShouldBindJSON(&req)
fileName, content, err := skillsService.CreateScript(c.Request.Context(), req)
if err != nil {
global.GVA_LOG.Error("创建脚本失败", zap.Error(err))
response.FailWithMessage("创建脚本失败", c)
return
}
response.OkWithDetailed(gin.H{"fileName": fileName, "content": content}, "创建成功", c)
}
func (s *SkillsApi) GetScript(c *gin.Context) {
var req request.SkillFileRequest
_ = c.ShouldBindJSON(&req)
content, err := skillsService.GetScript(c.Request.Context(), req)
if err != nil {
global.GVA_LOG.Error("读取脚本失败", zap.Error(err))
response.FailWithMessage("读取脚本失败", c)
return
}
response.OkWithDetailed(gin.H{"content": content}, "获取成功", c)
}
func (s *SkillsApi) SaveScript(c *gin.Context) {
var req request.SkillFileSaveRequest
_ = c.ShouldBindJSON(&req)
if err := skillsService.SaveScript(c.Request.Context(), req); err != nil {
global.GVA_LOG.Error("保存脚本失败", zap.Error(err))
response.FailWithMessage("保存脚本失败", c)
return
}
response.OkWithMessage("保存成功", c)
}
func (s *SkillsApi) CreateResource(c *gin.Context) {
var req request.SkillResourceCreateRequest
_ = c.ShouldBindJSON(&req)
fileName, content, err := skillsService.CreateResource(c.Request.Context(), req)
if err != nil {
global.GVA_LOG.Error("创建资源失败", zap.Error(err))
response.FailWithMessage("创建资源失败", c)
return
}
response.OkWithDetailed(gin.H{"fileName": fileName, "content": content}, "创建成功", c)
}
func (s *SkillsApi) GetResource(c *gin.Context) {
var req request.SkillFileRequest
_ = c.ShouldBindJSON(&req)
content, err := skillsService.GetResource(c.Request.Context(), req)
if err != nil {
global.GVA_LOG.Error("读取资源失败", zap.Error(err))
response.FailWithMessage("读取资源失败", c)
return
}
response.OkWithDetailed(gin.H{"content": content}, "获取成功", c)
}
func (s *SkillsApi) SaveResource(c *gin.Context) {
var req request.SkillFileSaveRequest
_ = c.ShouldBindJSON(&req)
if err := skillsService.SaveResource(c.Request.Context(), req); err != nil {
global.GVA_LOG.Error("保存资源失败", zap.Error(err))
response.FailWithMessage("保存资源失败", c)
return
}
response.OkWithMessage("保存成功", c)
}
func (s *SkillsApi) CreateReference(c *gin.Context) {
var req request.SkillReferenceCreateRequest
_ = c.ShouldBindJSON(&req)
fileName, content, err := skillsService.CreateReference(c.Request.Context(), req)
if err != nil {
global.GVA_LOG.Error("创建参考失败", zap.Error(err))
response.FailWithMessage("创建参考失败", c)
return
}
response.OkWithDetailed(gin.H{"fileName": fileName, "content": content}, "创建成功", c)
}
func (s *SkillsApi) GetReference(c *gin.Context) {
var req request.SkillFileRequest
_ = c.ShouldBindJSON(&req)
content, err := skillsService.GetReference(c.Request.Context(), req)
if err != nil {
global.GVA_LOG.Error("读取参考失败", zap.Error(err))
response.FailWithMessage("读取参考失败", c)
return
}
response.OkWithDetailed(gin.H{"content": content}, "获取成功", c)
}
func (s *SkillsApi) SaveReference(c *gin.Context) {
var req request.SkillFileSaveRequest
_ = c.ShouldBindJSON(&req)
if err := skillsService.SaveReference(c.Request.Context(), req); err != nil {
global.GVA_LOG.Error("保存参考失败", zap.Error(err))
response.FailWithMessage("保存参考失败", c)
return
}
response.OkWithMessage("保存成功", c)
}
func (s *SkillsApi) CreateTemplate(c *gin.Context) {
var req request.SkillTemplateCreateRequest
_ = c.ShouldBindJSON(&req)
fileName, content, err := skillsService.CreateTemplate(c.Request.Context(), req)
if err != nil {
global.GVA_LOG.Error("创建模板失败", zap.Error(err))
response.FailWithMessage("创建模板失败", c)
return
}
response.OkWithDetailed(gin.H{"fileName": fileName, "content": content}, "创建成功", c)
}
func (s *SkillsApi) GetTemplate(c *gin.Context) {
var req request.SkillFileRequest
_ = c.ShouldBindJSON(&req)
content, err := skillsService.GetTemplate(c.Request.Context(), req)
if err != nil {
global.GVA_LOG.Error("读取模板失败", zap.Error(err))
response.FailWithMessage("读取模板失败", c)
return
}
response.OkWithDetailed(gin.H{"content": content}, "获取成功", c)
}
func (s *SkillsApi) SaveTemplate(c *gin.Context) {
var req request.SkillFileSaveRequest
_ = c.ShouldBindJSON(&req)
if err := skillsService.SaveTemplate(c.Request.Context(), req); err != nil {
global.GVA_LOG.Error("保存模板失败", zap.Error(err))
response.FailWithMessage("保存模板失败", c)
return
}
response.OkWithMessage("保存成功", c)
}
func (s *SkillsApi) GetGlobalConstraint(c *gin.Context) {
var req request.SkillToolRequest
_ = c.ShouldBindJSON(&req)
content, exists, err := skillsService.GetGlobalConstraint(c.Request.Context(), req.Tool)
if err != nil {
global.GVA_LOG.Error("读取全局约束失败", zap.Error(err))
response.FailWithMessage("读取全局约束失败", c)
return
}
response.OkWithDetailed(gin.H{"content": content, "exists": exists}, "获取成功", c)
}
func (s *SkillsApi) SaveGlobalConstraint(c *gin.Context) {
var req request.SkillGlobalConstraintSaveRequest
_ = c.ShouldBindJSON(&req)
if err := skillsService.SaveGlobalConstraint(c.Request.Context(), req); err != nil {
global.GVA_LOG.Error("保存全局约束失败", zap.Error(err))
response.FailWithMessage("保存全局约束失败", c)
return
}
response.OkWithMessage("保存成功", c)
}
func (s *SkillsApi) PackageSkill(c *gin.Context) {
var req request.SkillPackageRequest
_ = c.ShouldBindJSON(&req)
fileName, data, err := skillsService.Package(c.Request.Context(), req)
if err != nil {
global.GVA_LOG.Error("打包技能失败", zap.Error(err))
response.FailWithMessage("打包技能失败: "+err.Error(), c)
return
}
c.Header("Content-Type", "application/zip")
c.Header("Content-Disposition", "attachment; filename=\""+fileName+"\"")
c.Data(http.StatusOK, "application/zip", data)
}
func (s *SkillsApi) DownloadOnlineSkill(c *gin.Context) {
var req request.DownloadOnlineSkillReq
if err := c.ShouldBindJSON(&req); err != nil {
response.FailWithMessage("参数错误", c)
return
}
if err := skillsService.DownloadOnlineSkill(c.Request.Context(), req); err != nil {
global.GVA_LOG.Error("下载在线技能失败", zap.Error(err))
response.FailWithMessage("下载在线技能失败: "+err.Error(), c)
return
}
response.OkWithMessage("下载成功", c)
}
+7 -7
View File
@@ -6,7 +6,6 @@ import (
"github.com/flipped-aurora/gin-vue-admin/server/model/system"
systemRes "github.com/flipped-aurora/gin-vue-admin/server/model/system/response"
"github.com/flipped-aurora/gin-vue-admin/server/utils"
"github.com/gin-gonic/gin"
"go.uber.org/zap"
)
@@ -56,19 +55,20 @@ func (s *SystemApi) SetSystemConfig(c *gin.Context) {
// ReloadSystem
// @Tags System
// @Summary 重启系统
// @Summary 重载系统
// @Security ApiKeyAuth
// @Produce application/json
// @Success 200 {object} response.Response{msg=string} "重启系统"
// @Success 200 {object} response.Response{msg=string} "重载系统"
// @Router /system/reloadSystem [post]
func (s *SystemApi) ReloadSystem(c *gin.Context) {
err := utils.Reload()
// 触发系统重载事件
err := utils.GlobalSystemEvents.TriggerReload()
if err != nil {
global.GVA_LOG.Error("重启系统失败!", zap.Error(err))
response.FailWithMessage("重启系统失败", c)
global.GVA_LOG.Error("重载系统失败!", zap.Error(err))
response.FailWithMessage("重载系统失败:"+err.Error(), c)
return
}
response.OkWithMessage("重启系统成功", c)
response.OkWithMessage("重载系统成功", c)
}
// GetServerInfo
+108 -54
View File
@@ -5,13 +5,13 @@ import (
"time"
"github.com/flipped-aurora/gin-vue-admin/server/global"
"github.com/flipped-aurora/gin-vue-admin/server/model/common"
"github.com/flipped-aurora/gin-vue-admin/server/model/common/request"
"github.com/flipped-aurora/gin-vue-admin/server/model/common/response"
"github.com/flipped-aurora/gin-vue-admin/server/model/system"
systemReq "github.com/flipped-aurora/gin-vue-admin/server/model/system/request"
systemRes "github.com/flipped-aurora/gin-vue-admin/server/model/system/response"
"github.com/flipped-aurora/gin-vue-admin/server/utils"
"github.com/gin-gonic/gin"
"github.com/redis/go-redis/v9"
"go.uber.org/zap"
@@ -27,8 +27,6 @@ import (
func (b *BaseApi) Login(c *gin.Context) {
var l systemReq.Login
err := c.ShouldBindJSON(&l)
key := c.ClientIP()
if err != nil {
response.FailWithMessage(err.Error(), c)
return
@@ -39,6 +37,7 @@ func (b *BaseApi) Login(c *gin.Context) {
return
}
key := c.ClientIP()
// 判断验证码是否开启
openCaptcha := global.GVA_CONFIG.Captcha.OpenCaptcha // 是否开启防爆次数
openCaptchaTimeOut := global.GVA_CONFIG.Captcha.OpenCaptchaTimeOut // 缓存超时时间
@@ -48,49 +47,76 @@ func (b *BaseApi) Login(c *gin.Context) {
}
var oc bool = openCaptcha == 0 || openCaptcha < interfaceToInt(v)
if !oc || store.Verify(l.CaptchaId, l.Captcha, true) {
u := &system.SysUser{Username: l.Username, Password: l.Password}
user, err := userService.Login(u)
if err != nil {
global.GVA_LOG.Error("登陆失败! 用户名不存在或者密码错误!", zap.Error(err))
// 验证码次数+1
global.BlackCache.Increment(key, 1)
response.FailWithMessage("用户名不存在或者密码错误", c)
return
}
if user.Enable != 1 {
global.GVA_LOG.Error("登陆失败! 用户被禁止登录!")
// 验证码次数+1
global.BlackCache.Increment(key, 1)
response.FailWithMessage("用户被禁止登录", c)
return
}
b.TokenNext(c, *user)
if oc && (l.Captcha == "" || l.CaptchaId == "" || !store.Verify(l.CaptchaId, l.Captcha, true)) {
// 验证码次数+1
global.BlackCache.Increment(key, 1)
response.FailWithMessage("验证码错误", c)
// 记录登录失败日志
loginLogService.CreateLoginLog(system.SysLoginLog{
Username: l.Username,
Ip: c.ClientIP(),
Agent: c.Request.UserAgent(),
Status: false,
ErrorMessage: "验证码错误",
})
return
}
// 验证码次数+1
global.BlackCache.Increment(key, 1)
response.FailWithMessage("验证码错误", c)
u := &system.SysUser{Username: l.Username, Password: l.Password}
user, err := userService.Login(u)
if err != nil {
global.GVA_LOG.Error("登陆失败! 用户名不存在或者密码错误!", zap.Error(err))
// 验证码次数+1
global.BlackCache.Increment(key, 1)
response.FailWithMessage("用户名不存在或者密码错误", c)
// 记录登录失败日志
loginLogService.CreateLoginLog(system.SysLoginLog{
Username: l.Username,
Ip: c.ClientIP(),
Agent: c.Request.UserAgent(),
Status: false,
ErrorMessage: "用户名不存在或者密码错误",
})
return
}
if user.Enable != 1 {
global.GVA_LOG.Error("登陆失败! 用户被禁止登录!")
// 验证码次数+1
global.BlackCache.Increment(key, 1)
response.FailWithMessage("用户被禁止登录", c)
// 记录登录失败日志
loginLogService.CreateLoginLog(system.SysLoginLog{
Username: l.Username,
Ip: c.ClientIP(),
Agent: c.Request.UserAgent(),
Status: false,
ErrorMessage: "用户被禁止登录",
UserID: user.ID,
})
return
}
b.TokenNext(c, *user)
}
// TokenNext 登录以后签发jwt
func (b *BaseApi) TokenNext(c *gin.Context, user system.SysUser) {
j := &utils.JWT{SigningKey: []byte(global.GVA_CONFIG.JWT.SigningKey)} // 唯一签名
claims := j.CreateClaims(systemReq.BaseClaims{
UUID: user.UUID,
ID: user.ID,
NickName: user.NickName,
Username: user.Username,
AuthorityId: user.AuthorityId,
})
token, err := j.CreateToken(claims)
token, claims, err := utils.LoginToken(&user)
if err != nil {
global.GVA_LOG.Error("获取token失败!", zap.Error(err))
response.FailWithMessage("获取token失败", c)
return
}
// 记录登录成功日志
loginLogService.CreateLoginLog(system.SysLoginLog{
Username: user.Username,
Ip: c.ClientIP(),
Agent: c.Request.UserAgent(),
Status: true,
UserID: user.ID,
ErrorMessage: "登录成功",
})
if !global.GVA_CONFIG.System.UseMultipoint {
utils.SetToken(c, token, int(claims.RegisteredClaims.ExpiresAt.Unix()-time.Now().Unix()))
response.OkWithDetailed(systemRes.LoginResponse{
User: user,
Token: token,
@@ -100,11 +126,12 @@ func (b *BaseApi) TokenNext(c *gin.Context, user system.SysUser) {
}
if jwtStr, err := jwtService.GetRedisJWT(user.Username); err == redis.Nil {
if err := jwtService.SetRedisJWT(token, user.Username); err != nil {
if err := utils.SetRedisJWT(token, user.Username); err != nil {
global.GVA_LOG.Error("设置登录状态失败!", zap.Error(err))
response.FailWithMessage("设置登录状态失败", c)
return
}
utils.SetToken(c, token, int(claims.RegisteredClaims.ExpiresAt.Unix()-time.Now().Unix()))
response.OkWithDetailed(systemRes.LoginResponse{
User: user,
Token: token,
@@ -120,10 +147,11 @@ func (b *BaseApi) TokenNext(c *gin.Context, user system.SysUser) {
response.FailWithMessage("jwt作废失败", c)
return
}
if err := jwtService.SetRedisJWT(token, user.Username); err != nil {
if err := utils.SetRedisJWT(token, user.GetUsername()); err != nil {
response.FailWithMessage("设置登录状态失败", c)
return
}
utils.SetToken(c, token, int(claims.RegisteredClaims.ExpiresAt.Unix()-time.Now().Unix()))
response.OkWithDetailed(systemRes.LoginResponse{
User: user,
Token: token,
@@ -189,7 +217,7 @@ func (b *BaseApi) ChangePassword(c *gin.Context) {
}
uid := utils.GetUserID(c)
u := &system.SysUser{GVA_MODEL: global.GVA_MODEL{ID: uid}, Password: req.Password}
_, err = userService.ChangePassword(u, req.NewPassword)
err = userService.ChangePassword(u, req.NewPassword)
if err != nil {
global.GVA_LOG.Error("修改失败!", zap.Error(err))
response.FailWithMessage("修改失败,原密码与当前账户不符", c)
@@ -204,11 +232,11 @@ func (b *BaseApi) ChangePassword(c *gin.Context) {
// @Security ApiKeyAuth
// @accept application/json
// @Produce application/json
// @Param data body request.PageInfo true "页码, 每页大小"
// @Param data body systemReq.GetUserList true "页码, 每页大小"
// @Success 200 {object} response.Response{data=response.PageResult,msg=string} "分页获取用户列表,返回包括列表,总数,页码,每页数量"
// @Router /user/getUserList [post]
func (b *BaseApi) GetUserList(c *gin.Context) {
var pageInfo request.PageInfo
var pageInfo systemReq.GetUserList
err := c.ShouldBindJSON(&pageInfo)
if err != nil {
response.FailWithMessage(err.Error(), c)
@@ -261,16 +289,17 @@ func (b *BaseApi) SetUserAuthority(c *gin.Context) {
return
}
claims := utils.GetUserInfo(c)
j := &utils.JWT{SigningKey: []byte(global.GVA_CONFIG.JWT.SigningKey)} // 唯一签名
claims.AuthorityId = sua.AuthorityId
if token, err := j.CreateToken(*claims); err != nil {
token, err := utils.NewJWT().CreateToken(*claims)
if err != nil {
global.GVA_LOG.Error("修改失败!", zap.Error(err))
response.FailWithMessage(err.Error(), c)
} else {
c.Header("new-token", token)
c.Header("new-expires-at", strconv.FormatInt(claims.ExpiresAt.Unix(), 10))
response.OkWithMessage("修改成功", c)
return
}
c.Header("new-token", token)
c.Header("new-expires-at", strconv.FormatInt(claims.ExpiresAt.Unix(), 10))
utils.SetToken(c, token, int(claims.ExpiresAt.Unix()-time.Now().Unix()))
response.OkWithMessage("修改成功", c)
}
// SetUserAuthorities
@@ -289,7 +318,8 @@ func (b *BaseApi) SetUserAuthorities(c *gin.Context) {
response.FailWithMessage(err.Error(), c)
return
}
err = userService.SetUserAuthorities(sua.ID, sua.AuthorityIds)
authorityID := utils.GetUserAuthorityId(c)
err = userService.SetUserAuthorities(authorityID, sua.ID, sua.AuthorityIds)
if err != nil {
global.GVA_LOG.Error("修改失败!", zap.Error(err))
response.FailWithMessage("修改失败", c)
@@ -321,7 +351,7 @@ func (b *BaseApi) DeleteUser(c *gin.Context) {
}
jwtId := utils.GetUserID(c)
if jwtId == uint(reqId.ID) {
response.FailWithMessage("删除失败, 自杀失败", c)
response.FailWithMessage("删除失败, 无法删除自己。", c)
return
}
err = userService.DeleteUser(reqId.ID)
@@ -354,9 +384,9 @@ func (b *BaseApi) SetUserInfo(c *gin.Context) {
response.FailWithMessage(err.Error(), c)
return
}
if len(user.AuthorityIds) != 0 {
err = userService.SetUserAuthorities(user.ID, user.AuthorityIds)
authorityID := utils.GetUserAuthorityId(c)
err = userService.SetUserAuthorities(authorityID, user.ID, user.AuthorityIds)
if err != nil {
global.GVA_LOG.Error("设置失败!", zap.Error(err))
response.FailWithMessage("设置失败", c)
@@ -371,7 +401,6 @@ func (b *BaseApi) SetUserInfo(c *gin.Context) {
HeaderImg: user.HeaderImg,
Phone: user.Phone,
Email: user.Email,
SideMode: user.SideMode,
Enable: user.Enable,
})
if err != nil {
@@ -407,7 +436,6 @@ func (b *BaseApi) SetSelfInfo(c *gin.Context) {
HeaderImg: user.HeaderImg,
Phone: user.Phone,
Email: user.Email,
SideMode: user.SideMode,
Enable: user.Enable,
})
if err != nil {
@@ -418,6 +446,32 @@ func (b *BaseApi) SetSelfInfo(c *gin.Context) {
response.OkWithMessage("设置成功", c)
}
// SetSelfSetting
// @Tags SysUser
// @Summary 设置用户配置
// @Security ApiKeyAuth
// @accept application/json
// @Produce application/json
// @Param data body map[string]interface{} true "用户配置数据"
// @Success 200 {object} response.Response{data=map[string]interface{},msg=string} "设置用户配置"
// @Router /user/SetSelfSetting [put]
func (b *BaseApi) SetSelfSetting(c *gin.Context) {
var req common.JSONMap
err := c.ShouldBindJSON(&req)
if err != nil {
response.FailWithMessage(err.Error(), c)
return
}
err = userService.SetSelfSetting(req, utils.GetUserID(c))
if err != nil {
global.GVA_LOG.Error("设置失败!", zap.Error(err))
response.FailWithMessage("设置失败", c)
return
}
response.OkWithMessage("设置成功", c)
}
// GetUserInfo
// @Tags SysUser
// @Summary 获取用户信息
@@ -446,13 +500,13 @@ func (b *BaseApi) GetUserInfo(c *gin.Context) {
// @Success 200 {object} response.Response{msg=string} "重置用户密码"
// @Router /user/resetPassword [post]
func (b *BaseApi) ResetPassword(c *gin.Context) {
var user system.SysUser
err := c.ShouldBindJSON(&user)
var rps systemReq.ResetPassword
err := c.ShouldBindJSON(&rps)
if err != nil {
response.FailWithMessage(err.Error(), c)
return
}
err = userService.ResetPassword(user.ID)
err = userService.ResetPassword(rps.ID, rps.Password)
if err != nil {
global.GVA_LOG.Error("重置失败!", zap.Error(err))
response.FailWithMessage("重置失败"+err.Error(), c)
+486
View File
@@ -0,0 +1,486 @@
package system
import (
"encoding/json"
"fmt"
"net/http"
"sort"
"strconv"
"time"
"github.com/flipped-aurora/gin-vue-admin/server/global"
"github.com/flipped-aurora/gin-vue-admin/server/model/common/response"
"github.com/flipped-aurora/gin-vue-admin/server/model/system"
systemReq "github.com/flipped-aurora/gin-vue-admin/server/model/system/request"
systemRes "github.com/flipped-aurora/gin-vue-admin/server/model/system/response"
"github.com/flipped-aurora/gin-vue-admin/server/utils"
"github.com/gin-gonic/gin"
"go.uber.org/zap"
)
type SysVersionApi struct{}
// buildMenuTree 构建菜单树结构
func buildMenuTree(menus []system.SysBaseMenu) []system.SysBaseMenu {
// 创建菜单映射
menuMap := make(map[uint]*system.SysBaseMenu)
for i := range menus {
menuMap[menus[i].ID] = &menus[i]
}
// 构建树结构
var rootMenus []system.SysBaseMenu
for _, menu := range menus {
if menu.ParentId == 0 {
// 根菜单
menuData := convertMenuToStruct(menu, menuMap)
rootMenus = append(rootMenus, menuData)
}
}
// 按sort排序根菜单
sort.Slice(rootMenus, func(i, j int) bool {
return rootMenus[i].Sort < rootMenus[j].Sort
})
return rootMenus
}
// convertMenuToStruct 将菜单转换为结构体并递归处理子菜单
func convertMenuToStruct(menu system.SysBaseMenu, menuMap map[uint]*system.SysBaseMenu) system.SysBaseMenu {
result := system.SysBaseMenu{
Path: menu.Path,
Name: menu.Name,
Hidden: menu.Hidden,
Component: menu.Component,
Sort: menu.Sort,
Meta: menu.Meta,
}
// 清理并复制参数数据
if len(menu.Parameters) > 0 {
cleanParameters := make([]system.SysBaseMenuParameter, 0, len(menu.Parameters))
for _, param := range menu.Parameters {
cleanParam := system.SysBaseMenuParameter{
Type: param.Type,
Key: param.Key,
Value: param.Value,
// 不复制 ID, CreatedAt, UpdatedAt, SysBaseMenuID
}
cleanParameters = append(cleanParameters, cleanParam)
}
result.Parameters = cleanParameters
}
// 清理并复制菜单按钮数据
if len(menu.MenuBtn) > 0 {
cleanMenuBtns := make([]system.SysBaseMenuBtn, 0, len(menu.MenuBtn))
for _, btn := range menu.MenuBtn {
cleanBtn := system.SysBaseMenuBtn{
Name: btn.Name,
Desc: btn.Desc,
// 不复制 ID, CreatedAt, UpdatedAt, SysBaseMenuID
}
cleanMenuBtns = append(cleanMenuBtns, cleanBtn)
}
result.MenuBtn = cleanMenuBtns
}
// 查找并处理子菜单
var children []system.SysBaseMenu
for _, childMenu := range menuMap {
if childMenu.ParentId == menu.ID {
childData := convertMenuToStruct(*childMenu, menuMap)
children = append(children, childData)
}
}
// 按sort排序子菜单
if len(children) > 0 {
sort.Slice(children, func(i, j int) bool {
return children[i].Sort < children[j].Sort
})
result.Children = children
}
return result
}
// DeleteSysVersion 删除版本管理
// @Tags SysVersion
// @Summary 删除版本管理
// @Security ApiKeyAuth
// @Accept application/json
// @Produce application/json
// @Param data body system.SysVersion true "删除版本管理"
// @Success 200 {object} response.Response{msg=string} "删除成功"
// @Router /sysVersion/deleteSysVersion [delete]
func (sysVersionApi *SysVersionApi) DeleteSysVersion(c *gin.Context) {
// 创建业务用Context
ctx := c.Request.Context()
ID := c.Query("ID")
err := sysVersionService.DeleteSysVersion(ctx, ID)
if err != nil {
global.GVA_LOG.Error("删除失败!", zap.Error(err))
response.FailWithMessage("删除失败:"+err.Error(), c)
return
}
response.OkWithMessage("删除成功", c)
}
// DeleteSysVersionByIds 批量删除版本管理
// @Tags SysVersion
// @Summary 批量删除版本管理
// @Security ApiKeyAuth
// @Accept application/json
// @Produce application/json
// @Success 200 {object} response.Response{msg=string} "批量删除成功"
// @Router /sysVersion/deleteSysVersionByIds [delete]
func (sysVersionApi *SysVersionApi) DeleteSysVersionByIds(c *gin.Context) {
// 创建业务用Context
ctx := c.Request.Context()
IDs := c.QueryArray("IDs[]")
err := sysVersionService.DeleteSysVersionByIds(ctx, IDs)
if err != nil {
global.GVA_LOG.Error("批量删除失败!", zap.Error(err))
response.FailWithMessage("批量删除失败:"+err.Error(), c)
return
}
response.OkWithMessage("批量删除成功", c)
}
// FindSysVersion 用id查询版本管理
// @Tags SysVersion
// @Summary 用id查询版本管理
// @Security ApiKeyAuth
// @Accept application/json
// @Produce application/json
// @Param ID query uint true "用id查询版本管理"
// @Success 200 {object} response.Response{data=system.SysVersion,msg=string} "查询成功"
// @Router /sysVersion/findSysVersion [get]
func (sysVersionApi *SysVersionApi) FindSysVersion(c *gin.Context) {
// 创建业务用Context
ctx := c.Request.Context()
ID := c.Query("ID")
resysVersion, err := sysVersionService.GetSysVersion(ctx, ID)
if err != nil {
global.GVA_LOG.Error("查询失败!", zap.Error(err))
response.FailWithMessage("查询失败:"+err.Error(), c)
return
}
response.OkWithData(resysVersion, c)
}
// GetSysVersionList 分页获取版本管理列表
// @Tags SysVersion
// @Summary 分页获取版本管理列表
// @Security ApiKeyAuth
// @Accept application/json
// @Produce application/json
// @Param data query systemReq.SysVersionSearch true "分页获取版本管理列表"
// @Success 200 {object} response.Response{data=response.PageResult,msg=string} "获取成功"
// @Router /sysVersion/getSysVersionList [get]
func (sysVersionApi *SysVersionApi) GetSysVersionList(c *gin.Context) {
// 创建业务用Context
ctx := c.Request.Context()
var pageInfo systemReq.SysVersionSearch
err := c.ShouldBindQuery(&pageInfo)
if err != nil {
response.FailWithMessage(err.Error(), c)
return
}
list, total, err := sysVersionService.GetSysVersionInfoList(ctx, pageInfo)
if err != nil {
global.GVA_LOG.Error("获取失败!", zap.Error(err))
response.FailWithMessage("获取失败:"+err.Error(), c)
return
}
response.OkWithDetailed(response.PageResult{
List: list,
Total: total,
Page: pageInfo.Page,
PageSize: pageInfo.PageSize,
}, "获取成功", c)
}
// GetSysVersionPublic 不需要鉴权的版本管理接口
// @Tags SysVersion
// @Summary 不需要鉴权的版本管理接口
// @Accept application/json
// @Produce application/json
// @Success 200 {object} response.Response{data=object,msg=string} "获取成功"
// @Router /sysVersion/getSysVersionPublic [get]
func (sysVersionApi *SysVersionApi) GetSysVersionPublic(c *gin.Context) {
// 创建业务用Context
ctx := c.Request.Context()
// 此接口不需要鉴权
// 示例为返回了一个固定的消息接口,一般本接口用于C端服务,需要自己实现业务逻辑
sysVersionService.GetSysVersionPublic(ctx)
response.OkWithDetailed(gin.H{
"info": "不需要鉴权的版本管理接口信息",
}, "获取成功", c)
}
// ExportVersion 创建发版数据
// @Tags SysVersion
// @Summary 创建发版数据
// @Security ApiKeyAuth
// @Accept application/json
// @Produce application/json
// @Param data body systemReq.ExportVersionRequest true "创建发版数据"
// @Success 200 {object} response.Response{msg=string} "创建成功"
// @Router /sysVersion/exportVersion [post]
func (sysVersionApi *SysVersionApi) ExportVersion(c *gin.Context) {
ctx := c.Request.Context()
var req systemReq.ExportVersionRequest
err := c.ShouldBindJSON(&req)
if err != nil {
response.FailWithMessage(err.Error(), c)
return
}
// 获取选中的菜单数据
var menuData []system.SysBaseMenu
if len(req.MenuIds) > 0 {
menuData, err = sysVersionService.GetMenusByIds(ctx, req.MenuIds)
if err != nil {
global.GVA_LOG.Error("获取菜单数据失败!", zap.Error(err))
response.FailWithMessage("获取菜单数据失败:"+err.Error(), c)
return
}
}
// 获取选中的API数据
var apiData []system.SysApi
if len(req.ApiIds) > 0 {
apiData, err = sysVersionService.GetApisByIds(ctx, req.ApiIds)
if err != nil {
global.GVA_LOG.Error("获取API数据失败!", zap.Error(err))
response.FailWithMessage("获取API数据失败:"+err.Error(), c)
return
}
}
// 获取选中的字典数据
var dictData []system.SysDictionary
if len(req.DictIds) > 0 {
dictData, err = sysVersionService.GetDictionariesByIds(ctx, req.DictIds)
if err != nil {
global.GVA_LOG.Error("获取字典数据失败!", zap.Error(err))
response.FailWithMessage("获取字典数据失败:"+err.Error(), c)
return
}
}
// 处理菜单数据,构建递归的children结构
processedMenus := buildMenuTree(menuData)
// 处理API数据,清除ID和时间戳字段
processedApis := make([]system.SysApi, 0, len(apiData))
for _, api := range apiData {
cleanApi := system.SysApi{
Path: api.Path,
Description: api.Description,
ApiGroup: api.ApiGroup,
Method: api.Method,
}
processedApis = append(processedApis, cleanApi)
}
// 处理字典数据,清除ID和时间戳字段,包含字典详情
processedDicts := make([]system.SysDictionary, 0, len(dictData))
for _, dict := range dictData {
cleanDict := system.SysDictionary{
Name: dict.Name,
Type: dict.Type,
Status: dict.Status,
Desc: dict.Desc,
}
// 处理字典详情数据,清除ID和时间戳字段
cleanDetails := make([]system.SysDictionaryDetail, 0, len(dict.SysDictionaryDetails))
for _, detail := range dict.SysDictionaryDetails {
cleanDetail := system.SysDictionaryDetail{
Label: detail.Label,
Value: detail.Value,
Extend: detail.Extend,
Status: detail.Status,
Sort: detail.Sort,
// 不复制 ID, CreatedAt, UpdatedAt, SysDictionaryID
}
cleanDetails = append(cleanDetails, cleanDetail)
}
cleanDict.SysDictionaryDetails = cleanDetails
processedDicts = append(processedDicts, cleanDict)
}
// 构建导出数据
exportData := systemRes.ExportVersionResponse{
Version: systemReq.VersionInfo{
Name: req.VersionName,
Code: req.VersionCode,
Description: req.Description,
ExportTime: time.Now().Format("2006-01-02 15:04:05"),
},
Menus: processedMenus,
Apis: processedApis,
Dictionaries: processedDicts,
}
// 转换为JSON
jsonData, err := json.MarshalIndent(exportData, "", " ")
if err != nil {
global.GVA_LOG.Error("JSON序列化失败!", zap.Error(err))
response.FailWithMessage("JSON序列化失败:"+err.Error(), c)
return
}
// 保存版本记录
version := system.SysVersion{
VersionName: utils.Pointer(req.VersionName),
VersionCode: utils.Pointer(req.VersionCode),
Description: utils.Pointer(req.Description),
VersionData: utils.Pointer(string(jsonData)),
}
err = sysVersionService.CreateSysVersion(ctx, &version)
if err != nil {
global.GVA_LOG.Error("保存版本记录失败!", zap.Error(err))
response.FailWithMessage("保存版本记录失败:"+err.Error(), c)
return
}
response.OkWithMessage("创建发版成功", c)
}
// DownloadVersionJson 下载版本JSON数据
// @Tags SysVersion
// @Summary 下载版本JSON数据
// @Security ApiKeyAuth
// @Accept application/json
// @Produce application/json
// @Param ID query string true "版本ID"
// @Success 200 {object} response.Response{data=object,msg=string} "下载成功"
// @Router /sysVersion/downloadVersionJson [get]
func (sysVersionApi *SysVersionApi) DownloadVersionJson(c *gin.Context) {
ctx := c.Request.Context()
ID := c.Query("ID")
if ID == "" {
response.FailWithMessage("版本ID不能为空", c)
return
}
// 获取版本记录
version, err := sysVersionService.GetSysVersion(ctx, ID)
if err != nil {
global.GVA_LOG.Error("获取版本记录失败!", zap.Error(err))
response.FailWithMessage("获取版本记录失败:"+err.Error(), c)
return
}
// 构建JSON数据
var jsonData []byte
if version.VersionData != nil && *version.VersionData != "" {
jsonData = []byte(*version.VersionData)
} else {
// 如果没有存储的JSON数据,构建一个基本的结构
basicData := systemRes.ExportVersionResponse{
Version: systemReq.VersionInfo{
Name: *version.VersionName,
Code: *version.VersionCode,
Description: *version.Description,
ExportTime: version.CreatedAt.Format("2006-01-02 15:04:05"),
},
Menus: []system.SysBaseMenu{},
Apis: []system.SysApi{},
}
jsonData, _ = json.MarshalIndent(basicData, "", " ")
}
// 设置下载响应头
filename := fmt.Sprintf("version_%s_%s.json", *version.VersionCode, time.Now().Format("20060102150405"))
c.Header("Content-Type", "application/json")
c.Header("Content-Disposition", fmt.Sprintf("attachment; filename=%s", filename))
c.Header("Content-Length", strconv.Itoa(len(jsonData)))
c.Data(http.StatusOK, "application/json", jsonData)
}
// ImportVersion 导入版本数据
// @Tags SysVersion
// @Summary 导入版本数据
// @Security ApiKeyAuth
// @Accept application/json
// @Produce application/json
// @Param data body systemReq.ImportVersionRequest true "版本JSON数据"
// @Success 200 {object} response.Response{msg=string} "导入成功"
// @Router /sysVersion/importVersion [post]
func (sysVersionApi *SysVersionApi) ImportVersion(c *gin.Context) {
ctx := c.Request.Context()
// 获取JSON数据
var importData systemReq.ImportVersionRequest
err := c.ShouldBindJSON(&importData)
if err != nil {
response.FailWithMessage("解析JSON数据失败:"+err.Error(), c)
return
}
// 验证数据格式
if importData.VersionInfo.Name == "" || importData.VersionInfo.Code == "" {
response.FailWithMessage("版本信息格式错误", c)
return
}
// 导入菜单数据
if len(importData.ExportMenu) > 0 {
if err := sysVersionService.ImportMenus(ctx, importData.ExportMenu); err != nil {
global.GVA_LOG.Error("导入菜单失败!", zap.Error(err))
response.FailWithMessage("导入菜单失败: "+err.Error(), c)
return
}
}
// 导入API数据
if len(importData.ExportApi) > 0 {
if err := sysVersionService.ImportApis(importData.ExportApi); err != nil {
global.GVA_LOG.Error("导入API失败!", zap.Error(err))
response.FailWithMessage("导入API失败: "+err.Error(), c)
return
}
}
// 导入字典数据
if len(importData.ExportDictionary) > 0 {
if err := sysVersionService.ImportDictionaries(importData.ExportDictionary); err != nil {
global.GVA_LOG.Error("导入字典失败!", zap.Error(err))
response.FailWithMessage("导入字典失败: "+err.Error(), c)
return
}
}
// 创建导入记录
jsonData, _ := json.Marshal(importData)
version := system.SysVersion{
VersionName: utils.Pointer(importData.VersionInfo.Name),
VersionCode: utils.Pointer(fmt.Sprintf("%s_imported_%s", importData.VersionInfo.Code, time.Now().Format("20060102150405"))),
Description: utils.Pointer(fmt.Sprintf("导入版本: %s", importData.VersionInfo.Description)),
VersionData: utils.Pointer(string(jsonData)),
}
err = sysVersionService.CreateSysVersion(ctx, &version)
if err != nil {
global.GVA_LOG.Error("保存导入记录失败!", zap.Error(err))
// 这里不返回错误,因为数据已经导入成功
}
response.OkWithMessage("导入成功", c)
}
+192
View File
@@ -0,0 +1,192 @@
package main
import (
"bufio"
"errors"
"flag"
"fmt"
"io"
"os"
"path/filepath"
"strings"
"github.com/flipped-aurora/gin-vue-admin/server/config"
"github.com/flipped-aurora/gin-vue-admin/server/global"
"gopkg.in/yaml.v3"
)
type standaloneConfig struct {
MCP config.MCP `yaml:"mcp"`
AutoCode config.Autocode `yaml:"autocode"`
}
func loadStandaloneConfig() (string, error) {
configPath, err := resolveConfigPath()
if err != nil {
return "", err
}
content, err := os.ReadFile(configPath)
if err != nil {
return "", fmt.Errorf("读取 MCP 配置失败: %w", err)
}
var cfg standaloneConfig
if err := yaml.Unmarshal(content, &cfg); err != nil {
return "", fmt.Errorf("解析 MCP 配置失败: %w", err)
}
applyStandaloneDefaults(configPath, &cfg)
global.GVA_CONFIG.MCP = cfg.MCP
global.GVA_CONFIG.AutoCode = cfg.AutoCode
return configPath, nil
}
func resolveConfigPath() (string, error) {
explicit, err := parseConfigFlag(os.Args[1:])
if err != nil {
return "", err
}
if explicit != "" {
return filepath.Abs(explicit)
}
if envPath := strings.TrimSpace(os.Getenv("GVA_MCP_CONFIG")); envPath != "" {
return filepath.Abs(envPath)
}
wd, _ := os.Getwd()
exe, _ := os.Executable()
exeDir := filepath.Dir(exe)
candidates := []string{
filepath.Join(wd, "config.yaml"),
filepath.Join(wd, "mcp.yaml"),
filepath.Join(wd, "cmd", "mcp", "config.yaml"),
filepath.Join(wd, "server", "cmd", "mcp", "config.yaml"),
filepath.Join(exeDir, "config.yaml"),
filepath.Join(exeDir, "mcp.yaml"),
}
for _, candidate := range candidates {
if candidate == "" {
continue
}
if info, err := os.Stat(candidate); err == nil && !info.IsDir() {
return filepath.Abs(candidate)
}
}
return "", errors.New("未找到 MCP 独立配置文件,请在当前目录、cmd/mcp 目录或通过 -config / GVA_MCP_CONFIG 指定 config.yaml")
}
func parseConfigFlag(args []string) (string, error) {
fs := flag.NewFlagSet("gva-mcp", flag.ContinueOnError)
fs.SetOutput(io.Discard)
var configPath string
fs.StringVar(&configPath, "c", "", "MCP config file path")
fs.StringVar(&configPath, "config", "", "MCP config file path")
if err := fs.Parse(args); err != nil {
return "", err
}
return strings.TrimSpace(configPath), nil
}
func applyStandaloneDefaults(configPath string, cfg *standaloneConfig) {
if cfg.MCP.Name == "" {
cfg.MCP.Name = "GVA_MCP"
}
if cfg.MCP.Version == "" {
cfg.MCP.Version = "v1.0.0"
}
if cfg.MCP.Path == "" {
cfg.MCP.Path = "/mcp"
}
if cfg.MCP.Addr == 0 {
cfg.MCP.Addr = 8889
}
if cfg.MCP.AuthHeader == "" {
cfg.MCP.AuthHeader = "x-token"
}
if cfg.MCP.RequestTimeout <= 0 {
cfg.MCP.RequestTimeout = 15
}
if cfg.MCP.UpstreamBaseURL == "" {
cfg.MCP.UpstreamBaseURL = "http://127.0.0.1:8888"
}
if cfg.MCP.BaseURL == "" {
cfg.MCP.BaseURL = fmt.Sprintf("http://127.0.0.1:%d%s", cfg.MCP.Addr, cfg.MCP.Path)
}
configDir := filepath.Dir(configPath)
if cfg.AutoCode.Server == "" {
cfg.AutoCode.Server = "server"
}
if cfg.AutoCode.Web == "" {
cfg.AutoCode.Web = "web/src"
}
if cfg.AutoCode.Root == "" {
if root, err := detectProjectRoot(configDir); err == nil {
cfg.AutoCode.Root = root
}
} else if !filepath.IsAbs(cfg.AutoCode.Root) {
cfg.AutoCode.Root = filepath.Clean(filepath.Join(configDir, cfg.AutoCode.Root))
}
if cfg.AutoCode.Module == "" && cfg.AutoCode.Root != "" {
goModPath := filepath.Join(cfg.AutoCode.Root, cfg.AutoCode.Server, "go.mod")
if module, err := detectGoModule(goModPath); err == nil {
cfg.AutoCode.Module = module
}
}
}
func detectProjectRoot(startDir string) (string, error) {
dir := startDir
for {
serverDir := filepath.Join(dir, "server")
webDir := filepath.Join(dir, "web")
if isDir(serverDir) && isDir(webDir) {
return dir, nil
}
parent := filepath.Dir(dir)
if parent == dir {
break
}
dir = parent
}
return "", errors.New("未能自动识别项目根目录,请在 MCP 配置中设置 autocode.root")
}
func detectGoModule(goModPath string) (string, error) {
file, err := os.Open(goModPath)
if err != nil {
return "", err
}
defer file.Close()
scanner := bufio.NewScanner(file)
for scanner.Scan() {
line := strings.TrimSpace(scanner.Text())
if strings.HasPrefix(line, "module ") {
return strings.TrimSpace(strings.TrimPrefix(line, "module ")), nil
}
}
if err := scanner.Err(); err != nil {
return "", err
}
return "", errors.New("go.mod 中未找到 module 定义")
}
func isDir(path string) bool {
info, err := os.Stat(path)
return err == nil && info.IsDir()
}
+14
View File
@@ -0,0 +1,14 @@
mcp:
name: GVA_MCP
version: v1.0.0
path: /mcp
addr: 8889
base_url: http://127.0.0.1:8889/mcp
upstream_base_url: http://127.0.0.1:8888
auth_header: x-token
request_timeout: 15
autocode:
root: ../../..
server: server
web: web/src
+17
View File
@@ -0,0 +1,17 @@
package main
import (
"github.com/flipped-aurora/gin-vue-admin/server/global"
"go.uber.org/zap"
)
func initializeStandaloneLogger() error {
logger, err := zap.NewDevelopment()
if err != nil {
return err
}
global.GVA_LOG = logger
zap.ReplaceGlobals(logger)
return nil
}
+35
View File
@@ -0,0 +1,35 @@
package main
import (
"fmt"
"github.com/flipped-aurora/gin-vue-admin/server/global"
mcpTool "github.com/flipped-aurora/gin-vue-admin/server/mcp"
_ "go.uber.org/automaxprocs"
"go.uber.org/zap"
)
func main() {
configPath, err := loadStandaloneConfig()
if err != nil {
panic(err)
}
if err := initializeStandaloneLogger(); err != nil {
panic(err)
}
addr := fmt.Sprintf(":%d", global.GVA_CONFIG.MCP.Addr)
server := mcpTool.NewStreamableHTTPServer()
global.GVA_LOG.Info("mcp独立服务启动",
zap.String("config", configPath),
zap.String("addr", addr),
zap.String("path", global.GVA_CONFIG.MCP.Path),
zap.String("upstream", global.GVA_CONFIG.MCP.UpstreamBaseURL),
)
if err := server.Start(addr); err != nil {
global.GVA_LOG.Fatal("mcp独立服务启动失败", zap.Error(err))
}
}
+220 -141
View File
@@ -2,90 +2,103 @@
# jwt configuration
jwt:
signing-key: qmPlus
expires-time: 7d
buffer-time: 1d
issuer: qmPlus
signing-key: qmPlus
expires-time: 7d
buffer-time: 1d
issuer: qmPlus
# zap logger configuration
zap:
level: info
format: console
prefix: "[github.com/flipped-aurora/gin-vue-admin/server]"
director: log
show-line: true
encode-level: LowercaseColorLevelEncoder
stacktrace-key: stacktrace
log-in-console: true
level: info
format: console
prefix: "[github.com/flipped-aurora/gin-vue-admin/server]"
director: log
show-line: true
encode-level: LowercaseColorLevelEncoder
stacktrace-key: stacktrace
log-in-console: true
retention-day: -1
# redis configuration
redis:
db: 0
addr: 177.7.0.14:6379
password: ""
#是否使用redis集群模式
useCluster: false
#使用集群模式addr和db默认无效
addr: 177.7.0.14:6379
password: ""
db: 0
clusterAddrs:
- "177.7.0.14:7000"
- "177.7.0.15:7001"
- "177.7.0.13:7002"
# redis-list configuration
redis-list:
- name: cache # 数据库的名称,注意: name 需要在 redis-list 中唯一
useCluster: false # 是否使用redis集群模式
addr: 177.7.0.14:6379 # 使用集群模式addr和db默认无效
password: ""
db: 0
clusterAddrs:
- "177.7.0.14:7000"
- "177.7.0.15:7001"
- "177.7.0.13:7002"
# mongo configuration
mongo:
coll: ''
options: ''
database: ''
username: ''
password: ''
auth-source: ''
min-pool-size: 0
max-pool-size: 100
socket-timeout-ms: 0
connect-timeout-ms: 0
is-zap: false
hosts:
- host: ''
port: ''
# email configuration
email:
to: xxx@qq.com
port: 465
from: xxx@163.com
host: smtp.163.com
is-ssl: true
secret: xxx
nickname: test
to: xxx@qq.com
port: 465
from: xxx@163.com
host: smtp.163.com
is-ssl: true
secret: xxx
nickname: test
# system configuration
system:
env: public # Change to "develop" to skip authentication for development mode
addr: 8888
db-type: mysql
oss-type: local # 控制oss选择走本地还是 七牛等其他仓 自行增加其他oss仓可以在 server/utils/upload/upload.go 中 NewOss函数配置
use-redis: false # 使用redis
use-multipoint: false
# IP限制次数 一个小时15000次
iplimit-count: 15000
# IP限制一个小时
iplimit-time: 3600
env: local # 修改为public可以关闭路由日志输出
addr: 8888
db-type: mysql
oss-type: local # 控制oss选择走本地还是 七牛等其他仓 自行增加其他oss仓可以在 server/utils/upload/upload.go 中 NewOss函数配置
use-redis: false # 使用redis
use-mongo: false # 使用mongo
use-multipoint: false
# IP限制次数 一个小时15000次
iplimit-count: 15000
# IP限制一个小时
iplimit-time: 3600
# 路由全局前缀
router-prefix: ""
# 严格角色模式 打开后权限将会存在上下级关系
use-strict-auth: false
# captcha configuration
captcha:
key-long: 6
img-width: 240
img-height: 80
open-captcha: 0 # 0代表一直开启,大于0代表限制次数
open-captcha-timeout: 3600 # open-captcha大于0时才生效
key-long: 6
img-width: 240
img-height: 80
open-captcha: 0 # 0代表一直开启,大于0代表限制次数
open-captcha-timeout: 3600 # open-captcha大于0时才生效
# mysql connect configuration
# 未初始化之前请勿手动修改数据库信息!!!如果一定要手动初始化请看(https://gin-vue-admin.com/docs/first_master)
mysql:
path: ""
port: ""
config: ""
db-name: ""
username: ""
password: ""
max-idle-conns: 10
max-open-conns: 100
log-mode: ""
log-zap: false
# pgsql connect configuration
# 未初始化之前请勿手动修改数据库信息!!!如果一定要手动初始化请看(https://gin-vue-admin.com/docs/first_master)
pgsql:
path: ""
port: ""
config: ""
db-name: ""
username: ""
password: ""
max-idle-conns: 10
max-open-conns: 100
log-mode: ""
log-zap: false
db-list:
- disable: true # 是否禁用
type: "" # 数据库的类型,目前支持mysql、pgsql
alias-name: "" # 数据库的名称,注意: alias-name 需要在db-list中唯一
path: ""
port: ""
config: ""
@@ -97,107 +110,173 @@ db-list:
log-mode: ""
log-zap: false
# pgsql connect configuration
# 未初始化之前请勿手动修改数据库信息!!!如果一定要手动初始化请看(https://gin-vue-admin.com/docs/first_master)
pgsql:
path: ""
port: ""
config: ""
db-name: ""
username: ""
password: ""
max-idle-conns: 10
max-open-conns: 100
log-mode: ""
log-zap: false
oracle:
path: ""
port: ""
config: ""
db-name: ""
username: ""
password: ""
max-idle-conns: 10
max-open-conns: 100
log-mode: ""
log-zap: false
mssql:
path: ""
port: ""
config: ""
db-name: ""
username: ""
password: ""
max-idle-conns: 10
max-open-conns: 100
log-mode: ""
log-zap: false
sqlite:
path: ""
port: ""
config: ""
db-name: ""
username: ""
password: ""
max-idle-conns: 10
max-open-conns: 100
log-mode: ""
log-zap: false
db-list:
- disable: true # 是否禁用
type: "" # 数据库的类型,目前支持mysql、pgsql、mssql、oracle
alias-name: "" # 数据库的名称,注意: alias-name 需要在db-list中唯一
path: ""
port: ""
config: ""
db-name: ""
username: ""
password: ""
max-idle-conns: 10
max-open-conns: 100
log-mode: ""
log-zap: false
# local configuration
local:
path: uploads/file
store-path: uploads/file
path: uploads/file
store-path: uploads/file
# autocode configuration
autocode:
transfer-restart: true
# root 自动适配项目根目录
# 请不要手动配置,他会在项目加载的时候识别出根路径
root: ""
server: /server
server-plug: /plugin/%s
server-api: /api/v1/%s
server-initialize: /initialize
server-model: /model/%s
server-request: /model/%s/request/
server-router: /router/%s
server-service: /service/%s
web: /web/src
web-api: /api
web-form: /view
web-table: /view
web: web/src
root: "" # root 自动适配项目根目录, 请不要手动配置,他会在项目加载的时候识别出根路径
server: server
module: 'github.com/flipped-aurora/gin-vue-admin/server'
ai-path: "" # AI服务路径
# qiniu configuration (请自行七牛申请对应的 公钥 私钥 bucket 和 域名地址)
qiniu:
zone: ZoneHuaDong
bucket: ""
img-path: ""
use-https: false
access-key: ""
secret-key: ""
use-cdn-domains: false
zone: ZoneHuaDong
bucket: ""
img-path: ""
use-https: false
access-key: ""
secret-key: ""
use-cdn-domains: false
# minio oss configuration
minio:
endpoint: yourEndpoint
access-key-id: yourAccessKeyId
access-key-secret: yourAccessKeySecret
bucket-name: yourBucketName
use-ssl: false
base-path: ""
bucket-url: "http://host:9000/yourBucketName"
# aliyun oss configuration
aliyun-oss:
endpoint: yourEndpoint
access-key-id: yourAccessKeyId
access-key-secret: yourAccessKeySecret
bucket-name: yourBucketName
bucket-url: yourBucketUrl
base-path: yourBasePath
endpoint: yourEndpoint
access-key-id: yourAccessKeyId
access-key-secret: yourAccessKeySecret
bucket-name: yourBucketName
bucket-url: yourBucketUrl
base-path: yourBasePath
# tencent cos configuration
tencent-cos:
bucket: xxxxx-10005608
region: ap-shanghai
secret-id: your-secret-id
secret-key: your-secret-key
base-url: https://gin.vue.admin
path-prefix: github.com/flipped-aurora/gin-vue-admin/server
bucket: xxxxx-10005608
region: ap-shanghai
secret-id: your-secret-id
secret-key: your-secret-key
base-url: https://gin.vue.admin
path-prefix: github.com/flipped-aurora/gin-vue-admin/server
# aws s3 configuration (minio compatible)
aws-s3:
bucket: xxxxx-10005608
region: ap-shanghai
endpoint: ""
s3-force-path-style: false
disable-ssl: false
secret-id: your-secret-id
secret-key: your-secret-key
base-url: https://gin.vue.admin
path-prefix: github.com/flipped-aurora/gin-vue-admin/server
bucket: xxxxx-10005608
region: ap-shanghai
endpoint: ""
s3-force-path-style: false
disable-ssl: false
secret-id: your-secret-id
secret-key: your-secret-key
base-url: https://gin.vue.admin
path-prefix: github.com/flipped-aurora/gin-vue-admin/server
# cloudflare r2 configuration
cloudflare-r2:
bucket: xxxx0bucket
base-url: https://gin.vue.admin.com
path: uploads
account-id: xxx_account_id
access-key-id: xxx_key_id
secret-access-key: xxx_secret_key
# huawei obs configuration
hua-wei-obs:
path: you-path
bucket: you-bucket
endpoint: you-endpoint
access-key: you-access-key
secret-key: you-secret-key
path: you-path
bucket: you-bucket
endpoint: you-endpoint
access-key: you-access-key
secret-key: you-secret-key
# excel configuration
excel:
dir: ./resource/excel/
dir: ./resource/excel/
# timer task db clear table
Timer:
start: true
spec: "@daily" # 定时任务详细配置参考 https://pkg.go.dev/github.com/robfig/cron/v3
detail:
- tableName: sys_operation_records
compareField: created_at
interval: 2160h
- tableName: jwt_blacklists
compareField: created_at
interval: 168h
# disk usage configuration
disk-list:
- mount-point: "/"
# 跨域配置
# 需要配合 server/initialize/router.go -> `Router.Use(middleware.CorsByRules())` 使用
cors:
mode: whitelist # 放行模式: allow-all, 放行全部; whitelist, 白名单模式, 来自白名单内域名的请求添加 cors 头; strict-whitelist 严格白名单模式, 白名单外的请求一律拒绝
whitelist:
- allow-origin: example1.com
allow-headers: content-type
allow-methods: GET, POST
expose-headers: Content-Length, Access-Control-Allow-Origin, Access-Control-Allow-Headers, Content-Type
allow-credentials: true # 布尔值
- allow-origin: example2.com
allow-headers: content-type
allow-methods: GET, POST
expose-headers: Content-Length, Access-Control-Allow-Origin, Access-Control-Allow-Headers, Content-Type
allow-credentials: true # 布尔值
mode: strict-whitelist # 放行模式: allow-all, 放行全部; whitelist, 白名单模式, 来自白名单内域名的请求添加 cors 头; strict-whitelist 严格白名单模式, 白名单外的请求一律拒绝
whitelist:
- allow-origin: example1.com
allow-headers: Content-Type,AccessToken,X-CSRF-Token, Authorization, Token,X-Token,X-User-Id
allow-methods: POST, GET
expose-headers: Content-Length, Access-Control-Allow-Origin, Access-Control-Allow-Headers, Content-Type
allow-credentials: true # 布尔值
- allow-origin: example2.com
allow-headers: content-type
allow-methods: GET, POST
expose-headers: Content-Length, Access-Control-Allow-Origin, Access-Control-Allow-Headers, Content-Type
allow-credentials: true # 布尔值
mcp:
name: GVA_MCP
version: v1.0.0
addr: 8889
separate: false
+228 -176
View File
@@ -2,124 +2,105 @@
# jwt configuration
jwt:
signing-key: qmPlus
expires-time: 7d
buffer-time: 1d
issuer: qmPlus
signing-key: qmPlus
expires-time: 7d
buffer-time: 1d
issuer: qmPlus
# zap logger configuration
zap:
level: info
format: console
prefix: "[github.com/flipped-aurora/gin-vue-admin/server]"
director: log
show-line: true
encode-level: LowercaseColorLevelEncoder
stacktrace-key: stacktrace
log-in-console: true
level: info
format: console
prefix: "[github.com/flipped-aurora/gin-vue-admin/server]"
director: log
show-line: true
encode-level: LowercaseColorLevelEncoder
stacktrace-key: stacktrace
log-in-console: true
retention-day: -1
# redis configuration
redis:
db: 0
addr: 127.0.0.1:6379
password: ""
#是否使用redis集群模式
useCluster: false
#使用集群模式addr和db默认无效
addr: 127.0.0.1:6379
password: ""
db: 0
clusterAddrs:
- "172.21.0.3:7000"
- "172.21.0.4:7001"
- "172.21.0.2:7002"
# redis-list configuration
redis-list:
- name: cache # 数据库的名称,注意: name 需要在 redis-list 中唯一
useCluster: false # 是否使用redis集群模式
addr: 127.0.0.1:6379 # 使用集群模式addr和db默认无效
password: ""
db: 0
clusterAddrs:
- "172.21.0.3:7000"
- "172.21.0.4:7001"
- "172.21.0.2:7002"
# mongo configuration
mongo:
coll: ''
options: ''
database: ''
username: ''
password: ''
auth-source: ''
min-pool-size: 0
max-pool-size: 100
socket-timeout-ms: 0
connect-timeout-ms: 0
is-zap: false
hosts:
- host: ''
port: ''
# email configuration
email:
to: xxx@qq.com
port: 465
from: xxx@163.com
host: smtp.163.com
is-ssl: true
secret: xxx
nickname: test
to: xxx@qq.com
port: 465
from: xxx@163.com
host: smtp.163.com
is-ssl: true
secret: xxx
nickname: test
# system configuration
system:
env: public # Change to "develop" to skip authentication for development mode
addr: 8888
db-type: mysql
oss-type: local # 控制oss选择走本地还是 七牛等其他仓 自行增加其他oss仓可以在 server/utils/upload/upload.go 中 NewOss函数配置
use-redis: false # 使用redis
use-multipoint: false
# IP限制次数 一个小时15000次
iplimit-count: 15000
# IP限制一个小时
iplimit-time: 3600
# 路由全局前缀
router-prefix: ""
env: local # 修改为public可以关闭路由日志输出
addr: 8888
db-type: mysql
oss-type: local # 控制oss选择走本地还是 七牛等其他仓 自行增加其他oss仓可以在 server/utils/upload/upload.go 中 NewOss函数配置
use-redis: false # 使用redis
use-mongo: false # 使用mongo
use-multipoint: false
# IP限制次数 一个小时15000次
iplimit-count: 15000
# IP限制一个小时
iplimit-time: 3600
# 路由全局前缀
router-prefix: ""
# 严格角色模式 打开后权限将会存在上下级关系
use-strict-auth: false
# 禁用自动迁移数据库表结构,生产环境建议设为true,手动迁移
disable-auto-migrate: false
# captcha configuration
captcha:
key-long: 6
img-width: 240
img-height: 80
open-captcha: 0 # 0代表一直开启,大于0代表限制次数
open-captcha-timeout: 3600 # open-captcha大于0时才生效
key-long: 6
img-width: 240
img-height: 80
open-captcha: 0 # 0代表一直开启,大于0代表限制次数
open-captcha-timeout: 3600 # open-captcha大于0时才生效
# mysql connect configuration
# 未初始化之前请勿手动修改数据库信息!!!如果一定要手动初始化请看(https://gin-vue-admin.com/docs/first_master)
mysql:
path: ""
port: ""
config: ""
db-name: ""
username: ""
password: ""
max-idle-conns: 10
max-open-conns: 100
log-mode: ""
log-zap: false
# pgsql connect configuration
# 未初始化之前请勿手动修改数据库信息!!!如果一定要手动初始化请看(https://gin-vue-admin.com/docs/first_master)
pgsql:
path: ""
port: ""
config: ""
db-name: ""
username: ""
password: ""
max-idle-conns: 10
max-open-conns: 100
log-mode: ""
log-zap: false
oracle:
path: ""
port: ""
config: ""
db-name: ""
username: ""
password: ""
max-idle-conns: 10
max-open-conns: 100
log-mode: ""
log-zap: false
mssql:
path: ""
port: ""
config: ""
db-name: ""
username: ""
password: ""
max-idle-conns: 10
max-open-conns: 100
log-mode: ""
log-zap: false
sqlite:
path: ""
port: ""
config: ""
db-name: ""
username: ""
password: ""
max-idle-conns: 10
max-open-conns: 100
log-mode: ""
log-zap: false
db-list:
- disable: true # 是否禁用
type: "" # 数据库的类型,目前支持mysql、pgsql、mssql、oracle
alias-name: "" # 数据库的名称,注意: alias-name 需要在db-list中唯一
path: ""
port: ""
config: ""
@@ -128,110 +109,181 @@ db-list:
password: ""
max-idle-conns: 10
max-open-conns: 100
conn-max-lifetime: 0
log-mode: ""
log-zap: false
# pgsql connect configuration
# 未初始化之前请勿手动修改数据库信息!!!如果一定要手动初始化请看(https://gin-vue-admin.com/docs/first_master)
pgsql:
path: ""
port: ""
config: ""
db-name: ""
username: ""
password: ""
max-idle-conns: 10
max-open-conns: 100
conn-max-lifetime: 0
log-mode: ""
log-zap: false
oracle:
path: ""
port: ""
config: ""
db-name: ""
username: ""
password: ""
max-idle-conns: 10
max-open-conns: 100
conn-max-lifetime: 0
log-mode: ""
log-zap: false
mssql:
path: ""
port: ""
config: ""
db-name: ""
username: ""
password: ""
max-idle-conns: 10
max-open-conns: 100
conn-max-lifetime: 0
log-mode: ""
log-zap: false
sqlite:
path: ""
port: ""
config: ""
db-name: ""
username: ""
password: ""
max-idle-conns: 10
max-open-conns: 100
conn-max-lifetime: 0
log-mode: ""
log-zap: false
db-list:
- disable: true # 是否禁用
type: "" # 数据库的类型,目前支持mysql、pgsql、mssql、oracle
alias-name: "" # 数据库的名称,注意: alias-name 需要在db-list中唯一
path: ""
port: ""
config: ""
db-name: ""
username: ""
password: ""
max-idle-conns: 10
max-open-conns: 100
conn-max-lifetime: 0
log-mode: ""
log-zap: false
# local configuration
local:
path: uploads/file
store-path: uploads/file
path: uploads/file
store-path: uploads/file
# autocode configuration
autocode:
transfer-restart: true
# root 自动适配项目根目录
# 请不要手动配置,他会在项目加载的时候识别出根路径
root: ""
server: /server
server-plug: /plugin/%s
server-api: /api/v1/%s
server-initialize: /initialize
server-model: /model/%s
server-request: /model/%s/request/
server-router: /router/%s
server-service: /service/%s
web: /web/src
web-api: /api
web-form: /view
web-table: /view
web: web/src
root: "" # root 自动适配项目根目录, 请不要手动配置,他会在项目加载的时候识别出根路径
server: server
module: 'github.com/flipped-aurora/gin-vue-admin/server'
ai-path: "" # AI服务路径
# qiniu configuration (请自行七牛申请对应的 公钥 私钥 bucket 和 域名地址)
qiniu:
zone: ZoneHuaDong
bucket: ""
img-path: ""
use-https: false
access-key: ""
secret-key: ""
use-cdn-domains: false
zone: ZoneHuaDong
bucket: ""
img-path: ""
use-https: false
access-key: ""
secret-key: ""
use-cdn-domains: false
# minio oss configuration
minio:
endpoint: yourEndpoint
access-key-id: yourAccessKeyId
access-key-secret: yourAccessKeySecret
bucket-name: yourBucketName
use-ssl: false
base-path: ""
bucket-url: "http://host:9000/yourBucketName"
# aliyun oss configuration
aliyun-oss:
endpoint: yourEndpoint
access-key-id: yourAccessKeyId
access-key-secret: yourAccessKeySecret
bucket-name: yourBucketName
bucket-url: yourBucketUrl
base-path: yourBasePath
endpoint: yourEndpoint
access-key-id: yourAccessKeyId
access-key-secret: yourAccessKeySecret
bucket-name: yourBucketName
bucket-url: yourBucketUrl
base-path: yourBasePath
# tencent cos configuration
tencent-cos:
bucket: xxxxx-10005608
region: ap-shanghai
secret-id: your-secret-id
secret-key: your-secret-key
base-url: https://gin.vue.admin
path-prefix: github.com/flipped-aurora/gin-vue-admin/server
bucket: xxxxx-10005608
region: ap-shanghai
secret-id: your-secret-id
secret-key: your-secret-key
base-url: https://gin.vue.admin
path-prefix: github.com/flipped-aurora/gin-vue-admin/server
# aws s3 configuration (minio compatible)
aws-s3:
bucket: xxxxx-10005608
region: ap-shanghai
endpoint: ""
s3-force-path-style: false
disable-ssl: false
secret-id: your-secret-id
secret-key: your-secret-key
base-url: https://gin.vue.admin
path-prefix: github.com/flipped-aurora/gin-vue-admin/server
bucket: xxxxx-10005608
region: ap-shanghai
endpoint: ""
s3-force-path-style: false
disable-ssl: false
secret-id: your-secret-id
secret-key: your-secret-key
base-url: https://gin.vue.admin
path-prefix: github.com/flipped-aurora/gin-vue-admin/server
# cloudflare r2 configuration
cloudflare-r2:
bucket: xxxx0bucket
base-url: https://gin.vue.admin.com
path: uploads
account-id: xxx_account_id
access-key-id: xxx_key_id
secret-access-key: xxx_secret_key
# huawei obs configuration
hua-wei-obs:
path: you-path
bucket: you-bucket
endpoint: you-endpoint
access-key: you-access-key
secret-key: you-secret-key
path: you-path
bucket: you-bucket
endpoint: you-endpoint
access-key: you-access-key
secret-key: you-secret-key
# excel configuration
excel:
dir: ./resource/excel/
dir: ./resource/excel/
# timer task db clear table
Timer:
start: true
spec: "@daily" # 定时任务详细配置参考 https://pkg.go.dev/github.com/robfig/cron/v3
detail:
- tableName: sys_operation_records
compareField: created_at
interval: 2160h
- tableName: jwt_blacklists
compareField: created_at
interval: 168h
# disk usage configuration
disk-list:
- mount-point: "/"
# 跨域配置
# 需要配合 server/initialize/router.go -> `Router.Use(middleware.CorsByRules())` 使用
cors:
mode: strict-whitelist # 放行模式: allow-all, 放行全部; whitelist, 白名单模式, 来自白名单内域名的请求添加 cors 头; strict-whitelist 严格白名单模式, 白名单外的请求一律拒绝
whitelist:
- allow-origin: example1.com
allow-headers: Content-Type,AccessToken,X-CSRF-Token, Authorization, Token,X-Token,X-User-Id
allow-methods: POST, GET
expose-headers: Content-Length, Access-Control-Allow-Origin, Access-Control-Allow-Headers, Content-Type
allow-credentials: true # 布尔值
- allow-origin: example2.com
allow-headers: content-type
allow-methods: GET, POST
expose-headers: Content-Length, Access-Control-Allow-Origin, Access-Control-Allow-Headers, Content-Type
allow-credentials: true # 布尔值
mode: strict-whitelist # 放行模式: allow-all, 放行全部; whitelist, 白名单模式, 来自白名单内域名的请求添加 cors 头; strict-whitelist 严格白名单模式, 白名单外的请求一律拒绝
whitelist:
- allow-origin: example1.com
allow-headers: Content-Type,AccessToken,X-CSRF-Token, Authorization, Token,X-Token,X-User-Id
allow-methods: POST, GET
expose-headers: Content-Length, Access-Control-Allow-Origin, Access-Control-Allow-Headers, Content-Type
allow-credentials: true # 布尔值
- allow-origin: example2.com
allow-headers: content-type
allow-methods: GET, POST
expose-headers: Content-Length, Access-Control-Allow-Origin, Access-Control-Allow-Headers, Content-Type
allow-credentials: true # 布尔值
mcp:
name: GVA_MCP
version: v1.0.0
addr: 8889
separate: false
+18 -14
View File
@@ -1,18 +1,22 @@
package config
import (
"path/filepath"
"strings"
)
type Autocode struct {
TransferRestart bool `mapstructure:"transfer-restart" json:"transfer-restart" yaml:"transfer-restart"`
Root string `mapstructure:"root" json:"root" yaml:"root"`
Server string `mapstructure:"server" json:"server" yaml:"server"`
SApi string `mapstructure:"server-api" json:"server-api" yaml:"server-api"`
SPlug string `mapstructure:"server-plug" json:"server-plug" yaml:"server-plug"`
SInitialize string `mapstructure:"server-initialize" json:"server-initialize" yaml:"server-initialize"`
SModel string `mapstructure:"server-model" json:"server-model" yaml:"server-model"`
SRequest string `mapstructure:"server-request" json:"server-request" yaml:"server-request"`
SRouter string `mapstructure:"server-router" json:"server-router" yaml:"server-router"`
SService string `mapstructure:"server-service" json:"server-service" yaml:"server-service"`
Web string `mapstructure:"web" json:"web" yaml:"web"`
WApi string `mapstructure:"web-api" json:"web-api" yaml:"web-api"`
WForm string `mapstructure:"web-form" json:"web-form" yaml:"web-form"`
WTable string `mapstructure:"web-table" json:"web-table" yaml:"web-table"`
Web string `mapstructure:"web" json:"web" yaml:"web"`
Root string `mapstructure:"root" json:"root" yaml:"root"`
Server string `mapstructure:"server" json:"server" yaml:"server"`
Module string `mapstructure:"module" json:"module" yaml:"module"`
AiPath string `mapstructure:"ai-path" json:"ai-path" yaml:"ai-path"`
}
func (a *Autocode) WebRoot() string {
webs := strings.Split(a.Web, "/")
if len(webs) == 0 {
webs = strings.Split(a.Web, "\\")
}
return filepath.Join(webs...)
}
+1 -1
View File
@@ -4,6 +4,6 @@ type Captcha struct {
KeyLong int `mapstructure:"key-long" json:"key-long" yaml:"key-long"` // 验证码长度
ImgWidth int `mapstructure:"img-width" json:"img-width" yaml:"img-width"` // 验证码宽度
ImgHeight int `mapstructure:"img-height" json:"img-height" yaml:"img-height"` // 验证码高度
OpenCaptcha int `mapstructure:"open-captcha" json:"open-captcha" yaml:"open-captcha"` // 防爆破验证码开启此数,0代表每次登录都需要验证码,其他数字代表错误密码此数,如3代表错误三次后出现验证码
OpenCaptcha int `mapstructure:"open-captcha" json:"open-captcha" yaml:"open-captcha"` // 防爆破验证码开启此数,0代表每次登录都需要验证码,其他数字代表错误密码次数,如3代表错误三次后出现验证码
OpenCaptchaTimeOut int `mapstructure:"open-captcha-timeout" json:"open-captcha-timeout" yaml:"open-captcha-timeout"` // 防爆破验证码超时时间,单位:s(秒)
}

Some files were not shown because too many files have changed in this diff Show More