# mt.getMTUserInfo(Object object)
异步获取当前美团账号的用户信息。
# 支持情况
| 项 | 说明 |
|---|---|
| 兼容性 | 美团小游戏特有 |
# 参数
Object object
| 属性 | 类型 | 默认值 | 必填 | 说明 |
|---|---|---|---|---|
| success | function | — | 否 | 成功回调 |
| fail | function | — | 否 | 失败回调 |
| complete | function | — | 否 | 完成回调(成功或失败均触发) |
success 回调参数
| 属性 | 类型 | 说明 |
|---|---|---|
| userId | number | 美团用户 ID(long 类型) |
| token | string | 登录态 token |
| uuid | string | 设备唯一标识 |
| unionId | string | 联合 ID |
# 返回值
无返回值
# 注意事项
- 调用前建议先通过
mt.appIsLogin确认用户已登录
# 示例代码
mt.getMTUserInfo({
success(res) {
console.log('用户 ID:', res.userId)
console.log('token:', res.token)
console.log('uuid:', res.uuid)
},
fail(err) {
console.error(err.errMsg)
}
})
# 与微信差异
此 API 为美团小游戏特有,微信小游戏中无对应接口。