修改判断

Signed-off-by: 侯志雄 <houzhixiong1@h-partners.com>
This commit is contained in:
侯志雄 2024-06-25 14:43:43 +08:00
parent a8515b16d0
commit 83aeebe661
2 changed files with 5 additions and 1 deletions

View File

@ -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
}
}

View File

@ -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 +