目录
兼容性:企业微信 iOS、Android 4.0.18 开始支持
添加设备。
ww.addDevice({
type: 'qrcode',
qrcode_url: 'https://open.work.weixin.qq.com/connect?xxx',
})
本接口必须使用应用身份进行注册
发起用户需要有设备添加权限(超级管理员/设备管理员)
| 属性 | 类型 | 必填 | 说明 | ||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| type | string | 是 | 设备发现方式 | ||||||||||||||||
| |||||||||||||||||||
| qrcode_url | string | 否 | 设备静态 / 动态二维码链接 当 type 为 qrcode 时必填 | ||||||||||||||||
| sn | string | 否 | 设备 SN 码 当 type 为 sn 时选填 | ||||||||||||||||
| success | Function | 否 | 成功回调 | ||||||||||||||||
| fail | Function | 否 | 失败回调 | ||||||||||||||||
| cancel | Function | 否 | 取消回调 | ||||||||||||||||
| complete | Function | 否 | 完成回调 | ||||||||||||||||
Promise<Object>
| 属性 | 类型 | 必填 | 说明 | |
|---|---|---|---|---|
| errMsg | string | 是 | 通用错误信息 | |
| errCode | number | 是 | 通用错误码 |
wx.invoke("addDevice", {
"type": "qrcode", // 设备发现方式,支持 qrcode/bluetooth/input
"qrcode_url": "https://open.work.weixin.qq.com/connect?xxx",
"sn": "TEST001"
},function(res){
if (res.err_msg == "addDevice:ok")
{
// 操作完成返回
}
}
);
