mirror of
https://github.com/flipped-aurora/gin-vue-admin.git
synced 2026-09-28 06:57:50 +00:00
* 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>
144 lines
4.5 KiB
Go
144 lines
4.5 KiB
Go
package system
|
|
|
|
import (
|
|
"fmt"
|
|
"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 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)
|
|
}
|