[{"id":"9e3d9b7e.813c28","type":"http request","z":"93b24c1b.4650a","name":"获取世界杯json","method":"GET","ret":"obj","url":"http://worldcup.sfg.io/matches","tls":"","x":324,"y":311,"wires":[["794ae990.160938"]]},{"id":"80a9d921.fcc948","type":"inject","z":"93b24c1b.4650a","name":"","topic":"woc","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":140,"y":311,"wires":[["9e3d9b7e.813c28"]]},{"id":"beae9bfa.c15cf8","type":"function","z":"93b24c1b.4650a","name":"获取指定日的赛事","func":"// msg.date 应当为字符串,格式 yy-mm-dd\nmsg.payload = msg.payload.filter(function (e) { return e.datetime.substring(0,10) == msg.date;}); \nreturn msg;","outputs":1,"noerr":0,"x":721,"y":310,"wires":[["c07b24e5.3de8e8"]]},{"id":"794ae990.160938","type":"function","z":"93b24c1b.4650a","name":"指定时间为昨日","func":"function GetDateStr(AddDayCount) {\n var dd = new Date();\n dd.setDate(dd.getDate()+AddDayCount);//获取AddDayCount天后的日期\n var y = dd.getFullYear();\n var m = String(dd.getMonth()+1);//获取当前月份的日期\n if (m.length == 1){\n m = '0' + m;\n }\n var d = dd.getDate();\n return y+"-"+m+"-"+d;\n}\nmsg.date = GetDateStr(-1);\nreturn msg;","outputs":1,"noerr":0,"x":523,"y":310,"wires":[["beae9bfa.c15cf8"]]},{"id":"c07b24e5.3de8e8","type":"function","z":"93b24c1b.4650a","name":"TTS内容","func":"var translate = {"Russia":"俄罗斯","Belgium":"比利时","Germany":"德国","England":"英格兰","Spain":"西班牙","Poland":"波兰","Iceland":"冰岛","Serbia":"塞尔维亚","Portugal":"葡萄牙","France":"法国","Switzerland":"瑞士","Croatia":"克罗地亚","Sweden":"瑞典","Denmark":"丹麦","Brazil":"巴西","Uruguay":"乌拉圭","Argentina":"阿根廷","Colombia":"哥伦比亚","Peru":"秘鲁","Iran":"伊朗","Japan":"日本","Korea":"韩国","Saudi Arabia":"沙特阿拉伯","Australia":"澳大利亚","Nigeria":"尼日利亚","Egypt":"埃及","Senegal":"塞内加尔","Morocco":"摩洛哥","Tunisia":"突尼斯","Mexico":"墨西哥","Costa Rica":"哥斯达黎加","Panama":"巴拿马"};\nvar str = "昨天世界杯共有"+msg.payload.length+"场比赛,";\nvar home_team_name;\nvar home_team_goals;\nvar away_team_name;\nvar away_team_goals;\nfunction Get_winner(home_team_goals,away_team_goals){\n if (Number(home_team_goals) - Number(away_team_goals) > 0){\n return "赢";\n }\n else if (Number(home_team_goals) - Number(away_team_goals) < 0){\n return "输给";\n }\n else{\n return "平";\n }\n}\nfor (var i in msg.payload){\n home_team_name = msg.payload[i].home_team.country;\n home_team_goals = msg.payload[i].home_team.goals;\n away_team_name = msg.payload[i].away_team.country;\n away_team_goals = msg.payload[i].away_team.goals;\n str = str + translate[home_team_name] + "对" + translate[away_team_name] + "," + \n home_team_goals + "比" + away_team_goals +\n "," + translate[home_team_name] + Get_winner(home_team_goals,away_team_goals) +\n translate[away_team_name] + ",";\n}\nmsg.payload = {};\nvar tts = str.substring(0,str.length-1)+"。";\nmsg.payload.data = {"message":tts};\nreturn msg;","outputs":1,"noerr":0,"x":900,"y":310,"wires":[["dea0cc91.221d8"]]},{"id":"dea0cc91.221d8","type":"api-call-service","z":"93b24c1b.4650a","name":"小爱同学TTS","server":"73841890.65ca18","service_domain":"hello_miai","service":"send","data":"","mergecontext":"","x":1052,"y":313,"wires":[[]]},{"id":"73841890.65ca18","type":"server","z":"","name":"Home Assistant","url":"HA地址","pass":"HA密码"}]