【信用卡还款通知】node-red-contrib-bizwechat(企业微信推送)

如何使用node-red-contrib-bizwechat
请先看教程:基于企业微信的一对多消息送达服务-完美替代pushbear

实现信用卡还款通知教程:
第1步: 用excel表格把自己信用卡填写好

表格列参数说明

name 填写办卡人姓名
card 发卡银行
type 卡种类型
cardno 银行卡号
outdate 出帐日期(可在其银行APP查看)
days 出帐日期与还款日期间隔天数

第2步: 把excel表格数据复制到如下网址进行转JSON操作
网址:https://old.qqe2.com/jsontool/excel2json ,如图所示:

最后面多一个 , 请去掉

第3步: 把如下流程代码复制到自己的node-red中

[{"id":"d58e0e3c.8f44d","type":"tab","label":"信用卡还款通知","disabled":false,"info":""},{"id":"79280cfc.408894","type":"inject","z":"d58e0e3c.8f44d","name":"","topic":"每天8点查询","payload":"","payloadType":"date","repeat":"","crontab":"00 08 * * *","once":false,"onceDelay":0.1,"x":180,"y":120,"wires":[["e7dd58ff.b25ff8"]]},{"id":"e138069b.5b6c18","type":"debug","z":"d58e0e3c.8f44d","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","x":930,"y":120,"wires":[]},{"id":"e7dd58ff.b25ff8","type":"function","z":"d58e0e3c.8f44d","name":"信用卡处理程序","func":"        var card_json = [];//替换成你自己的json\n        //msg.payload=card_json[0];\n        let card_backdate = [];\n        let date = new Date();\n        let now_year = date.getFullYear();\n        let now_month = date.getMonth() + 1;\n        let now_day = date.getDate();\n        card_json.forEach(item => {\n            let dateyear = now_year;\n            let datemonth = now_month;\n            if (now_day < parseInt(item.outdate)) {\n                if (now_month > 1) {\n                    datemonth--;\n                }\n                else {\n\n                    dateyear--;\n                    datemonth = 12;\n                }\n\n            }\n            let spiltstr = \"-\";\n            let dateTime = new Date(dateyear + spiltstr + datemonth + spiltstr + item.outdate);\n            datemonth = dateTime.getMonth() + 1;\n            //出帐单日\n            let outdate = dateTime.getFullYear() + spiltstr + datemonth + spiltstr + dateTime.getDate();\n            //console.log(dateTime.getFullYear() + spiltstr + datemonth + spiltstr + dateTime.getDate());\n            dateTime = dateTime.setDate(dateTime.getDate() + parseInt(item.days));\n            dateTime = new Date(dateTime);\n            datemonth = dateTime.getMonth() + 1;\n            //还款日\n            let backdate = dateTime.getFullYear() + spiltstr + datemonth + spiltstr + dateTime.getDate();\n            //console.log(dateTime.getFullYear() + spiltstr + datemonth + spiltstr + dateTime.getDate());\n\n            if (datemonth == now_month) {\n                let diffday = dateTime.getDate() - now_day;\n                if (diffday >= 0 && diffday <= 2) {\n                    card_backdate.push({ diffday, name: item.name, card: item.card, type: item.type, cardno: item.cardno.substring(0, 4) + spiltstr + item.cardno.substring(4, 8) + spiltstr + item.cardno.substring(8, 12) + spiltstr + item.cardno.substring(12, 16), outdate, backdate });\n                }\n            }\n\n        });\n        let Markdown;\n        if (card_backdate.length > 0) {\n            var compare = function (prop) {\n                return function (obj1, obj2) {\n                    var val1 = obj1[prop];\n                    var val2 = obj2[prop];\n                    if (!isNaN(Number(val1)) && !isNaN(Number(val2))) {\n                        val1 = Number(val1);\n                        val2 = Number(val2);\n                    }\n                    if (val1 < val2) {\n                        return -1;\n                    } else if (val1 > val2) {\n                        return 1;\n                    } else {\n                        return 0;\n                    }\n                }\n            }\n            card_backdate=card_backdate.sort(compare(\"diffday\"));\n            Markdown=\"\\n\";\n            card_backdate.forEach(item => {\n                Markdown+=\"> * 还款银行:{\"+  item.name + \"}\" +  item.card + \",剩余:\" + item.diffday + \"天\\n\";\n                Markdown+=\"> * 银行类型:\" + item.type  + \"\\n\";\n                Markdown+=\"> * 银行卡号:\"+ item.cardno +\"\\n\";\n                Markdown+=\"> * 出帐日期:\" + item.outdate  +\"\\n\";\n                Markdown+=\"> * 还款日期:\"  + item.backdate +\"\\n\";\n                Markdown+=\"> * \\n\";\n            });\n\n        }\n        msg.title=\"最近2天到期信用卡:\" + card_backdate.length + \"张\";\n        msg.number = card_backdate.length;\n        msg.payload = Markdown;\n\nreturn msg;","outputs":1,"noerr":0,"x":440,"y":120,"wires":[["1c6be98d.d16736"]]},{"id":"be71b171.6b67","type":"bizwechat-input","z":"d58e0e3c.8f44d","name":"微信信用卡","bizwechat":"edbfd2fe.5f04c","x":120,"y":260,"wires":[[]]},{"id":"646cdc7c.1bc534","type":"bizwechat-pushbear","z":"d58e0e3c.8f44d","name":"还款提醒","bizwechat":"edbfd2fe.5f04c","touser":"","toparty":"","title":"信用卡还款通知","description":"","x":780,"y":120,"wires":[["e138069b.5b6c18"]]},{"id":"1c6be98d.d16736","type":"switch","z":"d58e0e3c.8f44d","name":"","property":"number","propertyType":"msg","rules":[{"t":"gt","v":"0","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":630,"y":120,"wires":[["646cdc7c.1bc534"]]},{"id":"29c578a4.5b1d28","type":"inject","z":"d58e0e3c.8f44d","name":"","topic":"每天20点查询","payload":"","payloadType":"date","repeat":"","crontab":"00 20 * * *","once":false,"onceDelay":0.1,"x":180,"y":180,"wires":[["e7dd58ff.b25ff8"]]},{"id":"edbfd2fe.5f04c","type":"bizwechat-configurator","z":"","name":"企业微信服务端","port":"","corpid":"","agentid":"","corpsecret":"","url":"","token":"","aeskey":"","client_id":"","client_secret":""}]

第4步:
对企业微信服务端配置修改成自己的,对函数中的JSON修改上面获得的JSON即可快速实现。

处理函数自己可以进行修改,默认查询最近2天信用卡还款,后期考虑把还款金额加入。

最终效果:

:joy:我缺的是通知吗? 我缺的是钱!

1赞

能得出来免息期最好了,根据免息期天数推荐消费哪张卡,希望能采纳

可以实现,这样养卡不好

能否给个思路,我打算自己用

出帐单后一天就可以了

刚好用上 学习下