befly 3.10.13 → 3.10.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/befly.config.ts CHANGED
@@ -39,8 +39,7 @@ const defaultOptions: BeflyOptions = {
39
39
  username: "root",
40
40
  password: "root",
41
41
  database: "befly_demo",
42
- poolMax: 10,
43
- debug: 0
42
+ poolMax: 10
44
43
  },
45
44
 
46
45
  // ========== Redis 配置 ==========
@@ -7,8 +7,8 @@ import { CacheKeys } from "./cacheKeys.js";
7
7
  import { Logger } from "./logger.js";
8
8
 
9
9
  type CacheHelperDb = {
10
- tableExists(table: string): Promise<boolean>;
11
- getAll(options: any): Promise<{ lists: any[] }>;
10
+ tableExists(table: string): Promise<{ data: boolean }>;
11
+ getAll(options: any): Promise<{ data: { lists: any[] } }>;
12
12
  };
13
13
 
14
14
  type CacheHelperRedis = {
@@ -107,7 +107,7 @@ export class CacheHelper {
107
107
  try {
108
108
  // 检查表是否存在
109
109
  const tableExists = await this.db.tableExists("addon_admin_api");
110
- if (!tableExists) {
110
+ if (!tableExists.data) {
111
111
  Logger.warn("⚠️ 接口表不存在,跳过接口缓存");
112
112
  return;
113
113
  }
@@ -118,7 +118,7 @@ export class CacheHelper {
118
118
  });
119
119
 
120
120
  // 缓存到 Redis
121
- const result = await this.redis.setObject(CacheKeys.apisAll(), apiList.lists);
121
+ const result = await this.redis.setObject(CacheKeys.apisAll(), apiList.data.lists);
122
122
 
123
123
  if (result === null) {
124
124
  Logger.warn("⚠️ 接口缓存失败");
@@ -135,7 +135,7 @@ export class CacheHelper {
135
135
  try {
136
136
  // 检查表是否存在
137
137
  const tableExists = await this.db.tableExists("addon_admin_menu");
138
- if (!tableExists) {
138
+ if (!tableExists.data) {
139
139
  Logger.warn("⚠️ 菜单表不存在,跳过菜单缓存");
140
140
  return;
141
141
  }
@@ -146,7 +146,7 @@ export class CacheHelper {
146
146
  });
147
147
 
148
148
  // 缓存到 Redis
149
- const result = await this.redis.setObject(CacheKeys.menusAll(), menus.lists);
149
+ const result = await this.redis.setObject(CacheKeys.menusAll(), menus.data.lists);
150
150
 
151
151
  if (result === null) {
152
152
  Logger.warn("⚠️ 菜单缓存失败");
@@ -166,7 +166,7 @@ export class CacheHelper {
166
166
  // 检查表是否存在
167
167
  const roleTableExists = await this.db.tableExists("addon_admin_role");
168
168
 
169
- if (!roleTableExists) {
169
+ if (!roleTableExists.data) {
170
170
  Logger.warn("⚠️ 角色表不存在,跳过角色权限缓存");
171
171
  return;
172
172
  }
@@ -179,7 +179,7 @@ export class CacheHelper {
179
179
 
180
180
  const roleApiPathsMap = new Map<string, string[]>();
181
181
 
182
- for (const role of roles.lists) {
182
+ for (const role of roles.data.lists) {
183
183
  if (!role?.code) continue;
184
184
  const apiPaths = this.assertApiPathList(role.apis, role.code);
185
185
  roleApiPathsMap.set(role.code, apiPaths);