For AI agents: the complete documentation index is available at /apps-plugin/docs/llms.txt, the full documentation bundle is available at /apps-plugin/docs/llms-full.txt, and this page is available as Markdown at /apps-plugin/docs/js-api/basic/getAccountInfo.md.

getAccountInfo

异步获取账号信息。

扫码预览

扫码预览 getAccountInfo

使用限制

WARNING

Android、iOS:仅返回 develop 或 release,永远不会返回 trial;依赖 trial 判断体验版环境的逻辑不会生效。

支持版本

前端库版本不低于 0.0.18。

支持平台

平台支持情况
Android支持
iOS支持
PC不支持
HarmonyOS不支持

支持场景

场景支持情况
页面支持
卡片支持

调用方式

异步 API

getAccountInfo(params?: object): Promise<GetAccountInfoResult>

入参

无。

调用示例

import { getAccountInfo } from '@doubao-dev/framework/api';

const result = await getAccountInfo();
console.log(result.miniProgram.appId, result.miniProgram.envVersion, result.miniProgram.version);

成功返回

名称类型必返约束说明
miniProgramDoubaoAppAccountInfo是-应用插件账号信息
miniProgram.appIdstring是-应用插件 appId
miniProgram.envVersion"develop" | "trial" | "release"是Android、iOS 当前只返回 develop 或 release,不会返回 trial当前应用插件的版本类型。

  • develop:开发版
  • trial:体验版
  • release:正式版。Android、iOS:仅返回 develop 或 release,永远不会返回 trial。
miniProgram.versionstring是-应用插件版本号。
pluginPluginAccountInfo否-插件账号信息(仅在插件中调用时包含)
plugin.appIdstring否-插件 appId
plugin.versionstring否-插件版本号,'a.b.c' 形式

返回示例

{
  "miniProgram": {
    "appId": "7000000000000000000",
    "envVersion": "release",
    "version": "1.0.0"
  }
}

错误处理

错误对象和通用错误码见 通用错误处理。

错误码

通用错误码

errNoerrMsg说明平台
102internal error内部错误Android