[{"id":"f9cd54d46d358393","type":"tab","label":"流程 2","disabled":false,"info":""},{"id":"1c68dcdac28f5072","type":"inject","z":"f9cd54d46d358393","name":"tts文字","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"这是一条语音测试,主要是看看你的摄像头是不是哑巴了。","payloadType":"str","x":130,"y":220,"wires":[["d4fceff1b24fc34e"]]},{"id":"d4fceff1b24fc34e","type":"function","z":"f9cd54d46d358393","name":"百度tts-api接口数据整理","func":"msg.headers = {\n "Content-Type" : "application/x-www-form-urlencoded"\n}\nvar tex = encodeURI(msg.payload)\nvar tok = flow.get('baidu_token')\nvar cuid = 'TbEm3kYYpVuKT0xnQLs3UOGq'\nmsg.payload = {\n 'tex' : tex,\n "tok" : tok, \n "cuid" : cuid, \n 'ctp' : '1',\n 'lan' : 'zh',\n// 'per' : '1',\n// 'spd' : '6'\n}\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":330,"y":220,"wires":[["4f03eb2550039a1e"]]},{"id":"4f03eb2550039a1e","type":"http request","z":"f9cd54d46d358393","name":"api请求","method":"POST","ret":"bin","paytoqs":"ignore","url":"https://tsn.baidu.com/text2audio","tls":"","persist":false,"proxy":"","authType":"","x":520,"y":220,"wires":[["0146e61d9333ab16"]]},{"id":"0146e61d9333ab16","type":"function","z":"f9cd54d46d358393","name":"萤石接口数据整理","func":"msg.token=global.get('ezviz_token','store')\nmsg.url = 'https://open.ys7.com/api/lapp/voice/sendonce'\ndata = msg.payload\nmsg.payload = {\n file: {\n field: 'voiceFile',\n data: data,\n type: 'base64',\n name: 'tts'\n },\n formOptions: {\n accessToken: `${msg.token}`,\n deviceSerial:'你自己的deviceSerial',//你自己的deviceSerial\n }\n}\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":730,"y":220,"wires":[["75c29e3b25904d8f"]]},{"id":"75c29e3b25904d8f","type":"http-send-multipart-form-v3","z":"f9cd54d46d358393","name":"摄像头播放","filetype":"base64","formparts":"","ret":"txt","url":"https://open.ys7.com/api/lapp/voice/sendonce","tls":"","sendrequest":false,"x":930,"y":220,"wires":[[]]},{"id":"deb49c376c58a5b1","type":"function","z":"f9cd54d46d358393","name":"token拉取数据处理","func":"msg.headers = {\n "Content-Type" : "application/x-www-form-urlencoded"\n}\nmsg.payload = {\n 'grant_type' : 'client_credentials',\n "client_id" : "", //ApiKey\n "client_secret" : "" //Secret\n}\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":310,"y":60,"wires":[["aa23297761faa886"]]},{"id":"d328cb682ee9417c","type":"inject","z":"f9cd54d46d358393","name":"","props":[{"p":"payload"}],"repeat":"","crontab":"00 02 * * 1","once":false,"onceDelay":0.1,"topic":"","payloadType":"date","x":120,"y":60,"wires":[["deb49c376c58a5b1"]]},{"id":"aa23297761faa886","type":"http request","z":"f9cd54d46d358393","name":"百度token获取请求","method":"POST","ret":"obj","paytoqs":"ignore","url":"https://aip.baidubce.com/oauth/2.0/token","tls":"","persist":false,"proxy":"","authType":"","x":530,"y":60,"wires":[["5de0e72a62bb3058"]]},{"id":"5de0e72a62bb3058","type":"change","z":"f9cd54d46d358393","name":"保存","rules":[{"t":"move","p":"payload.access_token","pt":"msg","to":"baidu_token","tot":"flow"}],"action":"","property":"","from":"","to":"","reg":false,"x":730,"y":60,"wires":[[]]}]