diff --git a/entry/src/main/ets/StaticSubscriber/UserChangeStaticSubscriber.ets b/entry/src/main/ets/StaticSubscriber/UserChangeStaticSubscriber.ets index c86155e..46c03f5 100644 --- a/entry/src/main/ets/StaticSubscriber/UserChangeStaticSubscriber.ets +++ b/entry/src/main/ets/StaticSubscriber/UserChangeStaticSubscriber.ets @@ -39,8 +39,10 @@ export default class UserChangeStaticSubscriber extends StaticSubscriberExtensio this.init(); let rdb = await SettingsDBHelper.getInstance().getRdbStore(); + Log.info(`rdb ${rdb}`) switch (event.event) { case commonEventManager.Support.COMMON_EVENT_USER_ADDED: + Log.info(`case1 ${event.event}`) // 创建对应用户的数据表 await rdb?.executeSql(SettingsDBHelper.CURRENT_USER_TABLE_CREATE_PREFIX + event.code + SettingsDBHelper.TABLE_CREATE_SUFFIX, []); @@ -69,11 +71,13 @@ export default class UserChangeStaticSubscriber extends StaticSubscriberExtensio } break case commonEventManager.Support.COMMON_EVENT_USER_REMOVED: + Log.info(`case2 ${event.event}`) // 删除对应用户的数据表 rdb?.executeSql(CURRENT_USER_TABLE_DROP + event.code, []); rdb?.executeSql(CURRENT_SECURE_USER_TABLE_DROP + event.code, []); break default: + Log.info(`default ${event.event}`) break } } diff --git a/entry/src/main/ets/Utils/SettingsDBHelper.ets b/entry/src/main/ets/Utils/SettingsDBHelper.ets index 4bdb825..be384d1 100644 --- a/entry/src/main/ets/Utils/SettingsDBHelper.ets +++ b/entry/src/main/ets/Utils/SettingsDBHelper.ets @@ -136,7 +136,7 @@ class SettingsDBHelper { this.isFirstStartup = await storage.get('isFirstStartup', true); storage = await dataStorage.getPreferences(this.context as Context, SETTINGSDATA_PREFERENCE_USER); this.maxUserNO = await storage.get('MAXUSERNO', 100); - Log.info(`firstStartupConfig isFirstStartUp = ${this.isFirstStartup} max user no: ${this.maxUserNO}`); + Log.info(`firstStartupConfig isFirstStartUp = ${this.isFirstStartup} max user no: ${this.maxUserNO} rdbStore: ${this.rdbStore}`); // 总是创建以下三张表 if not exists // 创建公共数据表 await this.rdbStore?.executeSql(SettingsDBHelper.SHARED_TABLE_CREATE_PREFIX +