update data/components/eabb131d-8fd1-43a8-88d9-a198abfd3d42/component.js.

mqtt上报补充回复消息

Signed-off-by: xiwa <xw2sy@163.com>
V0.5.x
xiwa 2022-09-29 01:42:06 +00:00 committed by Gitee
parent 5acff31822
commit f024df55e9
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
1 changed files with 18 additions and 0 deletions

View File

@ -173,6 +173,20 @@ this.onReceive=function(head,type,payload){
}
//数据上报
var reply=
{
productKey:pk,
deviceName:dn,
mid:payload.id,
content:{
topic:topic.replace("/s/","/c/")+"_reply",
payload:JSON.stringify({
id:payload.id,
method: payload.method+"_reply",
code:0,
})
}
};
return {
type:"report",
data:{
@ -183,6 +197,10 @@ this.onReceive=function(head,type,payload){
topic:topic,
payload:payload
}
},
action:{
type:"ack",
content:JSON.stringify(reply)
}
}
}