将微信打造成有逼格的公众号?--天气(一)

==============2020/05/06更新说明==============
各位大佬非常抱歉,最近太忙了,都没有看这边的回复
基本上一些问题点都已经由楼下的大佬们补充了
1、关于提到的本地图片存放路径,最简单的方法就是你可以将解压缩后的文件放在你的HA目录www文件夹下,你的HA必须是可以公网访问的,不管你是通过域名或者IP地址,比如你可以直接用HA的域名加上绝对路径/local/images/天气/封面图/CLEAR_DAY.jpg访问这张图片,如下两张截图


另外关于docker文件夹的访问可以讲HA的www目录映射给到node-red的容器,如下截图


那么你node-red里面的路径就要写成类似这样,那个网址的乱码是我从网页中直接复制过来中文就成这样了,也可以直接改成中文的

2、还有个关于本地位置的获取,我用的是手机的位置,NR流代码如下,用的高德WEB服务中的坐标转换API。


用这个flow需要修改这边的全局变量。

flow
获取手机位置.txt (3.6 KB)

==============以上是2020/05/06的更新说明==============

基于彩云api 2.4 与 高德地理,所以你需要这两个API…

这个是借(抄)鉴(袭)产生的简洁清爽美观版本

没有小姐姐!

没有小姐姐!

没有小姐姐!

流程图与简要说明:

实际效果图:
<企业版微信会有高亮效果,微信上没有,都是灰色的>


封面图:
<也可以自己去找或者直接用网上的图>

封面图1.zip (3.2 MB)
封面图2.zip (3.4 MB)

flow:

