m
This commit is contained in:
+1
-1
@@ -22,5 +22,5 @@ export declare class TaskInstallService implements OnModuleInit {
|
||||
install(): Promise<void>;
|
||||
createAdminUser(): Promise<void>;
|
||||
createTopUser(): Promise<UserModel>;
|
||||
initImGroup(topUserId: number): Promise<void>;
|
||||
initImGroup(topUser: UserModel): Promise<void>;
|
||||
}
|
||||
|
||||
+21
-4
@@ -64,7 +64,7 @@ let TaskInstallService = TaskInstallService_1 = class TaskInstallService {
|
||||
await this.createAdminUser();
|
||||
this.logger.verbose('开始创建顶级用户...');
|
||||
const topUser = await this.createTopUser();
|
||||
await this.initImGroup(topUser.id);
|
||||
await this.initImGroup(topUser);
|
||||
this.logger.verbose('安装任务执行完成,即将退出进程');
|
||||
process.exit(0);
|
||||
}
|
||||
@@ -135,8 +135,16 @@ let TaskInstallService = TaskInstallService_1 = class TaskInstallService {
|
||||
return topUser;
|
||||
});
|
||||
}
|
||||
async initImGroup(topUserId) {
|
||||
const IM_USER_ID_PREFIX = 'IM_ENERGY_TEST_';
|
||||
async initImGroup(topUser) {
|
||||
const imUid = app_env_1.AppEnv.IM_USER_ID_PREFIX + topUser.id;
|
||||
const arr = [
|
||||
{
|
||||
UserID: imUid,
|
||||
Nick: topUser.nick,
|
||||
FaceUrl: topUser.avatar,
|
||||
},
|
||||
];
|
||||
await im_help_1.IMHelp.multiaccountImportUser(arr);
|
||||
this.logger.verbose('正在初始化群组');
|
||||
const groupInfo = await im_help_1.IMHelp.getGroupInfo([app_env_1.AppEnv.IM_DEFAULT_GROUP_ID]);
|
||||
if (groupInfo.GroupInfo?.length && groupInfo.GroupInfo[0].ErrorCode == 0) {
|
||||
@@ -144,7 +152,7 @@ let TaskInstallService = TaskInstallService_1 = class TaskInstallService {
|
||||
}
|
||||
else {
|
||||
const res = await im_help_1.IMHelp.createGroup({
|
||||
Owner_Account: `${IM_USER_ID_PREFIX}${topUserId}`,
|
||||
Owner_Account: imUid,
|
||||
Type: app_env_1.AppEnv.IM_DEFAULT_GROUP_TYPE,
|
||||
GroupId: app_env_1.AppEnv.IM_DEFAULT_GROUP_ID,
|
||||
FaceUrl: '',
|
||||
@@ -157,6 +165,15 @@ let TaskInstallService = TaskInstallService_1 = class TaskInstallService {
|
||||
this.logger.verbose(`正初始化群组完成`);
|
||||
}
|
||||
}
|
||||
await im_help_1.IMHelp.importGroupMember({
|
||||
GroupId: app_env_1.AppEnv.IM_DEFAULT_GROUP_ID,
|
||||
MemberList: [
|
||||
{
|
||||
Member_Account: imUid,
|
||||
Role: 'admin',
|
||||
},
|
||||
],
|
||||
});
|
||||
}
|
||||
};
|
||||
exports.TaskInstallService = TaskInstallService;
|
||||
|
||||
+1
-1
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user