diff --git a/jd_superMarket.js b/jd_superMarket.js index ef34cc1..6c30728 100644 --- a/jd_superMarket.js +++ b/jd_superMarket.js @@ -2,7 +2,7 @@ * @Author: lxk0301 https://github.com/lxk0301 * @Date: 2020-08-16 18:54:16 * @Last Modified by: lxk0301 - * @Last Modified time: 2020-11-05 18:54:37 + * @Last Modified time: 2020-11-10 18:54:37 */ /* 京小超(活动入口:京东APP-》首页-》京东超市-》底部东东超市) @@ -353,10 +353,16 @@ async function businessCircleActivity() { const receivedPkTeamPrize = await smtg_receivedPkTeamPrize(); console.log(`商圈PK奖励领取结果:${JSON.stringify(receivedPkTeamPrize)}`) if (receivedPkTeamPrize.data.bizCode === 0) { - const { pkTeamPrizeInfoVO } = receivedPkTeamPrize.data.result; - message += `【商圈PK奖励】${pkTeamPrizeInfoVO.blueCoin}蓝币领取成功\n`; - if ($.isNode()) { - await notify.sendNotify(`${$.name} - 账号${$.index} - ${$.nickName}`, `【京东账号${$.index}】 ${$.nickName}\n【商圈PK奖励】${pkTeamPrizeInfoVO.blueCoin}蓝币领取成功`) + if (receivedPkTeamPrize.data.result.pkResult === 1) { + const { pkTeamPrizeInfoVO } = receivedPkTeamPrize.data.result; + message += `【商圈PK奖励】${pkTeamPrizeInfoVO.blueCoin}蓝币领取成功\n`; + if ($.isNode()) { + await notify.sendNotify(`${$.name} - 账号${$.index} - ${$.nickName}`, `【京东账号${$.index}】 ${$.nickName}\n【商圈队伍】PK获胜\n【奖励】${pkTeamPrizeInfoVO.blueCoin}蓝币领取成功`) + } + } else if (receivedPkTeamPrize.data.result.pkResult === 2) { + if ($.isNode()) { + await notify.sendNotify(`${$.name} - 账号${$.index} - ${$.nickName}`, `【京东账号${$.index}】 ${$.nickName}\n【商圈队伍】PK失败`) + } } } } else if (prizeInfo.pkPrizeStatus === 1) { diff --git a/sendNotify.js b/sendNotify.js index cea4b44..6a7d86c 100644 --- a/sendNotify.js +++ b/sendNotify.js @@ -74,6 +74,7 @@ if (process.env.IGOT_PUSH_KEY) { async function sendNotify(text, desp, params = {}) { //提供五种通知 await serverNotify(text, desp); + text = text.match(/.*?(?=\s?-)/g) ? text.match(/.*?(?=\s?-)/g)[0] : text; await BarkNotify(text, desp, params); await tgBotNotify(text, desp); await ddBotNotify(text, desp); @@ -122,7 +123,7 @@ function BarkNotify(text, desp, params={}) { return new Promise(resolve => { if (BARK_PUSH) { const options = { - url: `${BARK_PUSH}/${encodeURIComponent(text.match(/.*?(?=\s?-)/g) && text.match(/.*?(?=\s?-)/g)[0])}/${encodeURIComponent(desp)}?sound=${BARK_SOUND}&${querystring.stringify(params)}`, + url: `${BARK_PUSH}/${encodeURIComponent(text)}/${encodeURIComponent(desp)}?sound=${BARK_SOUND}&${querystring.stringify(params)}`, headers: { 'Content-Type': 'application/x-www-form-urlencoded' } @@ -158,7 +159,7 @@ function tgBotNotify(text, desp) { if (TG_BOT_TOKEN && TG_USER_ID) { const options = { url: `https://api.telegram.org/bot${TG_BOT_TOKEN}/sendMessage`, - body: `chat_id=${TG_USER_ID}&text=${text.match(/.*?(?=\s?-)/g) && text.match(/.*?(?=\s?-)/g)[0]}\n\n${desp}&disable_web_page_preview=true`, + body: `chat_id=${TG_USER_ID}&text=${text}\n\n${desp}&disable_web_page_preview=true`, headers: { 'Content-Type': 'application/x-www-form-urlencoded' } @@ -209,7 +210,7 @@ function ddBotNotify(text, desp) { json: { "msgtype": "text", "text": { - "content": ` ${text.match(/.*?(?=\s?-)/g) && text.match(/.*?(?=\s?-)/g)[0]}\n\n${desp}` + "content": ` ${text}\n\n${desp}` } }, headers: { @@ -278,10 +279,10 @@ function iGotNotify(text, desp, params={}){ console.log('\n您所提供的IGOT_PUSH_KEY无效\n') resolve() return - } + } const options = { url: `https://push.hellyw.com/${IGOT_PUSH_KEY.toLowerCase()}`, - body: `title=${text.match(/.*?(?=\s?-)/g) && text.match(/.*?(?=\s?-)/g)[0]}&content=${desp}&${querystring.stringify(params)}`, + body: `title=${text}&content=${desp}&${querystring.stringify(params)}`, headers: { 'Content-Type': 'application/x-www-form-urlencoded' }