# doThingModel ^11.0
物模型查询控制等方法
# 请求参数
| Prop | Type | Default | Comment | 
|---|---|---|---|
type |  String |  N/A |  0/1/2/3 //0全属性查询,1属性查询,2设置属性 3,操作(action) | 
mac |  String |  N/A |  mac地址 | 
applianceId |  String |  N/A |  设备deviceId | 
action |  String |  N/A |  action 操作的时候有效 | 
data |  Object |  N/A |  查询数据的json | 
# 接口调用示例
const params = {
  type: '0', //选填
  mac: 'xxxxxxxxxxxx',
  applianceId: 'xxxx', //设备deviceId
  action: 'xxxx', //设备品类 如“ac”
  data: {}, //设备sn8或者设备子类型(看确权指引通过哪个区分,目前只有洗衣机是通过子类型的)
}
this.$bridge
  .doThingModel(params)
  .then(res => {
    this.$alert(res)
  })
  .catch(err => {
    this.$toast(err)
  })
 1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
2
3
4
5
6
7
8
9
10
11
12
13
14
15
# 获取接口返回结果
const globalEvent = weex.requireModule('globalEvent')
globalEvent.addEventListener('receiveMessageFromApp', (data) => {
    // 业务逻辑
    .....
    if (data.messageType == 'receiveSingleBlueThingModeInfo'){
        console.log(data.messageBody)
    }
})
 1
2
3
4
5
6
7
8
9
2
3
4
5
6
7
8
9
# 返回参数
- 成功时返回
 
| Prop | Type | Default | Description | 
|---|---|---|---|
messageType |  String |  N/A |  receiveSingleBlueThingModeInfo | 
messageBody |  Object |  N/A |  { applianceId:"xxx",mac:”xxx”, data: "xxx" ,event:xxx} //data设备回复的状态json,  event:设备事件上报才有值。属性上报则没值  |