Skip to content

Commit 751a58f

Browse files
committed
fix(asw): support appId option
1 parent d696d98 commit 751a58f

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

src/modules/asw/index.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -142,12 +142,14 @@ export default class Asw {
142142
};
143143

144144
let roleName = role;
145-
const { appId, ownerUin } = await this.account.get();
145+
const accountInfo = await this.account.get();
146146

147147
if (!roleName) {
148-
roleName = await this.createRole(name, appId);
148+
// 如果上层传入 appId 直接使用上层 appId,如果没有尝试通过 accountInfo 中来获取
149+
const appId = options.appId || accountInfo.appId;
150+
roleName = await this.createRole(name, appId!);
149151
}
150-
reqParams.RoleResource = `qcs::cam::uin/${ownerUin}:roleName/${roleName}`;
152+
reqParams.RoleResource = `qcs::cam::uin/${accountInfo.ownerUin}:roleName/${roleName}`;
151153

152154
if (input) {
153155
reqParams.Input = input;

src/modules/asw/interface.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,9 @@ export interface CreateOptions {
4343
enableCls?: boolean;
4444
// 状态机默认输入参数
4545
input?: string;
46+
47+
// app id
48+
appId?: string;
4649
}
4750

4851
export interface UpdateOptions extends CreateOptions {

0 commit comments

Comments
 (0)