From eb8e3ce2d4c1a0a70b00d7391228cdd4e21e5a91 Mon Sep 17 00:00:00 2001 From: sliboy <34034053+sliboy@users.noreply.github.com> Date: Thu, 15 Aug 2024 09:35:08 +0800 Subject: [PATCH 01/20] chore(user.vue): Update user.vue, alter userInfo username to userName. --- web/src/view/superAdmin/user/user.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/web/src/view/superAdmin/user/user.vue b/web/src/view/superAdmin/user/user.vue index 23c260d115..2f8cbbc475 100644 --- a/web/src/view/superAdmin/user/user.vue +++ b/web/src/view/superAdmin/user/user.vue @@ -368,7 +368,7 @@ const deleteUserFunc = async(row) => { // 弹窗相关 const userInfo = ref({ - username: '', + userName: '', password: '', nickName: '', headerImg: '', From 56ca3ae8fb3dfd81e55f205783b77ffa0b8ab845 Mon Sep 17 00:00:00 2001 From: ba0ch3ng Date: Wed, 28 Aug 2024 16:38:21 +0800 Subject: [PATCH 02/20] feat: redis-list support --- server/config.yaml | 11 +++++++++++ server/config/config.go | 15 ++++++++------- server/config/redis.go | 1 + server/core/server.go | 3 +++ server/global/global.go | 25 ++++++++++++++++++------- server/initialize/redis.go | 34 ++++++++++++++++++++++++++++------ 6 files changed, 69 insertions(+), 20 deletions(-) diff --git a/server/config.yaml b/server/config.yaml index c08dca46df..b532a8cbb8 100644 --- a/server/config.yaml +++ b/server/config.yaml @@ -31,6 +31,17 @@ redis: - "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: diff --git a/server/config/config.go b/server/config/config.go index 46de2cb462..6519333cb3 100644 --- a/server/config/config.go +++ b/server/config/config.go @@ -1,13 +1,14 @@ package config type Server struct { - JWT JWT `mapstructure:"jwt" json:"jwt" yaml:"jwt"` - Zap Zap `mapstructure:"zap" json:"zap" yaml:"zap"` - Redis Redis `mapstructure:"redis" json:"redis" yaml:"redis"` - Mongo Mongo `mapstructure:"mongo" json:"mongo" yaml:"mongo"` - Email Email `mapstructure:"email" json:"email" yaml:"email"` - System System `mapstructure:"system" json:"system" yaml:"system"` - Captcha Captcha `mapstructure:"captcha" json:"captcha" yaml:"captcha"` + JWT JWT `mapstructure:"jwt" json:"jwt" yaml:"jwt"` + Zap Zap `mapstructure:"zap" json:"zap" yaml:"zap"` + Redis Redis `mapstructure:"redis" json:"redis" yaml:"redis"` + RedisList []Redis `mapstructure:"redis-list" json:"redis-list" yaml:"redis-list"` + Mongo Mongo `mapstructure:"mongo" json:"mongo" yaml:"mongo"` + Email Email `mapstructure:"email" json:"email" yaml:"email"` + System System `mapstructure:"system" json:"system" yaml:"system"` + Captcha Captcha `mapstructure:"captcha" json:"captcha" yaml:"captcha"` // auto AutoCode Autocode `mapstructure:"autocode" json:"autocode" yaml:"autocode"` // gorm diff --git a/server/config/redis.go b/server/config/redis.go index 33c0ccbbb8..94b5bf6b59 100644 --- a/server/config/redis.go +++ b/server/config/redis.go @@ -1,6 +1,7 @@ package config type Redis struct { + Name string `mapstructure:"name" json:"name" yaml:"name"` // 代表当前实例的名字 Addr string `mapstructure:"addr" json:"addr" yaml:"addr"` // 服务器地址:端口 Password string `mapstructure:"password" json:"password" yaml:"password"` // 密码 DB int `mapstructure:"db" json:"db" yaml:"db"` // 单实例模式下redis的哪个数据库 diff --git a/server/core/server.go b/server/core/server.go index a698c8dacb..4654dbc55a 100644 --- a/server/core/server.go +++ b/server/core/server.go @@ -17,6 +17,9 @@ func RunWindowsServer() { // 初始化redis服务 initialize.Redis() } + + initialize.RedisList() + if global.GVA_CONFIG.System.UseMongo { err := initialize.Mongo.Initialization() if err != nil { diff --git a/server/global/global.go b/server/global/global.go index 017b02f807..7291d2a307 100644 --- a/server/global/global.go +++ b/server/global/global.go @@ -1,9 +1,11 @@ package global import ( + "fmt" + "sync" + "github.com/gin-gonic/gin" "github.com/qiniu/qmgo" - "sync" "github.com/flipped-aurora/gin-vue-admin/server/utils/timer" "github.com/songzhibin97/gkit/cache/local_cache" @@ -20,12 +22,13 @@ import ( ) var ( - GVA_DB *gorm.DB - GVA_DBList map[string]*gorm.DB - GVA_REDIS redis.UniversalClient - GVA_MONGO *qmgo.QmgoClient - GVA_CONFIG config.Server - GVA_VP *viper.Viper + GVA_DB *gorm.DB + GVA_DBList map[string]*gorm.DB + GVA_REDIS redis.UniversalClient + GVA_REDISList map[string]redis.UniversalClient + GVA_MONGO *qmgo.QmgoClient + GVA_CONFIG config.Server + GVA_VP *viper.Viper // GVA_LOG *oplogging.Logger GVA_LOG *zap.Logger GVA_Timer timer.Timer = timer.NewTimerTask() @@ -53,3 +56,11 @@ func MustGetGlobalDBByDBName(dbname string) *gorm.DB { } return db } + +func GetRedis(name string) redis.UniversalClient { + redis, ok := GVA_REDISList[name] + if !ok || redis == nil { + panic(fmt.Sprintf("redis `%s` no init", name)) + } + return redis +} diff --git a/server/initialize/redis.go b/server/initialize/redis.go index 41dfd76e01..2d9c8f4eb8 100644 --- a/server/initialize/redis.go +++ b/server/initialize/redis.go @@ -3,14 +3,14 @@ package initialize import ( "context" + "github.com/flipped-aurora/gin-vue-admin/server/config" "github.com/flipped-aurora/gin-vue-admin/server/global" "github.com/redis/go-redis/v9" "go.uber.org/zap" ) -func Redis() { - redisCfg := global.GVA_CONFIG.Redis +func initRedisClient(redisCfg config.Redis) (redis.UniversalClient, error) { var client redis.UniversalClient // 使用集群模式 if redisCfg.UseCluster { @@ -28,10 +28,32 @@ func Redis() { } pong, err := client.Ping(context.Background()).Result() if err != nil { - global.GVA_LOG.Error("redis connect ping failed, err:", zap.Error(err)) + global.GVA_LOG.Error("redis connect ping failed, err:", zap.String("name", redisCfg.Name), zap.Error(err)) + return nil, err + } + + global.GVA_LOG.Info("redis connect ping response:", zap.String("name", redisCfg.Name), zap.String("pong", pong)) + return client, nil +} + +func Redis() { + redisClient, err := initRedisClient(global.GVA_CONFIG.Redis) + if err != nil { panic(err) - } else { - global.GVA_LOG.Info("redis connect ping response:", zap.String("pong", pong)) - global.GVA_REDIS = client } + global.GVA_REDIS = redisClient +} + +func RedisList() { + redisMap := make(map[string]redis.UniversalClient) + + for _, redisCfg := range global.GVA_CONFIG.RedisList { + client, err := initRedisClient(redisCfg) + if err != nil { + panic(err) + } + redisMap[redisCfg.Name] = client + } + + global.GVA_REDISList = redisMap } From da565883282eef093129052324e9a81865de6525 Mon Sep 17 00:00:00 2001 From: task <121913992@qq.com> Date: Thu, 29 Aug 2024 14:22:16 +0800 Subject: [PATCH 03/20] =?UTF-8?q?=E5=AA=92=E4=BD=93=E5=BA=93=E5=A2=9E?= =?UTF-8?q?=E5=8A=A0=E6=89=B9=E9=87=8F=E5=AF=BC=E5=85=A5URL=EF=BC=9B=20?= =?UTF-8?q?=E6=A0=BC=E5=BC=8F=EF=BC=9A=E6=96=87=E4=BB=B6=E5=90=8D|?= =?UTF-8?q?=E9=93=BE=E6=8E=A5=E6=88=96=E8=80=85=E4=BB=85=E9=93=BE=E6=8E=A5?= =?UTF-8?q?=EF=BC=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 示例: 我的图片|https://my-oss.com/my.png https://my-oss.com/my_1.png --- .../v1/example/exa_file_upload_download.go | 23 +++++++ .../example/exa_file_upload_and_download.go | 1 + .../example/exa_file_upload_download.go | 10 +++ server/source/system/api.go | 1 + server/source/system/casbin.go | 3 + web/src/api/fileUploadAndDownload.js | 13 ++++ web/src/components/upload/common.vue | 1 + web/src/utils/format.js | 14 +++- web/src/view/example/upload/upload.vue | 67 +++++++++++++++++-- web/src/view/systemTools/system/system.vue | 19 ++---- 10 files changed, 133 insertions(+), 19 deletions(-) diff --git a/server/api/v1/example/exa_file_upload_download.go b/server/api/v1/example/exa_file_upload_download.go index 18d1251240..330c8a7982 100644 --- a/server/api/v1/example/exa_file_upload_download.go +++ b/server/api/v1/example/exa_file_upload_download.go @@ -108,3 +108,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) +} diff --git a/server/router/example/exa_file_upload_and_download.go b/server/router/example/exa_file_upload_and_download.go index 19d983c317..84f6ecdb08 100644 --- a/server/router/example/exa_file_upload_and_download.go +++ b/server/router/example/exa_file_upload_and_download.go @@ -17,5 +17,6 @@ func (e *FileUploadAndDownloadRouter) InitFileUploadAndDownloadRouter(Router *gi fileUploadAndDownloadRouter.GET("findFile", exaFileUploadAndDownloadApi.FindFile) // 查询当前文件成功的切片 fileUploadAndDownloadRouter.POST("breakpointContinueFinish", exaFileUploadAndDownloadApi.BreakpointContinueFinish) // 切片传输完成 fileUploadAndDownloadRouter.POST("removeChunk", exaFileUploadAndDownloadApi.RemoveChunk) // 删除切片 + fileUploadAndDownloadRouter.POST("importURL", exaFileUploadAndDownloadApi.ImportURL) // 导入URL } } diff --git a/server/service/example/exa_file_upload_download.go b/server/service/example/exa_file_upload_download.go index 15e2d70cb4..abd4accad1 100644 --- a/server/service/example/exa_file_upload_download.go +++ b/server/service/example/exa_file_upload_download.go @@ -106,3 +106,13 @@ func (e *FileUploadAndDownloadService) UploadFile(header *multipart.FileHeader, } return f, nil } + +//@author: [piexlmax](https://github.com/piexlmax) +//@function: ImportURL +//@description: 导入URL +//@param: file model.SysAttachment +//@return: error + +func (e *FileUploadAndDownloadService) ImportURL(file *[]example.ExaFileUploadAndDownload) error { + return global.GVA_DB.Create(&file).Error +} diff --git a/server/source/system/api.go b/server/source/system/api.go index 30e59e38b7..757f98cf26 100644 --- a/server/source/system/api.go +++ b/server/source/system/api.go @@ -97,6 +97,7 @@ func (i *initApi) InitializeData(ctx context.Context) (context.Context, error) { {ApiGroup: "文件上传与下载", Method: "POST", Path: "/fileUploadAndDownload/deleteFile", Description: "删除文件"}, {ApiGroup: "文件上传与下载", Method: "POST", Path: "/fileUploadAndDownload/editFileName", Description: "文件名或者备注编辑"}, {ApiGroup: "文件上传与下载", Method: "POST", Path: "/fileUploadAndDownload/getFileList", Description: "获取上传文件列表"}, + {ApiGroup: "文件上传与下载", Method: "POST", Path: "/fileUploadAndDownload/importURL", Description: "c"}, {ApiGroup: "系统服务", Method: "POST", Path: "/system/getServerInfo", Description: "获取服务器信息"}, {ApiGroup: "系统服务", Method: "POST", Path: "/system/getSystemConfig", Description: "获取配置文件内容"}, diff --git a/server/source/system/casbin.go b/server/source/system/casbin.go index 92b83c1f0d..a9db0047a3 100644 --- a/server/source/system/casbin.go +++ b/server/source/system/casbin.go @@ -95,6 +95,7 @@ func (i *initCasbin) InitializeData(ctx context.Context) (context.Context, error {Ptype: "p", V0: "888", V1: "/fileUploadAndDownload/deleteFile", V2: "POST"}, {Ptype: "p", V0: "888", V1: "/fileUploadAndDownload/editFileName", V2: "POST"}, {Ptype: "p", V0: "888", V1: "/fileUploadAndDownload/getFileList", V2: "POST"}, + {Ptype: "p", V0: "888", V1: "/fileUploadAndDownload/importURL", V2: "POST"}, {Ptype: "p", V0: "888", V1: "/casbin/updateCasbin", V2: "POST"}, {Ptype: "p", V0: "888", V1: "/casbin/getPolicyPathByAuthorityId", V2: "POST"}, @@ -203,6 +204,7 @@ func (i *initCasbin) InitializeData(ctx context.Context) (context.Context, error {Ptype: "p", V0: "8881", V1: "/fileUploadAndDownload/getFileList", V2: "POST"}, {Ptype: "p", V0: "8881", V1: "/fileUploadAndDownload/deleteFile", V2: "POST"}, {Ptype: "p", V0: "8881", V1: "/fileUploadAndDownload/editFileName", V2: "POST"}, + {Ptype: "p", V0: "8881", V1: "/fileUploadAndDownload/importURL", V2: "POST"}, {Ptype: "p", V0: "8881", V1: "/casbin/updateCasbin", V2: "POST"}, {Ptype: "p", V0: "8881", V1: "/casbin/getPolicyPathByAuthorityId", V2: "POST"}, {Ptype: "p", V0: "8881", V1: "/jwt/jsonInBlacklist", V2: "POST"}, @@ -244,6 +246,7 @@ func (i *initCasbin) InitializeData(ctx context.Context) (context.Context, error {Ptype: "p", V0: "9528", V1: "/fileUploadAndDownload/getFileList", V2: "POST"}, {Ptype: "p", V0: "9528", V1: "/fileUploadAndDownload/deleteFile", V2: "POST"}, {Ptype: "p", V0: "9528", V1: "/fileUploadAndDownload/editFileName", V2: "POST"}, + {Ptype: "p", V0: "9528", V1: "/fileUploadAndDownload/importURL", V2: "POST"}, {Ptype: "p", V0: "9528", V1: "/casbin/updateCasbin", V2: "POST"}, {Ptype: "p", V0: "9528", V1: "/casbin/getPolicyPathByAuthorityId", V2: "POST"}, {Ptype: "p", V0: "9528", V1: "/jwt/jsonInBlacklist", V2: "POST"}, diff --git a/web/src/api/fileUploadAndDownload.js b/web/src/api/fileUploadAndDownload.js index 0a5d0211db..2bff5bb47e 100644 --- a/web/src/api/fileUploadAndDownload.js +++ b/web/src/api/fileUploadAndDownload.js @@ -42,3 +42,16 @@ export const editFileName = (data) => { data }) } + +/** + * 导入URL + * @param data + * @returns {*} + */ +export const importURL = (data) => { + return service({ + url: '/fileUploadAndDownload/importURL', + method: 'post', + data + }) +} diff --git a/web/src/components/upload/common.vue b/web/src/components/upload/common.vue index a010e2cd9f..94d30d00a9 100644 --- a/web/src/components/upload/common.vue +++ b/web/src/components/upload/common.vue @@ -6,6 +6,7 @@ :on-error="uploadError" :on-success="uploadSuccess" :show-file-list="false" + multiple class="upload-btn" > 普通上传 diff --git a/web/src/utils/format.js b/web/src/utils/format.js index cf3f1a05a8..4fd9ad80df 100644 --- a/web/src/utils/format.js +++ b/web/src/utils/format.js @@ -124,4 +124,16 @@ const baseUrl = ref(import.meta.env.VITE_BASE_API) export const getBaseUrl = () => { return baseUrl.value === "/" ? "" : baseUrl.value -} \ No newline at end of file +} + +export const CreateUUID = () => { + let d = new Date().getTime() + if (window.performance && typeof window.performance.now === 'function') { + d += performance.now() + } + return '00000000-0000-0000-0000-000000000000'.replace(/0/g, (c) => { + const r = (d + Math.random() * 16) % 16 | 0 // d是随机种子 + d = Math.floor(d / 16) + return (c === '0' ? r : (r & 0x3 | 0x8)).toString(16) + }) +} diff --git a/web/src/view/example/upload/upload.vue b/web/src/view/example/upload/upload.vue index 727cc5645c..1b08a837d7 100644 --- a/web/src/view/example/upload/upload.vue +++ b/web/src/view/example/upload/upload.vue @@ -15,9 +15,16 @@ :max-w-h="1080" @on-success="getTableData" /> + + 导入URL + diff --git a/web/src/view/systemTools/system/system.vue b/web/src/view/systemTools/system/system.vue index 634df9e35d..83b370feb9 100644 --- a/web/src/view/systemTools/system/system.vue +++ b/web/src/view/systemTools/system/system.vue @@ -13,7 +13,7 @@ class="mt-3.5" > - + - 开启 + @@ -75,7 +75,7 @@ @@ -682,6 +682,7 @@ import { ref } from 'vue' import { ElMessage, ElMessageBox } from 'element-plus' import { Minus, Plus } from '@element-plus/icons-vue' import { emailTest } from '@/api/email' +import {CreateUUID} from "@/utils/format"; defineOptions({ name: 'Config', @@ -795,16 +796,8 @@ const email = async() => { } } -const CreateUUID = () => { - let d = new Date().getTime() - if (window.performance && typeof window.performance.now === 'function') { - d += performance.now() - } - config.value.jwt['signing-key'] = '00000000-0000-0000-0000-000000000000'.replace(/0/g, (c) => { - const r = (d + Math.random() * 16) % 16 | 0 // d是随机种子 - d = Math.floor(d / 16) - return (c === '0' ? r : (r & 0x3 | 0x8)).toString(16) - }) +const getUUID = () => { + config.value.jwt['signing-key'] = CreateUUID() } const addNode = () => { From c1d5e9535025860e258f7ea69aba8333e146ab58 Mon Sep 17 00:00:00 2001 From: task <121913992@qq.com> Date: Thu, 29 Aug 2024 15:09:43 +0800 Subject: [PATCH 04/20] =?UTF-8?q?fix=20=E6=8F=8F=E8=BF=B0=E9=94=99?= =?UTF-8?q?=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- server/service/example/exa_file_upload_download.go | 2 +- server/source/system/api.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/server/service/example/exa_file_upload_download.go b/server/service/example/exa_file_upload_download.go index abd4accad1..85b7d3387e 100644 --- a/server/service/example/exa_file_upload_download.go +++ b/server/service/example/exa_file_upload_download.go @@ -110,7 +110,7 @@ func (e *FileUploadAndDownloadService) UploadFile(header *multipart.FileHeader, //@author: [piexlmax](https://github.com/piexlmax) //@function: ImportURL //@description: 导入URL -//@param: file model.SysAttachment +//@param: file model.ExaFileUploadAndDownload //@return: error func (e *FileUploadAndDownloadService) ImportURL(file *[]example.ExaFileUploadAndDownload) error { diff --git a/server/source/system/api.go b/server/source/system/api.go index 757f98cf26..a5f198fb29 100644 --- a/server/source/system/api.go +++ b/server/source/system/api.go @@ -97,7 +97,7 @@ func (i *initApi) InitializeData(ctx context.Context) (context.Context, error) { {ApiGroup: "文件上传与下载", Method: "POST", Path: "/fileUploadAndDownload/deleteFile", Description: "删除文件"}, {ApiGroup: "文件上传与下载", Method: "POST", Path: "/fileUploadAndDownload/editFileName", Description: "文件名或者备注编辑"}, {ApiGroup: "文件上传与下载", Method: "POST", Path: "/fileUploadAndDownload/getFileList", Description: "获取上传文件列表"}, - {ApiGroup: "文件上传与下载", Method: "POST", Path: "/fileUploadAndDownload/importURL", Description: "c"}, + {ApiGroup: "文件上传与下载", Method: "POST", Path: "/fileUploadAndDownload/importURL", Description: "导入URL"}, {ApiGroup: "系统服务", Method: "POST", Path: "/system/getServerInfo", Description: "获取服务器信息"}, {ApiGroup: "系统服务", Method: "POST", Path: "/system/getSystemConfig", Description: "获取配置文件内容"}, From d1b7c2df2dad54453a3dee264cc7b819eb192897 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?pixelMax=28=E5=A5=87=E6=B7=BC?= Date: Tue, 3 Sep 2024 11:48:43 +0800 Subject: [PATCH 05/20] =?UTF-8?q?feature:=20=E8=87=AA=E5=8A=A8=E5=8C=96?= =?UTF-8?q?=E4=BB=A3=E7=A0=81=E6=96=B9=E6=B3=95=E6=94=AF=E6=8C=81=E5=A2=9E?= =?UTF-8?q?=E5=8A=A0=E6=96=B9=E6=B3=95=E6=8F=8F=E8=BF=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- server/model/system/request/sys_auto_code.go | 1 + server/resource/function/api.go.tpl | 8 ++++---- server/resource/function/api.js.tpl | 8 ++++---- server/resource/function/server.go.tpl | 4 ++-- web/src/view/systemTools/autoCodeAdmin/index.vue | 5 +++++ 5 files changed, 16 insertions(+), 10 deletions(-) diff --git a/server/model/system/request/sys_auto_code.go b/server/model/system/request/sys_auto_code.go index 7737bbd582..2957a1fc59 100644 --- a/server/model/system/request/sys_auto_code.go +++ b/server/model/system/request/sys_auto_code.go @@ -236,6 +236,7 @@ type AutoFunc struct { Package string `json:"package"` FuncName string `json:"funcName"` // 方法名称 Router string `json:"router"` // 路由名称 + FuncDesc string `json:"funcDesc"` // 方法介绍 BusinessDB string `json:"businessDB"` // 业务库 StructName string `json:"structName"` // Struct名称 PackageName string `json:"packageName"` // 文件名称 diff --git a/server/resource/function/api.go.tpl b/server/resource/function/api.go.tpl index c788a9fa18..dae9cee751 100644 --- a/server/resource/function/api.go.tpl +++ b/server/resource/function/api.go.tpl @@ -1,7 +1,7 @@ {{if .IsPlugin}} -// {{.FuncName}} 等待开发的的{{.Description}}接口 +// {{.FuncName}} {{.FuncDesc}} // @Tags {{.StructName}} -// @Summary 等待开发的的{{.Description}}接口 +// @Summary {{.FuncDesc}} // @accept application/json // @Produce application/json // @Param data query request.{{.StructName}}Search true "分页获取{{.Description}}列表" @@ -20,9 +20,9 @@ func (a *{{.Abbreviation}}) {{.FuncName}}(c *gin.Context) { {{- else -}} -// {{.FuncName}} 等待开发的的{{.Description}}接口 +// {{.FuncName}} {{.FuncDesc}} // @Tags {{.StructName}} -// @Summary 等待开发的的{{.Description}}接口 +// @Summary {{.FuncDesc}} // @accept application/json // @Produce application/json // @Param data query {{.Package}}Req.{{.StructName}}Search true "成功" diff --git a/server/resource/function/api.js.tpl b/server/resource/function/api.js.tpl index 524e8320f8..003438cc11 100644 --- a/server/resource/function/api.js.tpl +++ b/server/resource/function/api.js.tpl @@ -1,7 +1,7 @@ {{if .IsPlugin}} -// {{.FuncName}} 等待开发的的{{.Description}}接口 +// {{.FuncName}} {{.FuncDesc}} // @Tags {{.StructName}} -// @Summary 等待开发的的{{.Description}}接口 +// @Summary {{.FuncDesc}} // @accept application/json // @Produce application/json // @Param data query request.{{.StructName}}Search true "分页获取{{.Description}}列表" @@ -16,9 +16,9 @@ export const {{.Router}} = () => { {{- else -}} -// {{.FuncName}} 等待开发的的{{.Description}}接口 +// {{.FuncName}} {{.FuncDesc}} // @Tags {{.StructName}} -// @Summary 等待开发的的{{.Description}}接口 +// @Summary {{.FuncDesc}} // @accept application/json // @Produce application/json // @Param data query {{.Package}}Req.{{.StructName}}Search true "成功" diff --git a/server/resource/function/server.go.tpl b/server/resource/function/server.go.tpl index da3f4fe224..1c5191c4b4 100644 --- a/server/resource/function/server.go.tpl +++ b/server/resource/function/server.go.tpl @@ -6,7 +6,7 @@ {{- end}} {{if .IsPlugin}} -// {{.FuncName}} 请实现方法 +// {{.FuncName}} {{.FuncDesc}} // Author [yourname](https://github.com/yourname) func (s *{{.Abbreviation}}) {{.FuncName}}() (err error) { db := {{$db}}.Model(&model.{{.StructName}}{}) @@ -15,7 +15,7 @@ func (s *{{.Abbreviation}}) {{.FuncName}}() (err error) { {{- else -}} -// {{.FuncName}} 请实现方法 +// {{.FuncName}} {{.FuncDesc}} // Author [yourname](https://github.com/yourname) func ({{.Abbreviation}}Service *{{.StructName}}Service){{.FuncName}}() (err error) { // 请在这里实现自己的业务逻辑 diff --git a/web/src/view/systemTools/autoCodeAdmin/index.vue b/web/src/view/systemTools/autoCodeAdmin/index.vue index 410d09e985..4ff10b5332 100644 --- a/web/src/view/systemTools/autoCodeAdmin/index.vue +++ b/web/src/view/systemTools/autoCodeAdmin/index.vue @@ -177,6 +177,9 @@ + + + @@ -238,6 +241,7 @@ const autoFunc = ref({ humpPackageName:"", businessDB:"", method:"", + funcDesc: "" }) const addFuncBtn = (row) => { @@ -252,6 +256,7 @@ const addFuncBtn = (row) => { autoFunc.value.method = "" autoFunc.value.funcName = "" autoFunc.value.router = "" + autoFunc.value.funcDesc = "方法介绍" funcFlag.value = true; }; From 75500cfdee0a6367c12c8eb29473f27346ddcde2 Mon Sep 17 00:00:00 2001 From: pixelmaxQM Date: Wed, 4 Sep 2024 23:35:19 +0800 Subject: [PATCH 06/20] =?UTF-8?q?update:=20=E6=9B=B4=E6=96=B0=E4=BE=9D?= =?UTF-8?q?=E8=B5=96=EF=BC=8C=E5=8D=87=E7=BA=A7=E4=B8=BA=E6=9C=80=E6=96=B0?= =?UTF-8?q?=E7=89=88=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- web/package.json | 68 ++++++++++++++++++++++++------------------------ 1 file changed, 34 insertions(+), 34 deletions(-) diff --git a/web/package.json b/web/package.json index 5cf146f1ae..b3baa445dc 100644 --- a/web/package.json +++ b/web/package.json @@ -10,58 +10,58 @@ "fix-memory-limit": "cross-env LIMIT=4096 increase-memory-limit" }, "dependencies": { - "@element-plus/icons-vue": "^2.1.0", - "@vue-office/docx": "^1.3.0", - "@vue-office/excel": "^1.4.5", - "@vue-office/pdf": "^1.5.3", - "@vueuse/core": "^10.7.2", + "@element-plus/icons-vue": "^2.3.1", + "@vue-office/docx": "^1.6.2", + "@vue-office/excel": "^1.7.11", + "@vue-office/pdf": "^2.0.2", + "@vueuse/core": "^11.0.3", "@wangeditor/editor": "^5.1.23", "@wangeditor/editor-for-vue": "^5.1.12", - "axios": "^1.4.0", - "core-js": "^3.31.1", + "axios": "^1.7.7", + "core-js": "^3.38.1", "default-passive-events": "^2.0.0", - "echarts": "5.4.3", - "element-plus": "^2.7.4", - "highlight.js": "^11.8.0", + "echarts": "5.5.1", + "element-plus": "^2.8.1", + "highlight.js": "^11.10.0", "js-cookie": "^3.0.5", - "marked": "4.3.0", + "marked": "14.1.1", "mitt": "^3.0.1", "nprogress": "^0.2.0", "path": "^0.12.7", - "pinia": "^2.1.4", - "qs": "^6.11.2", + "pinia": "^2.2.2", + "qs": "^6.13.0", "screenfull": "^6.0.2", - "sortablejs": "^1.15.2", + "sortablejs": "^1.15.3", "spark-md5": "^3.0.2", - "tailwindcss": "^3.3.3", + "tailwindcss": "^3.4.10", "vite-auto-import-svg": "^1.0.0", - "vue": "^3.4.21", - "vue-echarts": "^6.7.2", - "vue-router": "^4.3.2", + "vue": "^3.5.1", + "vue-echarts": "^7.0.3", + "vue-router": "^4.4.3", "vuedraggable": "^4.1.0" }, "devDependencies": { - "@babel/eslint-parser": "^7.22.9", - "@vitejs/plugin-legacy": "^4.1.0", - "@vitejs/plugin-vue": "^4.2.3", + "@babel/eslint-parser": "^7.25.1", + "@vitejs/plugin-legacy": "^5.4.2", + "@vitejs/plugin-vue": "^5.1.3", "@vue/cli-plugin-babel": "~5.0.8", "@vue/cli-plugin-eslint": "~5.0.8", "@vue/cli-plugin-router": "~5.0.8", "@vue/cli-plugin-vuex": "~5.0.8", "@vue/cli-service": "~5.0.8", - "@vue/compiler-sfc": "^3.3.4", - "babel-plugin-import": "^1.13.6", - "chalk": "^4.1.2", - "dotenv": "^16.3.1", - "eslint": "^8.49.0", - "eslint-plugin-vue": "^9.15.1", - "sass": "^1.54.0", - "terser": "^5.19.1", - "unplugin-auto-import": "^0.16.6", - "unplugin-vue-components": "^0.25.1", - "vite": "^4.4.6", - "vite-plugin-banner": "^0.7.0", + "@vue/compiler-sfc": "^3.5.1", + "babel-plugin-import": "^1.13.8", + "chalk": "^5.3.0", + "dotenv": "^16.4.5", + "eslint": "^9.9.1", + "eslint-plugin-vue": "^9.28.0", + "sass": "^1.78.0", + "terser": "^5.31.6", + "unplugin-auto-import": "^0.18.2", + "unplugin-vue-components": "^0.27.4", + "vite": "^5.4.3", + "vite-plugin-banner": "^0.8.0", "vite-plugin-importer": "^0.2.5", - "vite-plugin-vue-devtools": "^7.3.7" + "vite-plugin-vue-devtools": "^7.4.4" } } From 8818c25deaf37bd12540af0d48e56417d6fac641 Mon Sep 17 00:00:00 2001 From: pixelmaxQM Date: Wed, 4 Sep 2024 23:55:49 +0800 Subject: [PATCH 07/20] =?UTF-8?q?feature:=20=E8=87=AA=E5=8A=A8=E5=8C=96?= =?UTF-8?q?=E4=BB=A3=E7=A0=81=E9=A2=84=E8=A7=88=E9=83=A8=E5=88=86=E6=94=AF?= =?UTF-8?q?=E6=8C=81=E9=BB=91=E5=A4=9C=E6=A8=A1=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- server/service/system/auto_code_template.go | 4 +- web/package.json | 1 + web/src/core/config.js | 81 ++++--------------- .../autoCode/component/previewCodeDialg.vue | 48 ++++++----- 4 files changed, 47 insertions(+), 87 deletions(-) diff --git a/server/service/system/auto_code_template.go b/server/service/system/auto_code_template.go index 782880a884..7c55d5f856 100644 --- a/server/service/system/auto_code_template.go +++ b/server/service/system/auto_code_template.go @@ -200,8 +200,10 @@ func (s *autoCodeTemplate) Preview(ctx context.Context, info request.AutoCode) ( if len(key) > len(global.GVA_CONFIG.AutoCode.Root) { key, _ = filepath.Rel(global.GVA_CONFIG.AutoCode.Root, key) } + // 获取key的后缀 取消. + suffix := filepath.Ext(key)[1:] var builder strings.Builder - builder.WriteString("```\n\n") + builder.WriteString("```" + suffix + "\n\n") builder.WriteString(writer.String()) builder.WriteString("\n\n```") preview[key] = builder.String() diff --git a/web/package.json b/web/package.json index b3baa445dc..3360335e24 100644 --- a/web/package.json +++ b/web/package.json @@ -25,6 +25,7 @@ "highlight.js": "^11.10.0", "js-cookie": "^3.0.5", "marked": "14.1.1", + "marked-highlight": "^2.1.4", "mitt": "^3.0.1", "nprogress": "^0.2.0", "path": "^0.12.7", diff --git a/web/src/core/config.js b/web/src/core/config.js index 836cde3199..eb3eb08a69 100644 --- a/web/src/core/config.js +++ b/web/src/core/config.js @@ -1,7 +1,7 @@ /** * 网站配置文件 */ -import chalk from "chalk"; +const greenText = (text) => `\x1b[32m${text}\x1b[0m`; const config = { appName: 'Gin-Vue-Admin', @@ -12,72 +12,19 @@ const config = { export const viteLogo = (env) => { if (config.showViteLogo) { - const chalk = require('chalk') - console.log( - chalk.green( - `> 欢迎使用Gin-Vue-Admin,开源地址:https://github.com/flipped-aurora/gin-vue-admin` - ) - ) - console.log( - chalk.green( - `> 当前版本:v2.7.3` - ) - ) - console.log( - chalk.green( - `> 加群方式:微信:shouzi_1994 QQ群:470239250` - ) - ) - console.log( - chalk.green( - `> 项目地址:https://github.com/flipped-aurora/gin-vue-admin` - ) - ) - console.log( - chalk.green( - `> 插件市场:https://plugin.gin-vue-admin.com` - ) - ) - console.log( - chalk.green( - `> GVA讨论社区:https://support.qq.com/products/371961` - ) - ) - console.log( - chalk.green( - `> 默认自动化文档地址:http://127.0.0.1:${env.VITE_SERVER_PORT}/swagger/index.html` - ) - ) - console.log( - chalk.green( - `> 默认前端文件运行地址:http://127.0.0.1:${env.VITE_CLI_PORT}` - ) - ) - - console.log( - chalk.green( - `--------------------------------------版权声明--------------------------------------` - ) - ) - - console.log( - chalk.green( - `** 版权所有方:flipped-aurora开源团队 **` - ) - ) - - console.log( - chalk.green( - `** 版权持有公司:北京翻转极光科技有限责任公司 **` - ) - ) - - console.log( - chalk.green( - `** 剔除授权标识需购买商用授权:https://gin-vue-admin.com/empower/index.html **` - ) - ) - console.log('\n') + console.log(greenText(`> 欢迎使用Gin-Vue-Admin,开源地址:https://github.com/flipped-aurora/gin-vue-admin`)); + console.log(greenText(`> 当前版本:v2.7.3`)); + console.log(greenText(`> 加群方式:微信:shouzi_1994 QQ群:470239250`)); + console.log(greenText(`> 项目地址:https://github.com/flipped-aurora/gin-vue-admin`)); + console.log(greenText(`> 插件市场:https://plugin.gin-vue-admin.com`)); + console.log(greenText(`> GVA讨论社区:https://support.qq.com/products/371961`)); + console.log(greenText(`> 默认自动化文档地址:http://127.0.0.1:${env.VITE_SERVER_PORT}/swagger/index.html`)); + console.log(greenText(`> 默认前端文件运行地址:http://127.0.0.1:${env.VITE_CLI_PORT}`)); + console.log(greenText(`--------------------------------------版权声明--------------------------------------`)); + console.log(greenText(`** 版权所有方:flipped-aurora开源团队 **`)); + console.log(greenText(`** 版权持有公司:北京翻转极光科技有限责任公司 **`)); + console.log(greenText(`** 剔除授权标识需购买商用授权:https://gin-vue-admin.com/empower/index.html **`)); + console.log('\n'); } } diff --git a/web/src/view/systemTools/autoCode/component/previewCodeDialg.vue b/web/src/view/systemTools/autoCode/component/previewCodeDialg.vue index aa36444970..6d78672bcc 100644 --- a/web/src/view/systemTools/autoCode/component/previewCodeDialg.vue +++ b/web/src/view/systemTools/autoCode/component/previewCodeDialg.vue @@ -8,18 +8,30 @@ >
+ +{{- end }} diff --git a/server/resource/package/web/view/table.vue.tpl b/server/resource/package/web/view/table.vue.tpl index 5f35723bdf..556cb828f8 100644 --- a/server/resource/package/web/view/table.vue.tpl +++ b/server/resource/package/web/view/table.vue.tpl @@ -1,5 +1,6 @@ {{- $global := . }} {{- $templateID := printf "%s_%s" .Package .StructName }} +{{- if not .OnlyTemplate}}