|
|
@ -9,7 +9,7 @@ cron: 0,10 * * * * |
|
|
|
//涵
|
|
|
|
process.env.dyh = "111"; |
|
|
|
// process.env.PUSH_KEY = 'SCT46897TQDkm3LUOZdiklUhe1wyLhhfa'
|
|
|
|
let DD_BOT_TOKEN,SCKEY; |
|
|
|
let DD_BOT_TOKEN, SCKEY; |
|
|
|
if (process.env.DD_BOT_TOKEN) { |
|
|
|
DD_BOT_TOKEN = process.env.DD_BOT_TOKEN; |
|
|
|
if (process.env.DD_BOT_SECRET) { |
|
|
@ -31,7 +31,7 @@ let userIdx = 0 |
|
|
|
let userCount = 0 |
|
|
|
let baseUrl = 'http://423n669m71.no-ip.org:9000/api/endpoints/2'; |
|
|
|
let apiKey = "ptr_oQzrYfeDBfuGSbaK2qOM83zN94RyEZfO8v+DdUJwccA=" |
|
|
|
let keys=['篮球',"田径","羽毛球","排球"] |
|
|
|
let keys = ['篮球', "羽毛球", "排球"] |
|
|
|
|
|
|
|
///////////////////////////////////////////////////////////////////
|
|
|
|
class UserInfo { |
|
|
@ -182,7 +182,7 @@ class UserInfo { |
|
|
|
const key = keys[index]; |
|
|
|
await this.getRace(key); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} catch (e) { |
|
|
|
console.log(e) |
|
|
|
} finally { |
|
|
@ -485,7 +485,7 @@ function Env (name, env) { |
|
|
|
} |
|
|
|
async showmsg () { |
|
|
|
if (!this.notifyStr) return; |
|
|
|
let notifyBody =this.notifyStr |
|
|
|
let notifyBody = this.notifyStr |
|
|
|
if ($.isNode()) { |
|
|
|
var notify = require('./sendNotify'); |
|
|
|
console.log('\n============== 推送 ==============') |
|
|
@ -610,7 +610,7 @@ async function sendNotify (text, desp, params = {}, author = '\n\n仅供用于 |
|
|
|
//由于上述两种微信通知需点击进去才能查看到详情,故text(标题内容)携带了账号序号以及昵称信息,方便不点击也可知道是哪个京东哪个活动
|
|
|
|
text = text.match(/.*?(?=\s?-)/g) ? text.match(/.*?(?=\s?-)/g)[0] : text; |
|
|
|
await Promise.all([ |
|
|
|
wxmmmm(text,desp), |
|
|
|
wxmmmm(text, desp), |
|
|
|
ddBotNotify(text, desp),//钉钉机器人
|
|
|
|
]) |
|
|
|
} |
|
|
@ -673,13 +673,13 @@ async function ddBotNotify (text, desp, time = 2100) { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
async function getToken() { |
|
|
|
async function getToken () { |
|
|
|
const params = { |
|
|
|
grant_type: 'client_credential', |
|
|
|
appid: 'wx78d0fd108ab26b67', // 你的appid 1
|
|
|
|
secret: '86e3801eb4518af21082e640e4f29473', // 你的secret 2
|
|
|
|
grant_type: 'client_credential', |
|
|
|
appid: 'wx78d0fd108ab26b67', // 你的appid 1
|
|
|
|
secret: '86e3801eb4518af21082e640e4f29473', // 你的secret 2
|
|
|
|
}; |
|
|
|
let pp=$.json2str(params,"&"); |
|
|
|
let pp = $.json2str(params, "&"); |
|
|
|
const options = { |
|
|
|
url: `https://api.weixin.qq.com/cgi-bin/token?${pp}`, |
|
|
|
headers: { |
|
|
@ -690,29 +690,29 @@ async function getToken() { |
|
|
|
await httpRequest('get', options) |
|
|
|
res = httpResult; |
|
|
|
return res.access_token; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
async function templateMessageSend(title,context) { |
|
|
|
async function templateMessageSend (title, context) { |
|
|
|
const token = await getToken(); |
|
|
|
const url = 'https://api.weixin.qq.com/cgi-bin/message/template/send?access_token=' + token; |
|
|
|
const params = { |
|
|
|
"touser": 'oTHpRuGEWxCYqCPMOidO7vWXjrww', // 用户openid 3
|
|
|
|
"template_id": 'K5YpydwHeNbr6R1dUna4rYs2xhjvZmqR8KrkRFqhFwY', // 模板id 4
|
|
|
|
// url: 'http://www.baidu.com',
|
|
|
|
"topcolor": '#FF0000', |
|
|
|
"data": { |
|
|
|
"title": { |
|
|
|
"value": title |
|
|
|
"touser": 'oTHpRuGEWxCYqCPMOidO7vWXjrww', // 用户openid 3
|
|
|
|
"template_id": 'K5YpydwHeNbr6R1dUna4rYs2xhjvZmqR8KrkRFqhFwY', // 模板id 4
|
|
|
|
// url: 'http://www.baidu.com',
|
|
|
|
"topcolor": '#FF0000', |
|
|
|
"data": { |
|
|
|
"title": { |
|
|
|
"value": title + "JD" |
|
|
|
}, |
|
|
|
"content": { |
|
|
|
"value": context |
|
|
|
}, |
|
|
|
}, |
|
|
|
"content": { |
|
|
|
"value": context |
|
|
|
}, |
|
|
|
}, |
|
|
|
}; |
|
|
|
|
|
|
|
const options = { |
|
|
|
url: url, |
|
|
|
body:JSON.stringify(params), |
|
|
|
body: JSON.stringify(params), |
|
|
|
headers: { |
|
|
|
'Content-Type': 'application/json;charset=utf-8' |
|
|
|
} |
|
|
@ -720,12 +720,11 @@ async function getToken() { |
|
|
|
await httpRequest('post', options) |
|
|
|
res = httpResult; |
|
|
|
console.log('res: ', res); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
async function wxmmmm(title,context) |
|
|
|
{ |
|
|
|
async function wxmmmm (title, context) { |
|
|
|
const wxmpy = require('wxmnode'); |
|
|
|
let res = await wxmpy.sendMsgToUser("45741299", "871333",title,context,"") |
|
|
|
let res = await wxmpy.sendMsgToUser("45741299", "871333", title, context, "") |
|
|
|
console.log('res: ', res); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|