[
    {
        "id": "92ae69c8.c14858",
        "type": "http request",
        "z": "c69f2c5.2c677d",
        "name": "天气预报",
        "method": "GET",
        "ret": "obj",
        "paytoqs": false,
        "url": "https://api.caiyunapp.com/v2.4/{{{cy_api}}}/{{{longitude}}},{{{latitude}}}/forecast.json?unit=metric:v2&alert=true",
        "tls": "",
        "proxy": "",
        "authType": "",
        "x": 480,
        "y": 400,
        "wires": [
            [
                "8007cbf.2e55a38"
            ]
        ]
    },
    {
        "id": "7aab9065.7091d",
        "type": "http request",
        "z": "c69f2c5.2c677d",
        "name": "实时天气",
        "method": "GET",
        "ret": "obj",
        "paytoqs": false,
        "url": "https://api.caiyunapp.com/v2.4/{{{cy_api}}}/{{{longitude}}},{{{latitude}}}/realtime.json",
        "tls": "",
        "proxy": "",
        "authType": "",
        "x": 480,
        "y": 360,
        "wires": [
            [
                "8007cbf.2e55a38"
            ]
        ]
    },
    {
        "id": "8007cbf.2e55a38",
        "type": "join",
        "z": "c69f2c5.2c677d",
        "name": "",
        "mode": "custom",
        "build": "object",
        "property": "payload",
        "propertyType": "msg",
        "key": "topic",
        "joiner": "\\n",
        "joinerType": "str",
        "accumulate": false,
        "timeout": "",
        "count": "3",
        "reduceRight": false,
        "reduceExp": "",
        "reduceInit": "",
        "reduceInitType": "",
        "reduceFixup": "",
        "x": 610,
        "y": 400,
        "wires": [
            [
                "56725bbc.1c1c34"
            ]
        ]
    },
    {
        "id": "cc5ecdf1.3335",
        "type": "inject",
        "z": "c69f2c5.2c677d",
        "name": "定时上午8点推送",
        "topic": "",
        "payload": "{\"mode\":\"time\"}",
        "payloadType": "json",
        "repeat": "",
        "crontab": "00 08 * * *",
        "once": false,
        "onceDelay": 0.1,
        "x": 130,
        "y": 380,
        "wires": [
            [
                "da704354.14499"
            ]
        ]
    },
    {
        "id": "56725bbc.1c1c34",
        "type": "function",
        "z": "c69f2c5.2c677d",
        "name": "获取数据",
        "func": "var data_realtime = msg.payload.realtime.result.realtime\nvar data_forecast = msg.payload.forecast.result\nvar data_georegeo = msg.payload.georegeo.regeocode\nvar r = {};\n\nvar aqi = data_realtime.air_quality.aqi.usa\nif (aqi <= 50 && aqi >= 0) {r['aqi_desc'] = '优';}\nelse if (aqi <= 100 && aqi >= 51) {r['aqi_desc'] = '良';}\nelse if (aqi <= 150 && aqi >= 101) {r['aqi_desc'] = '轻度污染';}\nelse if (aqi <= 200 && aqi >= 151) {r['aqi_desc'] = '中度污染';}\nelse if (aqi <= 300 && aqi >= 201) {r['aqi_desc'] = '重度污染';}\nelse if (aqi > 300) {r['aqi_desc'] = '严重污染';}\nr['aqi'] = aqi\n\nvar skycon_en = data_realtime.skycon\nvar SKYCON_TYPE = {\n 'CLEAR_DAY':'晴天☀️',\n 'CLEAR_NIGHT':'晴夜🌙',\n 'PARTLY_CLOUDY_DAY':'多云🌥',\n 'PARTLY_CLOUDY_NIGHT':'多云️☁️',\n 'CLOUDY':'阴☁️',\n 'LIGHT_HAZE':'轻度雾霾🟨',\n 'MODERATE_HAZE':'中度雾霾🟧',\n 'HEAVY_HAZE':'重度雾霾🟥',\n 'LIGHT_RAIN':'小雨🌧',\n 'MODERATE_RAIN':'中雨☔',\n 'HEAVY_RAIN':'大雨⛈️',\n 'STORM_RAIN':'暴雨⛈️',\n 'FOG':'雾🌫',\n 'LIGHT_SNOW':'小雪🌨',\n 'MODERATE_SNOW':'中雪❄️',\n 'HEAVY_SNOW':'大雪⛄️',\n 'STORM_SNOW':'暴雪☃️',\n 'DUST':'浮尘🌁',\n 'SAND':'沙尘‼️',\n 'WIND':'大风💨'\n}\nr['skycon'] = SKYCON_TYPE[skycon_en]\nr['skycon_en'] = skycon_en\n\nr['uv_des'] = data_realtime.life_index.ultraviolet.desc\nr['temperature'] = data_realtime.temperature\nr['humidity'] = data_realtime.humidity * 100\n\nr['pm10'] = data_realtime.air_quality.pm10\nr['pm25'] = data_realtime.air_quality.pm25\n\nvar probability = data_forecast['minutely']['probability']\nr['probability_30'] = Math.round(probability[0] * 100)\nr['probability_60'] = Math.round(probability[1] * 100)\nr['probability_90'] = Math.round(probability[2] * 100)\nr['probability_120'] = Math.round(probability[3] * 100)\n\nr['description'] = data_forecast.forecast_keypoint\n\nr['coldRisk'] = data_forecast.daily.life_index.coldRisk[0].desc\nr['carWashing'] = data_forecast.daily.life_index.carWashing[0].desc\n\n//未来2小时内每半小时的降雨概率\nvar predit = []\nglobal.set(\"predit_toggle\", false);\n\nfor (var key = 0; key < 4; key++){\n    if(probability[key] > 0.5){\n        predit.push (\"未来\" + (key+1)*30 + \"分钟,降雨概率将超过\" + Math.round(probability[key] * 100) + \"%;\")\n        global.set(\"predit_toggle\", true);\n    }\n}\nmsg.predit =  predit.join('\\n');\n\n//取当前雨量\nvar intensity = data_realtime.precipitation.local.intensity\nglobal.set(\"intensity\", intensity)\n\n// data_forecast['alert']['content'][0] = {}\n// data_forecast['alert']['content'][0]['title'] = \"宇宙气象台发布纠结预警!\"\n// data_forecast['alert']['content'][0]['county'] = \"火星\"\n// data_forecast['alert']['content'][0]['description'] = \"预计宇宙历2020年将会经历超强宇宙风暴!可能会将火星吹到M78星云。请做好预防措施!\"\n\n\n//预警消息\nvar alert_content_info = data_forecast['alert']['content']\nif (alert_content_info.toString() !== '') {\n    msg.alert_s = true\n    msg.alert_title = alert_content_info[0]['title']\n    msg.alert_city = alert_content_info[0]['county']\n    msg.alert_info = alert_content_info[0]['description']\n} else {\n    msg.alert_s = false\n}\n\n\nmsg.type = \"image\";\nmsg.filename = `/hawww/images/天气/封面图/${skycon_en}.jpg`;\nmsg.picr_url = `http://xxxxxxxxxxxx/${skycon_en}.jpg`\nmsg.address = data_georegeo.formatted_address\n\nmsg.weather = r;\n\nreturn msg;",
        "outputs": 1,
        "noerr": 0,
        "x": 740,
        "y": 400,
        "wires": [
            [
                "e747cd41.81267",
                "d2cd4dee.5731e"
            ]
        ]
    },
    {
        "id": "fe0c1a97.ed7de8",
        "type": "bizwechat-upload",
        "z": "c69f2c5.2c677d",
        "name": "上传素材",
        "bizwechat": "",
        "x": 440,
        "y": 640,
        "wires": [
            [
                "b7434b8d.78e858"
            ]
        ]
    },
    {
        "id": "1cfe438f.47013c",
        "type": "file in",
        "z": "c69f2c5.2c677d",
        "name": "读取",
        "filename": "",
        "format": "",
        "chunk": false,
        "sendError": false,
        "encoding": "none",
        "x": 310,
        "y": 640,
        "wires": [
            [
                "fe0c1a97.ed7de8"
            ]
        ]
    },
    {
        "id": "6edcfb72.5b7ce4",
        "type": "template",
        "z": "c69f2c5.2c677d",
        "name": "",
        "field": "payload",
        "fieldType": "msg",
        "format": "html",
        "syntax": "mustache",
        "template": "<!DOCTYPE html>\n<html>\n<body>\n\n<div style=\"text-align:center;position:relative; width:100%;height:100%;\">\n    <img src=\"{{picr_url}}\"\n        alt=\"\" style=\"border-radius:10px;width: auto;height: auto;max-width:80%;max-height:80%;\">\n    <span\n        style=\"position:absolute;top:70%;left:0%;font-weight:bold;color: white; text-shadow: black 0.1em 0.1em 0.2em;font-size:16px;display:inline-block;width:100%;word-wrap:break-word;white-space:normal;\">{{weather.description}}</span>\n</div>\n<br>\n<div style=\"background-color:#66CCCC;width:90%;height:120px;text-align:center;margin:auto;border-radius:10px;box-shadow: 2px 3px 5px #8f9299;\">\n    <table frame=\"void\" rules=\"none\" cellspacing=\"0\" style=\"table-layout:fixed;width: 98%;height: 92%;margin:auto;\">\n        <thead style=\"color: #FFFFFF;\">\n            <tr>\n                <th colspan=\"3\" style=\"height:30px;font-size:24px;font-weight:bold;\">天气状况</th>\n            </tr>\n        </thead>\n        <tbody style=\"background-color:#66CCCC;color: #FFFFFF;\">\n            <tr style=\"font-weight:bold;font-size:18px;\">\n                <td>{{weather.temperature}}°C</td>\n                <td>{{weather.humidity}}%</td>\n                <td>{{weather.uv_des}}</td>\n            </tr>\n            <tr  style=\"font-size:14px;\">\n                <td>温度</td>\n                <td>湿度</td>\n                <td>紫外线强度</td>\n            </tr>\n        </tbody>\n    </table>\n</div>\n<br>\n<div style=\"background-color:#99CCFF;width:90%;height:140px;text-align:center;margin:auto;border-radius:10px;box-shadow: 2px 3px 5px #8f9299;\">\n    <table frame=\"void\" rules=\"none\" cellspacing=\"0\" style=\"table-layout:fixed;width: 98%;height: 92%;margin:auto;\">\n        <thead style=\"color: #FFFFFF;\">\n            <tr>\n                <th colspan=\"3\" style=\"height:30px;font-size:24px;font-weight:bold;\">空气质量</th>\n            </tr>\n        </thead>\n        <tbody style=\"background-color:#99CCFF;color: #FFFFFF;\">\n            <tr style=\"font-weight:bold;font-size:18px;\">\n                <td>{{weather.aqi_desc}}</td>\n                <td>{{weather.pm10}}μg/m3</td>\n                <td>{{weather.pm25}}μg/m3</td>\n            </tr>\n            <tr  style=\"font-size:14px;\">\n                <td>空气质量(AQI)</td>\n                <td>可吸入颗粒物、飘尘(PM10)</td>\n                <td>细颗粒物(PM2.5)</td>\n            </tr>\n        </tbody>\n    </table>\n</div>\n<br>\n<div style=\"background-color:#CCCCFF;width:90%;height:140px;text-align:center;margin:auto;border-radius:10px;box-shadow: 2px 3px 5px #8f9299;\">\n    <table frame=\"void\" rules=\"none\" cellspacing=\"0\" style=\"table-layout:fixed;width: 98%;height: 92%;margin:auto;\">\n        <thead style=\"color: #FFFFFF;\">\n            <tr>\n                <th colspan=\"4\" style=\"height:30px;font-size:24px;font-weight:bold;\">降雨概率</th>\n            </tr>\n        </thead>\n        <tbody style=\"background-color:#CCCCFF;color: #FFFFFF;\">\n            <tr style=\"font-weight:bold;font-size:18px;\">\n                <td>{{weather.probability_30}}%</td>\n                <td>{{weather.probability_60}}%</td>\n                <td>{{weather.probability_90}}%</td>\n                <td>{{weather.probability_120}}%</td>\n            </tr>\n            <tr  style=\"font-size:14px;\">\n                <td>30分钟降雨概率</td>\n                <td>60分钟降雨概率</td>\n                <td>90分钟降雨概率</td>\n                <td>120分钟降雨概率</td>\n            </tr>\n        </tbody>\n    </table>\n</div>\n<br>\n\n</body>\n</html>",
        "output": "str",
        "x": 720,
        "y": 640,
        "wires": [
            [
                "40d9ab42.b28c34"
            ]
        ]
    },
    {
        "id": "40d9ab42.b28c34",
        "type": "function",
        "z": "c69f2c5.2c677d",
        "name": "推送消息",
        "func": "Date.prototype.Format = function (fmt) {  \n    var o = {\n        \"M+\": this.getMonth() + 1, //月份 \n        \"d+\": this.getDate(), //日 \n        \"h+\": this.getHours(), //小时 \n        \"m+\": this.getMinutes(), //分 \n        \"s+\": this.getSeconds(), //秒 \n        \"q+\": Math.floor((this.getMonth() + 3) / 3), //季度 \n        \"S\": this.getMilliseconds() //毫秒 \n    };\n    if (/(y+)/.test(fmt)) fmt = fmt.replace(RegExp.$1, (this.getFullYear() + \"\").substr(4 - RegExp.$1.length));\n    for (var k in o)\n    if (new RegExp(\"(\" + k + \")\").test(fmt)) fmt = fmt.replace(RegExp.$1, (RegExp.$1.length == 1) ? (o[k]) : ((\"00\" + o[k]).substr((\"\" + o[k]).length)));\n    return fmt;\n}\nvar mydate = new Date().Format(\"yyyy年MM月dd日 hh:mm:ss\");\n\n\nvar aqi = msg.weather.aqi\n\nif (aqi <= 50 && aqi >= 0) {aqi = '优🍀';}\nelse if (aqi <= 100 && aqi >= 51) {aqi = '良🤧';}\nelse if (aqi <= 150 && aqi >= 101) {aqi = '轻度污染😷';}\nelse if (aqi <= 200 && aqi >= 151) {aqi = '中度污染😱';}\nelse if (aqi <= 300 && aqi >= 201) {aqi = '重度污染😵';}\nelse if (aqi > 300) {aqi = '严重污染☠️';}\n\n\nwechat = {\n   \"touser\" : \"@all\",\n   \"msgtype\" : \"mpnews\",\n   \"mpnews\" : {\n       \"articles\":[\n           {\n               \"title\": `最新天气情况`, \n               \"thumb_media_id\": `${msg.media_id}`,\n               //\"author\": \"Author\",\n               //\"content_source_url\": \"URL\",\n               \"content\": `${msg.payload}`,\n               \"digest\": `${mydate}\\n当前位置是:${msg.address}附近\\n---------------------------\\n现在天气:${msg.weather.skycon}\\n空气质量:${aqi}\\n温度:${msg.weather.temperature}℃\\n湿度:${msg.weather.humidity}%\\n${msg.weather.description}\\n今日天气${msg.weather.coldRisk}感冒;${msg.weather.carWashing}洗车。`\n            }\n       ]\n   },\n   \"safe\":0\n}\n\nmsg.payload = {};\nmsg.payload = wechat;\n\nreturn msg;",
        "outputs": 1,
        "noerr": 0,
        "x": 860,
        "y": 640,
        "wires": [
            [
                "b9ad5c2e.c73e"
            ]
        ]
    },
    {
        "id": "b7434b8d.78e858",
        "type": "change",
        "z": "c69f2c5.2c677d",
        "name": "media_id",
        "rules": [
            {
                "t": "move",
                "p": "payload.media_id",
                "pt": "msg",
                "to": "media_id",
                "tot": "msg"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 580,
        "y": 640,
        "wires": [
            [
                "6edcfb72.5b7ce4"
            ]
        ]
    },
    {
        "id": "b9ad5c2e.c73e",
        "type": "bizwechat-push",
        "z": "c69f2c5.2c677d",
        "name": "",
        "bizwechat": "",
        "x": 1000,
        "y": 640,
        "wires": [
            []
        ]
    },
    {
        "id": "1ae3b155.17c45f",
        "type": "link in",
        "z": "c69f2c5.2c677d",
        "name": "推送天气消息",
        "links": [
            "337b0792.53d888"
        ],
        "x": 15,
        "y": 460,
        "wires": [
            [
                "37a7a954.d95176"
            ]
        ]
    },
    {
        "id": "f620e578.3c30f8",
        "type": "http request",
        "z": "c69f2c5.2c677d",
        "name": "实时位置",
        "method": "GET",
        "ret": "obj",
        "paytoqs": false,
        "url": "https://restapi.amap.com/v3/geocode/regeo?key={{{gd_api}}}&location={{{longitude}}},{{{latitude}}}&poitype=&radius=10&extensions=all&batch=false&roadlevel=0",
        "tls": "",
        "proxy": "",
        "authType": "",
        "x": 480,
        "y": 440,
        "wires": [
            [
                "8007cbf.2e55a38"
            ]
        ]
    },
    {
        "id": "713a6f07.58686",
        "type": "inject",
        "z": "c69f2c5.2c677d",
        "name": "定时下午17点推送",
        "topic": "",
        "payload": "",
        "payloadType": "date",
        "repeat": "",
        "crontab": "00 17 * * *",
        "once": false,
        "onceDelay": 0.1,
        "x": 130,
        "y": 420,
        "wires": [
            [
                "da704354.14499"
            ]
        ]
    },
    {
        "id": "63e27bbe.5103d4",
        "type": "switch",
        "z": "c69f2c5.2c677d",
        "name": "toggle为真",
        "property": "predit_toggle",
        "propertyType": "global",
        "rules": [
            {
                "t": "true"
            }
        ],
        "checkall": "true",
        "repair": false,
        "outputs": 1,
        "x": 330,
        "y": 540,
        "wires": [
            [
                "e1f2df8a.93357"
            ]
        ]
    },
    {
        "id": "e1f2df8a.93357",
        "type": "switch",
        "z": "c69f2c5.2c677d",
        "name": "当前无雨",
        "property": "intensity",
        "propertyType": "global",
        "rules": [
            {
                "t": "lte",
                "v": "0.02",
                "vt": "num"
            }
        ],
        "checkall": "true",
        "repair": false,
        "outputs": 1,
        "x": 480,
        "y": 540,
        "wires": [
            [
                "836c5803.760da8"
            ]
        ]
    },
    {
        "id": "836c5803.760da8",
        "type": "delay",
        "z": "c69f2c5.2c677d",
        "name": "限制频率",
        "pauseType": "rate",
        "timeout": "5",
        "timeoutUnits": "seconds",
        "rate": "1",
        "nbRateUnits": "1",
        "rateUnits": "hour",
        "randomFirst": "1",
        "randomLast": "5",
        "randomUnits": "seconds",
        "drop": false,
        "x": 620,
        "y": 540,
        "wires": [
            [
                "e73c6d0b.5e7b6"
            ]
        ]
    },
    {
        "id": "e73c6d0b.5e7b6",
        "type": "function",
        "z": "c69f2c5.2c677d",
        "name": "推送消息",
        "func": "Date.prototype.Format = function (fmt) {  \n    var o = {\n        \"M+\": this.getMonth() + 1, //月份 \n        \"d+\": this.getDate(), //日 \n        \"h+\": this.getHours(), //小时 \n        \"m+\": this.getMinutes(), //分 \n        \"s+\": this.getSeconds(), //秒 \n        \"q+\": Math.floor((this.getMonth() + 3) / 3), //季度 \n        \"S\": this.getMilliseconds() //毫秒 \n    };\n    if (/(y+)/.test(fmt)) fmt = fmt.replace(RegExp.$1, (this.getFullYear() + \"\").substr(4 - RegExp.$1.length));\n    for (var k in o)\n    if (new RegExp(\"(\" + k + \")\").test(fmt)) fmt = fmt.replace(RegExp.$1, (RegExp.$1.length == 1) ? (o[k]) : ((\"00\" + o[k]).substr((\"\" + o[k]).length)));\n    return fmt;\n}\nvar mydate = new Date().Format(\"yyyy年MM月dd日 hh:mm:ss\");\n\nwechat = {\n   \"touser\" : \"@all\",\n   \"msgtype\" : \"textcard\",\n   \"textcard\" : {\n            \"title\" : `${msg.weather.description}`,\n            \"description\" : `<div class=\\\"gray\\\">${mydate}</div><div class=\\\"highlight\\\">${msg.predit}</div>`,\n            \"url\" : `空白页面,还没想好。`,\n            \"btntxt\":\"详细\"\n   },\n}\n\nmsg.payload = {};\nmsg.payload = wechat;\n\nreturn msg;",
        "outputs": 1,
        "noerr": 0,
        "x": 760,
        "y": 540,
        "wires": [
            [
                "4268aa4d.2ef1f4"
            ]
        ]
    },
    {
        "id": "4268aa4d.2ef1f4",
        "type": "bizwechat-push",
        "z": "c69f2c5.2c677d",
        "name": "",
        "bizwechat": "",
        "x": 900,
        "y": 540,
        "wires": [
            []
        ]
    },
    {
        "id": "da704354.14499",
        "type": "function",
        "z": "c69f2c5.2c677d",
        "name": "基础数据",
        "func": "var msg1 = {};\nvar msg2 = {};\nvar msg3 = {};\n\n\n//彩云API\ncy_api = 'xxxxxxxxxxx'\n\n//高德API\ngd_api = 'xxxxxxxxxxxx'\n\n//获取经度\n// longitude = global.get(\"lon\");\nlongitude = \"110.3537954\"\n//获取纬度\n// latitude = global.get(\"lat\");\nlatitude = \"28.3706806\"\n\n\nmsg1.mode = msg.payload.mode;\nmsg2.mode = msg.payload.mode;\nmsg3.mode = msg.payload.mode;\n\nmsg1.topic = 'realtime';\nmsg2.topic = 'forecast';\nmsg3.topic = 'georegeo';\n\nmsg1.cy_api = cy_api;\nmsg2.cy_api = cy_api;\nmsg3.gd_api = gd_api;\n\nmsg1.longitude = longitude;\nmsg2.longitude = longitude;\nmsg3.longitude = longitude;\n\nmsg1.latitude = latitude;\nmsg2.latitude = latitude;\nmsg3.latitude = latitude;\n\nreturn [msg1, msg2, msg3];",
        "outputs": 3,
        "noerr": 0,
        "x": 340,
        "y": 400,
        "wires": [
            [
                "7aab9065.7091d"
            ],
            [
                "92ae69c8.c14858"
            ],
            [
                "f620e578.3c30f8"
            ]
        ]
    },
    {
        "id": "d05c051b.d8ddd8",
        "type": "inject",
        "z": "c69f2c5.2c677d",
        "name": "定时降雨预警",
        "topic": "",
        "payload": "{\"mode\":\"alert\"}",
        "payloadType": "json",
        "repeat": "600",
        "crontab": "",
        "once": false,
        "onceDelay": "1",
        "x": 140,
        "y": 340,
        "wires": [
            [
                "da704354.14499"
            ]
        ]
    },
    {
        "id": "d2cd4dee.5731e",
        "type": "debug",
        "z": "c69f2c5.2c677d",
        "name": "",
        "active": false,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "true",
        "targetType": "full",
        "x": 910,
        "y": 400,
        "wires": []
    },
    {
        "id": "e747cd41.81267",
        "type": "switch",
        "z": "c69f2c5.2c677d",
        "name": "mode内容",
        "property": "mode",
        "propertyType": "msg",
        "rules": [
            {
                "t": "eq",
                "v": "alert",
                "vt": "str"
            },
            {
                "t": "else"
            }
        ],
        "checkall": "false",
        "repair": false,
        "outputs": 2,
        "x": 150,
        "y": 580,
        "wires": [
            [
                "63e27bbe.5103d4",
                "8cf3e32b.13c1c",
                "7a141c4c.535f04"
            ],
            [
                "1cfe438f.47013c"
            ]
        ]
    },
    {
        "id": "37a7a954.d95176",
        "type": "change",
        "z": "c69f2c5.2c677d",
        "name": "微信主动模式",
        "rules": [
            {
                "t": "set",
                "p": "payload.mode",
                "pt": "msg",
                "to": "wechat",
                "tot": "str"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 140,
        "y": 460,
        "wires": [
            [
                "da704354.14499"
            ]
        ]
    },
    {
        "id": "8cf3e32b.13c1c",
        "type": "switch",
        "z": "c69f2c5.2c677d",
        "name": "alert为真",
        "property": "alert_s",
        "propertyType": "msg",
        "rules": [
            {
                "t": "true"
            }
        ],
        "checkall": "false",
        "repair": false,
        "outputs": 1,
        "x": 320,
        "y": 580,
        "wires": [
            [
                "dc0ec132.7278c"
            ]
        ]
    },
    {
        "id": "dc0ec132.7278c",
        "type": "switch",
        "z": "c69f2c5.2c677d",
        "name": "对比位置",
        "property": "alert_city",
        "propertyType": "msg",
        "rules": [
            {
                "t": "eq",
                "v": "payload.georegeo.regeocode.addressComponent.district",
                "vt": "msg"
            }
        ],
        "checkall": "false",
        "repair": false,
        "outputs": 1,
        "x": 460,
        "y": 580,
        "wires": [
            [
                "cf49df3f.9a60f"
            ]
        ]
    },
    {
        "id": "cf49df3f.9a60f",
        "type": "rbe",
        "z": "c69f2c5.2c677d",
        "name": "",
        "func": "rbe",
        "gap": "",
        "start": "",
        "inout": "out",
        "property": "alert_info",
        "x": 590,
        "y": 580,
        "wires": [
            [
                "d4f9dd8f.a89a4"
            ]
        ]
    },
    {
        "id": "d4f9dd8f.a89a4",
        "type": "function",
        "z": "c69f2c5.2c677d",
        "name": "推送消息",
        "func": "Date.prototype.Format = function (fmt) {  \n    var o = {\n        \"M+\": this.getMonth() + 1, //月份 \n        \"d+\": this.getDate(), //日 \n        \"h+\": this.getHours(), //小时 \n        \"m+\": this.getMinutes(), //分 \n        \"s+\": this.getSeconds(), //秒 \n        \"q+\": Math.floor((this.getMonth() + 3) / 3), //季度 \n        \"S\": this.getMilliseconds() //毫秒 \n    };\n    if (/(y+)/.test(fmt)) fmt = fmt.replace(RegExp.$1, (this.getFullYear() + \"\").substr(4 - RegExp.$1.length));\n    for (var k in o)\n    if (new RegExp(\"(\" + k + \")\").test(fmt)) fmt = fmt.replace(RegExp.$1, (RegExp.$1.length == 1) ? (o[k]) : ((\"00\" + o[k]).substr((\"\" + o[k]).length)));\n    return fmt;\n}\nvar mydate = new Date().Format(\"yyyy年MM月dd日 hh:mm:ss\");\n\nwechat = {\n   \"touser\" : \"@all\",\n   \"msgtype\" : \"textcard\",\n   \"textcard\" : {\n            \"title\" : `${msg.alert_title}`,\n            \"description\" : `<div class=\\\"gray\\\">范围:${msg.alert_city}</div><div class=\\\"gray\\\">${mydate}</div><div class=\\\"gray\\\">-----------------------------</div><div class=\\\"highlight\\\">${msg.alert_info}</div>`,\n            \"url\" : `空白页面`,\n            \"btntxt\":\"详细\"\n   },\n}\n\nmsg.payload = {};\nmsg.payload = wechat;\n\nreturn msg;",
        "outputs": 1,
        "noerr": 0,
        "x": 720,
        "y": 580,
        "wires": [
            [
                "766cfcdc.437a04"
            ]
        ]
    },
    {
        "id": "766cfcdc.437a04",
        "type": "bizwechat-push",
        "z": "c69f2c5.2c677d",
        "name": "",
        "bizwechat": "",
        "x": 860,
        "y": 580,
        "wires": [
            []
        ]
    },
    {
        "id": "7a141c4c.535f04",
        "type": "debug",
        "z": "c69f2c5.2c677d",
        "name": "",
        "active": false,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "true",
        "targetType": "full",
        "x": 350,
        "y": 480,
        "wires": []
    }
]

大佬牛逼,膜拜耶

1赞

厉害.膜拜大佬.这个很实用

感谢有大佬的分享,论坛有你更精彩!!!

大佬 我的还是差一点 没成功 推不到推送那边 不知道中间哪里出啦问题卡住了
msg.filename = /hawww/images/天气/封面图/${skycon_en}.jpg 这个是哪里的地址,不知道怎么填写 。我的nr是docker安装的

你要有一个可以外网访问的文件夹 素材应该放在那里。

msg.picr_url =
这个位置已经填了 外网访问地址了

大佬,如果使用微信主动模式,怎么能通过FromUserName发送到指定微信用户上,搞了好一会儿了,弄不来

大神,啥时候出续集?

看看疫情提醒的流程,里面有

我试了,用了那个flow.set保存username,把推送前的那个函数里的"touser" : “@all”,改成msg.fromusername后就是提取不了名字,好像流程传到后面只有天气信息和图片信息,大改的话,以我目前水平,我不会。。。

非常漂亮,已经用上了,非常感谢。还是有个问题始终没有办法处理,在“获取数据”节点上,总是报告“function : (error)
“TypeError: Cannot read property ‘formatted_address’ of undefined””错误。我现在只能把“msg.address = data_georegeo.formatted_address”注释掉。我在高德地图api申请的是web应用。我在哪里出了问题呢?

大佬牛逼,期待更详细的解说

图片本地路径怎么填写 我是安装在docker里面的 路径怎么设置都是错误的

请问你解决了吗 本地图片地址你怎么填写的

同一直报这个错误 而且微信不推送

如果找不到错误,要点开节点一个个看,都加上debug,看看是输出啥信息。

我是高德地图申请的应用不对。应该是这个应用

请问外网访问文件夹 你是怎么实现的 我用ftp不行

不知道是不是你问的内容啊