refactor(notification-providers): improve code for pushplus

This commit is contained in:
Teror Fox 2025-03-22 16:11:04 +08:00
parent ecd6b69eaf
commit 08718a9701
No known key found for this signature in database
GPG key ID: 82B1E8A0C5C0BAEA

View file

@ -7,11 +7,15 @@ class PushPlus extends NotificationProvider {
/**
* @inheritdoc
* @param {BeanModel} notification Notification object
* @param {string} msg Message content
* @param {?object} monitorJSON Monitor details
* @param {?object} heartbeatJSON Heartbeat details
* @returns {Promise<string>} Success message
*/
async send(notification, msg, monitorJSON = null, heartbeatJSON = null) {
const okMsg = "Sent Successfully.";
const url = `https://www.pushplus.plus/send`;
const url = "https://www.pushplus.plus/send";
try {
await axios.post(url, {
"token": notification.pushPlusSendKey,
@ -19,7 +23,7 @@ class PushPlus extends NotificationProvider {
"content": msg,
"template": "html"
}, { headers: { "Content-Type": "application/json" } }
);
);
return okMsg;
} catch (error) {
@ -47,4 +51,4 @@ class PushPlus extends NotificationProvider {
}
}
module.exports = PushPlus;
module.exports = PushPlus;