diff --git a/server/internal/cmd/tools.go b/server/internal/cmd/tools.go index 07a8b06..99e5e0e 100644 --- a/server/internal/cmd/tools.go +++ b/server/internal/cmd/tools.go @@ -20,7 +20,7 @@ var ( Description: ``, Func: func(ctx context.Context, parser *gcmd.Parser) (err error) { flags := parser.GetOptAll() - g.Log().Debug(ctx, "flags:%+v", flags) + g.Log().Debugf(ctx, "flags:%+v", flags) if len(flags) == 0 { g.Log().Fatal(ctx, "工具参数不能为空") return diff --git a/server/internal/controller/admin/admin/post.go b/server/internal/controller/admin/admin/post.go index 2ba8966..03179fb 100644 --- a/server/internal/controller/admin/admin/post.go +++ b/server/internal/controller/admin/admin/post.go @@ -28,7 +28,7 @@ func (c *cPost) Delete(ctx context.Context, req *post.DeleteReq) (res *post.Dele } err = service.AdminPost().Delete(ctx, in) - return res, nil + return } // Edit 修改/新增 diff --git a/server/internal/library/addons/install.go b/server/internal/library/addons/install.go index e24d81d..85ba87b 100644 --- a/server/internal/library/addons/install.go +++ b/server/internal/library/addons/install.go @@ -35,7 +35,7 @@ func ScanInstall(m Module) (record *InstallRecord, err error) { func IsInstall(m Module) bool { record, err := ScanInstall(m) if err != nil { - g.Log().Debugf(m.Ctx(), err.Error()) + g.Log().Debug(m.Ctx(), err.Error()) return false } if record == nil { diff --git a/server/internal/library/cache/cache.go b/server/internal/library/cache/cache.go index ce6e512..668c933 100644 --- a/server/internal/library/cache/cache.go +++ b/server/internal/library/cache/cache.go @@ -37,7 +37,7 @@ func SetAdapter(ctx context.Context) { if conf == nil { conf = new(model.CacheConfig) - g.Log().Infof(ctx, "no cache driver is configured. default memory cache is used.") + g.Log().Info(ctx, "no cache driver is configured. default memory cache is used.") } switch conf.Adapter { @@ -45,7 +45,7 @@ func SetAdapter(ctx context.Context) { adapter = gcache.NewAdapterRedis(g.Redis()) case "file": if conf.FileDir == "" { - g.Log().Fatalf(ctx, "file path must be configured for file caching.") + g.Log().Fatal(ctx, "file path must be configured for file caching.") return } diff --git a/server/internal/library/contexts/context.go b/server/internal/library/contexts/context.go index b2f86f7..c01d02a 100644 --- a/server/internal/library/contexts/context.go +++ b/server/internal/library/contexts/context.go @@ -34,7 +34,7 @@ func Get(ctx context.Context) *model.Context { func SetUser(ctx context.Context, user *model.Identity) { c := Get(ctx) if c == nil { - g.Log().Warningf(ctx, "contexts.SetUser, c == nil ") + g.Log().Warning(ctx, "contexts.SetUser, c == nil ") return } c.User = user @@ -44,7 +44,7 @@ func SetUser(ctx context.Context, user *model.Identity) { func SetResponse(ctx context.Context, response *model.Response) { c := Get(ctx) if c == nil { - g.Log().Warningf(ctx, "contexts.SetResponse, c == nil ") + g.Log().Warning(ctx, "contexts.SetResponse, c == nil ") return } c.Response = response @@ -54,7 +54,7 @@ func SetResponse(ctx context.Context, response *model.Response) { func SetModule(ctx context.Context, module string) { c := Get(ctx) if c == nil { - g.Log().Warningf(ctx, "contexts.SetModule, c == nil ") + g.Log().Warning(ctx, "contexts.SetModule, c == nil ") return } c.Module = module @@ -64,7 +64,7 @@ func SetModule(ctx context.Context, module string) { func SetTakeUpTime(ctx context.Context, takeUpTime int64) { c := Get(ctx) if c == nil { - g.Log().Warningf(ctx, "contexts.SetTakeUpTime, c == nil ") + g.Log().Warning(ctx, "contexts.SetTakeUpTime, c == nil ") return } c.TakeUpTime = takeUpTime @@ -120,7 +120,7 @@ func GetModule(ctx context.Context) string { func SetAddonName(ctx context.Context, name string) { c := Get(ctx) if c == nil { - g.Log().Warningf(ctx, "contexts.SetAddonName, c == nil ") + g.Log().Warning(ctx, "contexts.SetAddonName, c == nil ") return } Get(ctx).AddonName = name diff --git a/server/internal/library/hggen/views/column_default.go b/server/internal/library/hggen/views/column_default.go index 169e93e..1944004 100644 --- a/server/internal/library/hggen/views/column_default.go +++ b/server/internal/library/hggen/views/column_default.go @@ -109,7 +109,7 @@ func setDefault(field *sysin.GenCodesColumnListModel) { setDefaultValue(field) - if field.IsAllowNull == "YES" { + if field.IsAllowNull == "NO" { field.Required = true } diff --git a/server/internal/library/hgorm/handler/filter_auth.go b/server/internal/library/hgorm/handler/filter_auth.go index ecee5a8..843520f 100644 --- a/server/internal/library/hgorm/handler/filter_auth.go +++ b/server/internal/library/hgorm/handler/filter_auth.go @@ -56,7 +56,7 @@ func FilterAuthWithField(filterField string) func(m *gdb.Model) *gdb.Model { } if role == nil { - g.Log().Panicf(ctx, "failed to role information roleModel == nil") + g.Log().Panic(ctx, "failed to role information roleModel == nil") } sq := g.Model("admin_member").Fields("id") @@ -77,7 +77,7 @@ func FilterAuthWithField(filterField string) func(m *gdb.Model) *gdb.Model { case consts.RoleDataSelfAndAllSub: // 自己和全部下级 m = m.WhereIn(filterField, GetSelfAndAllSub(co.User.Id)) default: - g.Log().Panicf(ctx, "dataScope is not registered") + g.Log().Panic(ctx, "dataScope is not registered") } return m diff --git a/server/internal/library/location/location.go b/server/internal/library/location/location.go index 7a22ba2..00e0262 100644 --- a/server/internal/library/location/location.go +++ b/server/internal/library/location/location.go @@ -174,7 +174,7 @@ func GetPublicIP(ctx context.Context) (ip string, err error) { } if data == nil { - g.Log().Infof(ctx, "publicIP address Parsing failure, check the network and firewall blocking.") + g.Log().Info(ctx, "publicIP address Parsing failure, check the network and firewall blocking.") return "0.0.0.0", nil } return data.Ip, nil diff --git a/server/internal/library/queue/init.go b/server/internal/library/queue/init.go index 159157b..0d83f92 100644 --- a/server/internal/library/queue/init.go +++ b/server/internal/library/queue/init.go @@ -81,7 +81,7 @@ func init() { mqProducerInstanceMap = make(map[string]MqProducer) mqConsumerInstanceMap = make(map[string]MqConsumer) if err := g.Cfg().MustGet(ctx, "queue").Scan(&config); err != nil { - g.Log().Warning(ctx, "queue init err:%+v", err) + g.Log().Warningf(ctx, "queue init err:%+v", err) } } diff --git a/server/internal/logic/admin/menu.go b/server/internal/logic/admin/menu.go index 8ba19a0..b3020b5 100644 --- a/server/internal/logic/admin/menu.go +++ b/server/internal/logic/admin/menu.go @@ -346,6 +346,15 @@ func (s *sAdminMenu) GetMenuList(ctx context.Context, memberId int64) (lists rol if err != nil { return role.DynamicRes{}, err } + if len(array) > 0 { + pidList, err := dao.AdminMenu.Ctx(ctx).Fields("pid").WhereIn("id", array).Group("pid").Array() + if err != nil { + return role.DynamicRes{}, err + } + if len(pidList) > 0 { + array = append(pidList, array...) + } + } mod = mod.Where("id", array) } diff --git a/server/internal/logic/middleware/limit_blacklist.go b/server/internal/logic/middleware/limit_blacklist.go index 725ef02..b07cf1d 100644 --- a/server/internal/logic/middleware/limit_blacklist.go +++ b/server/internal/logic/middleware/limit_blacklist.go @@ -16,7 +16,7 @@ func (s *sMiddleware) Blacklist(r *ghttp.Request) { response.JsonExit(r, gcode.CodeServerBusy.Code(), "请求异常,已被封禁,如有疑问请联系管理员!") } } else { - g.Log().Infof(r.Context(), "blacklists uninitialized") + g.Log().Info(r.Context(), "blacklists uninitialized") } r.Middleware.Next() diff --git a/server/internal/logic/sys/log.go b/server/internal/logic/sys/log.go index d8a37ae..afa6bd9 100644 --- a/server/internal/logic/sys/log.go +++ b/server/internal/logic/sys/log.go @@ -99,7 +99,7 @@ func (s *sSysLog) Export(ctx context.Context, in sysin.LogListInp) (err error) { // RealWrite 真实写入 func (s *sSysLog) RealWrite(ctx context.Context, commonLog entity.SysLog) (err error) { - _, err = dao.SysLog.Ctx(ctx).Data(commonLog).Insert() + _, err = dao.SysLog.Ctx(ctx).Data(commonLog).FieldsEx(dao.SysLog.Columns().Id).Insert() return } diff --git a/server/internal/logic/sys/login_log.go b/server/internal/logic/sys/login_log.go index b30c2c3..02b4178 100644 --- a/server/internal/logic/sys/login_log.go +++ b/server/internal/logic/sys/login_log.go @@ -99,7 +99,7 @@ func (s *sSysLoginLog) List(ctx context.Context, in sysin.LoginLogListInp) (list } for _, v := range list { - g.DumpWithType(v) + //g.DumpWithType(v) //// 获取省市编码对应的地区名称 //region, err := location.ParseRegion(ctx, v.SysLogProvinceId, v.SysLogCityId, 0) //if err != nil { @@ -191,6 +191,6 @@ func (s *sSysLoginLog) Push(ctx context.Context, in sysin.LoginLogPushInp) { // RealWrite 真实写入 func (s *sSysLoginLog) RealWrite(ctx context.Context, models entity.SysLoginLog) (err error) { - _, err = dao.SysLoginLog.Ctx(ctx).Data(models).Insert() + _, err = dao.SysLoginLog.Ctx(ctx).Data(models).FieldsEx(dao.SysLoginLog.Columns().Id).Insert() return } diff --git a/server/internal/logic/sys/serve_log.go b/server/internal/logic/sys/serve_log.go index 4e8d1fc..4681463 100644 --- a/server/internal/logic/sys/serve_log.go +++ b/server/internal/logic/sys/serve_log.go @@ -144,6 +144,6 @@ func (s *sSysServeLog) View(ctx context.Context, in sysin.ServeLogViewInp) (res // RealWrite 真实写入 func (s *sSysServeLog) RealWrite(ctx context.Context, models entity.SysServeLog) (err error) { - _, err = dao.SysServeLog.Ctx(ctx).Data(models).Insert() + _, err = dao.SysServeLog.Ctx(ctx).Data(models).FieldsEx(dao.SysServeLog.Columns().Id).Insert() return } diff --git a/server/internal/websocket/client_manager.go b/server/internal/websocket/client_manager.go index 1e089ef..f6e045d 100644 --- a/server/internal/websocket/client_manager.go +++ b/server/internal/websocket/client_manager.go @@ -291,7 +291,7 @@ func (manager *ClientManager) start() { } } case <-manager.closeSignal: - g.Log().Infof(ctxManager, "websocket closeSignal quit..") + g.Log().Info(ctxManager, "websocket closeSignal quit..") return } diff --git a/server/resource/generate/default/curd/api.go.template b/server/resource/generate/default/curd/api.go.template index d6658e5..e92c8ff 100644 --- a/server/resource/generate/default/curd/api.go.template +++ b/server/resource/generate/default/curd/api.go.template @@ -33,7 +33,7 @@ type ExportReq struct { type ExportRes struct{} @{end} -@{ if eq .options.Step.HasView true } +@{ if or (eq .options.Step.HasView true) (eq .options.Step.HasEdit true) } // ViewReq 获取@{.tableComment}指定信息 type ViewReq struct { g.Meta `path:"/@{.varName | LcFirst}/view" method:"get" tags:"@{.tableComment}" summary:"获取@{.tableComment}指定信息"` diff --git a/server/resource/generate/default/curd/controller.go.template b/server/resource/generate/default/curd/controller.go.template index 5d02213..37c8746 100644 --- a/server/resource/generate/default/curd/controller.go.template +++ b/server/resource/generate/default/curd/controller.go.template @@ -92,7 +92,7 @@ func (c *c@{.varName}) MaxSort(ctx context.Context, req *@{.varName | ToLower}.M return } @{end} -@{ if eq .options.Step.HasView true } +@{ if or (eq .options.Step.HasView true) (eq .options.Step.HasEdit true) } // View 获取指定@{.tableComment}信息 func (c *c@{.varName}) View(ctx context.Context, req *@{.varName | ToLower}.ViewReq) (res *@{.varName | ToLower}.ViewRes, err error) { var in @{.templateGroup}in.@{.varName}ViewInp diff --git a/server/resource/generate/default/curd/input.go.template b/server/resource/generate/default/curd/input.go.template index b07f12e..7085715 100644 --- a/server/resource/generate/default/curd/input.go.template +++ b/server/resource/generate/default/curd/input.go.template @@ -44,7 +44,7 @@ func (in *@{.varName}DeleteInp) Filter(ctx context.Context) (err error) { type @{.varName}DeleteModel struct{} @{end} -@{ if eq .options.Step.HasView true } +@{ if or (eq .options.Step.HasView true) (eq .options.Step.HasEdit true) } // @{.varName}ViewInp 获取指定@{.tableComment}信息 type @{.varName}ViewInp struct { @{.pk.GoName} @{.pk.GoType} `json:"@{.pk.TsName}" v:"required#@{.pk.Dc}不能为空" dc:"@{.pk.Dc}"` diff --git a/server/resource/generate/default/curd/logic.go.template b/server/resource/generate/default/curd/logic.go.template index 0af14ca..b0ad1f2 100644 --- a/server/resource/generate/default/curd/logic.go.template +++ b/server/resource/generate/default/curd/logic.go.template @@ -125,7 +125,7 @@ func (s *s@{.servFunName}) MaxSort(ctx context.Context, in @{.templateGroup}in.@ return } @{end} -@{ if eq .options.Step.HasView true } +@{ if or (eq .options.Step.HasView true) (eq .options.Step.HasEdit true) } // View 获取@{.tableComment}指定信息 func (s *s@{.servFunName}) View(ctx context.Context, in @{.templateGroup}in.@{.varName}ViewInp) (res *@{.templateGroup}in.@{.varName}ViewModel, err error) { err = s.Model(ctx).Where(dao.@{.daoName}.Columns().@{.pk.GoName}, in.@{.pk.GoName}).Scan(&res) diff --git a/server/resource/generate/default/curd/source.sql.template b/server/resource/generate/default/curd/source.sql.template index 55e4265..c94b001 100644 --- a/server/resource/generate/default/curd/source.sql.template +++ b/server/resource/generate/default/curd/source.sql.template @@ -35,7 +35,7 @@ INSERT INTO `@{.menuTable}` (`id`, `pid`, `title`, `name`, `path`, `icon`, `type SET @listId = LAST_INSERT_ID(); -@{ if eq .options.Step.HasView true } +@{ if or (eq .options.Step.HasView true) (eq .options.Step.HasEdit true) } -- 详情 INSERT INTO `@{.menuTable}` (`id`, `pid`, `title`, `name`, `path`, `icon`, `type`, `redirect`, `permissions`, `permission_name`, `component`, `always_show`, `active_menu`, `is_root`, `is_frame`, `frame_src`, `keep_alive`, `hidden`, `affix`, `level`, `tree`, `sort`, `remark`, `status`, `created_at`, `updated_at`) VALUES (NULL, @dirId, '@{.tableComment}详情', '@{.varName | LcFirst}View', 'view/:id?', '', '2', '', '/@{.apiPrefix}/view', '', '/@{.componentPrefix}/view', '0', '@{.varName | LcFirst}Index', '0', '0', '', '0', '1', '0', '2', '', '20', '', '1', @now, @now); @{end} diff --git a/server/resource/generate/default/curd/web.api.ts.template b/server/resource/generate/default/curd/web.api.ts.template index 280a90d..b71cf7c 100644 --- a/server/resource/generate/default/curd/web.api.ts.template +++ b/server/resource/generate/default/curd/web.api.ts.template @@ -48,7 +48,7 @@ export function Switch(params) { }); } @{end} -@{ if eq .options.Step.HasView true } +@{ if or (eq .options.Step.HasView true) (eq .options.Step.HasEdit true) } // 获取@{.tableComment}指定详情 export function View(params) { return http.request({ diff --git a/server/resource/generate/default/curd/web.index.vue.template b/server/resource/generate/default/curd/web.index.vue.template index e8782a1..3ad610c 100644 --- a/server/resource/generate/default/curd/web.index.vue.template +++ b/server/resource/generate/default/curd/web.index.vue.template @@ -92,11 +92,11 @@ @{.apiImport} import { State, columns, schemas, options, newState } from './model'; @{.iconsImport} -@{ if eq .options.Step.HasView true } import { useRouter } from 'vue-router';@{end} +@{ if or (eq .options.Step.HasView true) (eq .options.Step.HasEdit true) } import { useRouter } from 'vue-router';@{end} import { getOptionLabel } from '@/utils/hotgo'; @{ if eq .options.Step.HasEdit true } import Edit from './edit.vue';@{end} const { hasPermission } = usePermission(); -@{ if eq .options.Step.HasView true } const router = useRouter();@{end} +@{ if or (eq .options.Step.HasView true) (eq .options.Step.HasEdit true) } const router = useRouter();@{end} const actionRef = ref(); const dialog = useDialog(); const message = useMessage(); diff --git a/server/utility/validate/validate.go b/server/utility/validate/validate.go index cc698d3..1fd1ac4 100644 --- a/server/utility/validate/validate.go +++ b/server/utility/validate/validate.go @@ -30,7 +30,7 @@ func IsDNSName(s string) bool { func IsHTTPS(ctx context.Context) bool { r := ghttp.RequestFromCtx(ctx) if r == nil { - g.Log().Infof(ctx, "IsHTTPS ctx not request") + g.Log().Info(ctx, "IsHTTPS ctx not request") return false } var ( diff --git a/web/package.json b/web/package.json index 2fcac1f..24c51dc 100644 --- a/web/package.json +++ b/web/package.json @@ -38,6 +38,7 @@ "date-fns": "^2.28.0", "echarts": "^5.3.2", "element-resize-detector": "^1.2.4", + "highlight.js": "^11.8.0", "lodash": "^4.17.21", "lodash-es": "^4.17.21", "mitt": "^2.1.0", diff --git a/web/src/utils/index.ts b/web/src/utils/index.ts index 2b239b8..7b183fc 100644 --- a/web/src/utils/index.ts +++ b/web/src/utils/index.ts @@ -118,7 +118,7 @@ export function getChildrenRouter(routerMap: Array) { * 判断根路由 Router * */ export function isRootRouter(item) { - if (item.meta?.alwaysShow != true && item.children?.length === 1) { + if (item.meta?.alwaysShow != true && item.children?.length === 0) { return true; } diff --git a/web/src/views/apply/provinces/model.ts b/web/src/views/apply/provinces/model.ts index 562b55e..86aff0e 100644 --- a/web/src/views/apply/provinces/model.ts +++ b/web/src/views/apply/provinces/model.ts @@ -99,3 +99,11 @@ export function newState(state: State | null): State { export const options = ref({ sys_normal_disable: [], }); + +async function loadOptions() { + options.value = await Dicts({ + types: ['sys_normal_disable'], + }); +} + +await loadOptions(); \ No newline at end of file diff --git a/web/src/views/develop/addons/index.vue b/web/src/views/develop/addons/index.vue index e37c441..6290384 100644 --- a/web/src/views/develop/addons/index.vue +++ b/web/src/views/develop/addons/index.vue @@ -120,6 +120,7 @@ NIcon, NTag, NIconWrapper, + NAvatar, useMessage, NImage, useDialog, @@ -159,25 +160,13 @@ }); } else { return h( - NIconWrapper, + NAvatar, { size: 48, - borderRadius: 8, + color: '#2D8CF0', }, { - default: () => - h( - NIcon, - { - size: 36, - style: { - marginTop: '-8px', - }, - }, - { - default: () => h(getIconComponent(row.logo)), - } - ), + default: () => h(getIconComponent(row.logo)), } ); } diff --git a/web/src/views/develop/code/components/PreviewTab.vue b/web/src/views/develop/code/components/PreviewTab.vue index 2b92574..3ed6a60 100644 --- a/web/src/views/develop/code/components/PreviewTab.vue +++ b/web/src/views/develop/code/components/PreviewTab.vue @@ -10,7 +10,7 @@ {{ view.path }} - + @@ -19,6 +19,8 @@