用户
 找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索

11

主题

15

帖子

5594

积分

论坛元老

Rank: 8Rank: 8

积分
5594
2019-9-3 00:42:32 lidicn 论坛元老 楼主 1265

原理简述

  1. 通过request获取农历及节假日json消息
  2. 通过moment节点转换时间[需自行安装]
  3. 通过小爱TTS节点播报

小爱TTS节点

省略

流程

TIM截图20190903004026.jpg

[{"id":"cbb555dd.01e538","type":"function","z":"6469eaf7.924d94","name":"获取当前时间戳","func":"var now = new Date();\nvar timestamp = Date.parse(new Date());\nmsg.timestamp = timestamp;\nreturn msg","outputs":1,"noerr":0,"x":480,"y":1580,"wires":[["2d75fb0c.814834"]]},{"id":"b514ae80.8dffb","type":"function","z":"6469eaf7.924d94","name":"记录内容","func":"msg.payload = {};\nmsg.payload = msg.time;\nreturn msg;","outputs":1,"noerr":0,"x":880,"y":1580,"wires":[["4dc16efa.b7e54"]]},{"id":"1db65ec7.117f61","type":"inject","z":"6469eaf7.924d94","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":280,"y":1580,"wires":[["cbb555dd.01e538"]]},{"id":"2d75fb0c.814834","type":"moment","z":"6469eaf7.924d94","name":"转换时间格式","topic":"","input":"timestamp","inputType":"msg","inTz":"Asia/Shanghai","adjAmount":0,"adjType":"days","adjDir":"add","format":"YYYY-MM-DD HH:mm","locale":"C","output":"time","outputType":"msg","outTz":"Asia/Shanghai","x":680,"y":1580,"wires":[["b514ae80.8dffb"]]},{"id":"4dc16efa.b7e54","type":"http request","z":"6469eaf7.924d94","name":"获取农历及节假日json","method":"GET","ret":"obj","paytoqs":false,"url":"https://www.sojson.com/open/api/lunar/json.shtml","tls":"","proxy":"","authType":"","x":1080,"y":1580,"wires":[["6712b898.33c178","96a65c14.fa3"]]},{"id":"611eaa03.f300c4","type":"debug","z":"6469eaf7.924d94","name":"调式信息","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","x":1520,"y":1540,"wires":[]},{"id":"6712b898.33c178","type":"function","z":"6469eaf7.924d94","name":"推送农历及节日","func":"//获取节日列表\nvar festivalList = [\"今天是\"];\nfor (var i = 0; i < msg.payload.data.festivalList.length; i++){\n    festivalList.push(\"   \" +msg.payload.data.festivalList[i] + \"\\n\");\n}\n//整合消息\nmsg.payload  = `现在是${msg.time},农历${msg.payload.data.cnmonth}月${msg.payload.data.cnday},${msg.payload.data.cyclicalMonth}月${msg.payload.data.cyclicalDay}日,${festivalList}`;\nreturn msg;","outputs":1,"noerr":0,"x":1320,"y":1580,"wires":[["611eaa03.f300c4","2f111501.70fbea"]]},{"id":"96a65c14.fa3","type":"debug","z":"6469eaf7.924d94","name":"调式信息","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","x":1220,"y":1680,"wires":[]},{"id":"2f111501.70fbea","type":"xiaoai-tts","z":"6469eaf7.924d94","name":"小爱TTS","xiaoai":"95f52ee1.d4703","tts":"","device":"小爱音箱设备id通过小爱设备列表节点获取","x":1560,"y":1580,"wires":[[],[]]},{"id":"95f52ee1.d4703","type":"xiaoai-tts-configurator","z":"","name":"","username":"yourusername","password":"yourpassword"}]


使用道具 举报 回复
2019-9-3 07:22:54 robot 来自手机 管理员
沙发
如果要两天用这个就好了。错过了老妈的生日,就是因为平时没有记农历日期的习惯啊
使用道具 举报 回复 支持 反对
发新帖
您需要登录后才可以回帖 登录 | 立即注册