[
{
"id": "12d2257c.231dab",
"type": "json",
"z": "b7e92987.caed38",
"name": "",
"property": "payload",
"action": "",
"pretty": false,
"x": 810,
"y": 260,
"wires": [
[
"978def59.ad1ea"
]
]
},
{
"id": "29fd81f5.642cae",
"type": "http request",
"z": "b7e92987.caed38",
"name": "获取报警列表",
"method": "POST",
"ret": "txt",
"paytoqs": "ignore",
"url": "https://open.ys7.com/api/lapp/alarm/list",
"tls": "",
"persist": false,
"proxy": "",
"authType": "",
"x": 640,
"y": 260,
"wires": [
[
"12d2257c.231dab"
]
]
},
{
"id": "978def59.ad1ea",
"type": "function",
"z": "b7e92987.caed38",
"name": "获取最新报警图片地址",
"func": "var newMsg = {\n "url": msg.payload.data[0].alarmPicUrl,\n "user": msg.user\n}\n\nreturn newMsg;",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"x": 1000,
"y": 260,
"wires": [
[
"78bbabf6.14edd4"
]
]
},
{
"id": "3f33a303.47f1bc",
"type": "json",
"z": "b7e92987.caed38",
"name": "",
"property": "payload",
"action": "",
"pretty": false,
"x": 810,
"y": 360,
"wires": [
[
"b4bd3814.4d1f38"
]
]
},
{
"id": "818e2a52.ded688",
"type": "http request",
"z": "b7e92987.caed38",
"name": "抓图",
"method": "POST",
"ret": "txt",
"paytoqs": "ignore",
"url": "https://open.ys7.com/api/lapp/device/capture",
"tls": "",
"persist": false,
"proxy": "",
"authType": "",
"x": 610,
"y": 360,
"wires": [
[
"3f33a303.47f1bc"
]
]
},
{
"id": "b4bd3814.4d1f38",
"type": "function",
"z": "b7e92987.caed38",
"name": "获取图片地址",
"func": "var newMsg = {\n "url": msg.payload.data.picUrl,\n "user": msg.user\n}\n\nreturn newMsg;",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"x": 980,
"y": 360,
"wires": [
[
"97cf1f0d.ce723"
]
]
},
{
"id": "a5c10f22.3e4e9",
"type": "bizwechat-push",
"z": "b7e92987.caed38",
"name": "",
"bizwechat": "aa873cc1.e2df2",
"x": 1380,
"y": 300,
"wires": [
[]
]
},
{
"id": "97cf1f0d.ce723",
"type": "function",
"z": "b7e92987.caed38",
"name": "推送图片",
"func": "var newMsg = {\n "payload": {\n "touser": msg.user,\n "msgtype": "news",\n "news": {\n "articles":[\n {\n "title": "抓图", \n "description": "实时抓图照片",\n "url": msg.url,\n "picurl": msg.url\n }\n ] \n }\n }\n}\n\nreturn newMsg;\n\n",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"x": 1200,
"y": 360,
"wires": [
[
"a5c10f22.3e4e9"
]
]
},
{
"id": "35224e0f.236bb2",
"type": "bizwechat-input",
"z": "b7e92987.caed38",
"name": "微信应用",
"bizwechat": "aa873cc1.e2df2",
"x": 80,
"y": 300,
"wires": [
[
"d564e397.42614"
]
]
},
{
"id": "78bbabf6.14edd4",
"type": "function",
"z": "b7e92987.caed38",
"name": "推送图片",
"func": "var newMsg = {\n "payload": {\n "touser": msg.user,\n "msgtype": "news",\n "news": {\n "articles":[\n {\n "title": "最新报警", \n "description": "报警照片",\n "url": msg.url,\n "picurl": msg.url\n }\n ] \n }\n }\n}\n\nreturn newMsg;\n\n",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"x": 1200,
"y": 260,
"wires": [
[
"a5c10f22.3e4e9"
]
]
},
{
"id": "d564e397.42614",
"type": "file in",
"z": "b7e92987.caed38",
"name": "读取accessToken",
"filename": "acctoken",
"format": "utf8",
"chunk": false,
"sendError": false,
"encoding": "utf8",
"x": 270,
"y": 300,
"wires": [
[
"7be6af49.51fd7"
]
]
},
{
"id": "7be6af49.51fd7",
"type": "function",
"z": "b7e92987.caed38",
"name": "命令解析",
"func": "var newMsg = {\n "headers": {\n "Content-Type" : "application/x-www-form-urlencoded"\n },\n "payload": "",\n "user": msg.message.FromUserName\n}\n\nnewMsg.payload = {\n "accessToken" : msg.payload,\n "deviceSerial" : "自行修改",\n "channelNo" : 1\n}\n\nvar cmd = msg.message.Content;\nif(cmd.indexOf("截图") != -1)\n{\n return [null, newMsg]\n}\nif(cmd.indexOf("报警") != -1)\n{\n return [newMsg, null]\n}",
"outputs": 2,
"noerr": 0,
"initialize": "",
"finalize": "",
"x": 460,
"y": 300,
"wires": [
[
"29fd81f5.642cae"
],
[
"818e2a52.ded688"
]
]
},
{
"id": "aa873cc1.e2df2",
"type": "bizwechat-configurator",
"z": "",
"name": "home",
"port": "1881",
"corpid": "xxx",
"agentid": "xxx",
"corpsecret": "xxx-5w",
"url": "http://1.2.3.4:55084/",
"token": "123",
"aeskey": "123",
"client_id": "",
"client_secret": ""
}
]