MCPcopy Create free account
hub / github.com/6dylan6/jdpro / pushPlusNotify

Function pushPlusNotify

function/sendNotify.js:1712–1760  ·  view source on GitHub ↗
(text, desp)

Source from the content-addressed store, hash-verified

1710}
1711
1712function pushPlusNotify(text, desp) {
1713 return new Promise((resolve) => {
1714 if (PUSH_PLUS_TOKEN) {
1715
1716 //desp = `<font size="3">${desp}</font>`;
1717
1718 desp = desp.replace(/[\n\r]/g, '<br>'); // 默认为html, 不支持plaintext
1719 const body = {
1720 token: `${PUSH_PLUS_TOKEN}`,
1721 title: `${text}`,
1722 content: `${desp}`,
1723 topic: `${PUSH_PLUS_USER}`,
1724 };
1725 const options = {
1726 url: `https://www.pushplus.plus/send`,
1727 body: JSON.stringify(body),
1728 headers: {
1729 'Content-Type': ' application/json',
1730 },
1731 timeout,
1732 };
1733 $.post(options, (err, resp, data) => {
1734 try {
1735 if (err) {
1736 console.log(`push+发送${PUSH_PLUS_USER ? '一对多' : '一对一'}通知消息失败!!\n`);
1737 PushErrorTime += 1;
1738 console.log(err);
1739 } else {
1740 data = JSON.parse(data);
1741 if (data.code === 200) {
1742 console.log(`push+发送${PUSH_PLUS_USER ? '一对多' : '一对一'}通知消息完成。\n`);
1743 PushErrorTime = 0;
1744 } else {
1745 console.log(`push+发送${PUSH_PLUS_USER ? '一对多' : '一对一'}通知消息失败:${data.msg}\n`);
1746 PushErrorTime += 1;
1747 }
1748 }
1749 } catch (e) {
1750 $.logErr(e, resp);
1751 }
1752 finally {
1753 resolve(data);
1754 }
1755 });
1756 } else {
1757 resolve();
1758 }
1759 });
1760}
1761function wxpusherNotifyByOne(text, desp, strsummary = "") {
1762 return new Promise((resolve) => {
1763 if (WP_APP_TOKEN_ONE) {

Callers 1

sendNotifyFunction · 0.70

Calls 3

postMethod · 0.45
logMethod · 0.45
logErrMethod · 0.45

Tested by

no test coverage detected