diff --git a/index.js b/index.js index ea91f8c..6d0eefd 100644 --- a/index.js +++ b/index.js @@ -13,6 +13,8 @@ setInterval(()=>{ if(rate < ref - thre){ console.log("GBP DOWN!!"); mail("i@yimian.xyz", `GBP DOWN TO ${rate}`, `Current Rate: ${rate}, Ref Rate: ${ref}`); + sms("18118155257", `英镑跌至${rate}`, `发消息提醒`); + sms("15827586269", `英镑跌至${rate}`, `发消息提醒`); ref = rate; LastRefDate = new Date(); } @@ -35,6 +37,11 @@ request(`https://webapi.huilv.cc/api/exchange?num=100&chiyouhuobi=${from}&duihua callback(erate); });} + var mail = (to, subject, body) => { - request(`https://api.yimian.xyz/mail/?to=${to}&subject=${subject}&body=${body}&from=exRate`); + request(encodeURI(`https://api.yimian.xyz/mail/?to=${to}&subject=${subject}&body=${body}&from=exRate`)); +} + +var sms = (to, s0, s1) => { + request(encodeURI(`https://api.yimian.xyz/sms/?to=${to}&s0=${s0}&s1=${s1}&t=` + Date.parse(new Date)/1000)); } diff --git a/package.json b/package.json index 3873df1..a5465a6 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "exrate", - "version": "1.0.0", + "version": "1.0.1", "description": "watch exchange rate with notification..", "main": "index.js", "scripts": {