@@ -3,6 +3,12 @@ package system
33import (
44 "context"
55 "fmt"
6+ "go/token"
7+ "os"
8+ "path/filepath"
9+ "strings"
10+ "text/template"
11+
612 "github.com/flipped-aurora/gin-vue-admin/server/global"
713 common "github.com/flipped-aurora/gin-vue-admin/server/model/common/request"
814 model "github.com/flipped-aurora/gin-vue-admin/server/model/system"
@@ -11,12 +17,7 @@ import (
1117 "github.com/flipped-aurora/gin-vue-admin/server/utils/ast"
1218 "github.com/flipped-aurora/gin-vue-admin/server/utils/autocode"
1319 "github.com/pkg/errors"
14- "go/token"
1520 "gorm.io/gorm"
16- "os"
17- "path/filepath"
18- "strings"
19- "text/template"
2021)
2122
2223var AutoCodePackage = new (autoCodePackage )
@@ -162,7 +163,6 @@ func (s *autoCodePackage) All(ctx context.Context) (entities []model.SysAutoCode
162163 "api" : true ,
163164 "config" : true ,
164165 "initialize" : true ,
165- "model" : true ,
166166 "plugin" : true ,
167167 "router" : true ,
168168 "service" : true ,
@@ -179,14 +179,25 @@ func (s *autoCodePackage) All(ctx context.Context) (entities []model.SysAutoCode
179179 }
180180 }
181181 }
182- if len (dirNameMap ) != 0 {
183- continue
182+
183+ var desc string
184+ if len (dirNameMap ) == 0 {
185+ // 完全符合标准结构
186+ desc = "系统自动读取" + pluginDir [i ].Name () + "插件,使用前请确认是否为v2版本插件"
187+ } else {
188+ // 缺少某些结构,生成警告描述
189+ var missingDirs []string
190+ for dirName := range dirNameMap {
191+ missingDirs = append (missingDirs , dirName )
192+ }
193+ desc = fmt .Sprintf ("系统自动读取,但是缺少 %s 结构,不建议自动化和mcp使用" , strings .Join (missingDirs , "、" ))
184194 }
195+
185196 pluginPackage := model.SysAutoCodePackage {
186197 PackageName : pluginDir [i ].Name (),
187198 Template : "plugin" ,
188199 Label : pluginDir [i ].Name () + "插件" ,
189- Desc : "系统自动读取" + pluginDir [ i ]. Name () + "插件,使用前请确认是否为v2版本插件" ,
200+ Desc : desc ,
190201 Module : global .GVA_CONFIG .AutoCode .Module ,
191202 }
192203 plugin = append (plugin , pluginPackage )
0 commit comments