diff --git a/server/notification-providers/yzj.js b/server/notification-providers/yzj.js
new file mode 100644
index 000000000..829528184
--- /dev/null
+++ b/server/notification-providers/yzj.js
@@ -0,0 +1,73 @@
+const NotificationProvider = require("./notification-provider");
+const {DOWN, UP} = require("../../src/util");
+const {default: axios} = require("axios");
+
+class YZJ extends NotificationProvider {
+ name = "YZJ";
+
+ async send(notification, msg, monitorJSON = null, heartbeatJSON = null) {
+ let okMsg = "Sent Successfully.";
+
+ try {
+ if (heartbeatJSON != null) {
+ let params = {
+ content: `${this.statusToString(heartbeatJSON["status"])} ${monitorJSON["name"]} \n> ${heartbeatJSON["msg"]}\n> Time (${heartbeatJSON["timezone"]}): ${heartbeatJSON["localDateTime"]}`
+ };
+ if (await this.sendToYZJ(notification, params)) {
+ return okMsg;
+ }
+ } else {
+ let params = {
+ content: msg
+ };
+ if (await this.sendToYZJ(notification, params)) {
+ return okMsg;
+ }
+ }
+ } catch (error) {
+ this.throwGeneralAxiosError(error);
+ }
+ }
+
+ /**
+ * Send message to YZJ
+ * @param {BeanModel} notification
+ * @param {Object} params Parameters of message
+ * @returns {boolean} True if successful else false
+ */
+ async sendToYZJ(notification, params) {
+
+ let config = {
+ method: "POST",
+ headers: {
+ "Content-Type": "application/json",
+ },
+ url: `${notification.yzjWebHookUrl}?yzjtype=${notification.yzjType}&yzjtoken=${notification.yzjToken}`,
+ data: JSON.stringify(params),
+ };
+
+ let result = await axios(config);
+ if (result.data.success === true) {
+ return true;
+ }
+ throw new Error(result.data.errmsg);
+ }
+
+ /**
+ * Convert status constant to string
+ * @param {string} status The status constant
+ * @returns {string}
+ */
+ statusToString(status) {
+ switch (status) {
+ case DOWN:
+ return "❌";
+ case UP:
+ return "✅";
+ default:
+ return status;
+ }
+ }
+}
+
+module.exports = YZJ;
diff --git a/server/notification.js b/server/notification.js
index e7977eb4a..7ed62ffec 100644
--- a/server/notification.js
+++ b/server/notification.js
@@ -69,6 +69,7 @@ const Cellsynt = require("./notification-providers/cellsynt");
const Onesender = require("./notification-providers/onesender");
const Wpush = require("./notification-providers/wpush");
const SendGrid = require("./notification-providers/send-grid");
+const YZJ = require("./notification-providers/yzj");
class Notification {
@@ -154,7 +155,8 @@ class Notification {
new GtxMessaging(),
new Cellsynt(),
new Wpush(),
- new SendGrid()
+ new SendGrid(),
+ new YZJ()
];
for (let item of list) {
if (! item.name) {
diff --git a/src/components/NotificationDialog.vue b/src/components/NotificationDialog.vue
index f6d728029..270b67445 100644
--- a/src/components/NotificationDialog.vue
+++ b/src/components/NotificationDialog.vue
@@ -183,6 +183,7 @@ export default {
"ServerChan": "ServerChan (Server酱)",
"smsc": "SMSC",
"WPush": "WPush(wpush.cn)",
+ "YZJ": "YZJ(云之家群里机器人)"
};
// Sort by notification name
diff --git a/src/components/notifications/YZJ.vue b/src/components/notifications/YZJ.vue
new file mode 100644
index 000000000..ff49a2bc7
--- /dev/null
+++ b/src/components/notifications/YZJ.vue
@@ -0,0 +1,24 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {{ $t("here") }}
+
+
+
+
+
diff --git a/src/components/notifications/index.js b/src/components/notifications/index.js
index efa2af5c4..3bf9affd3 100644
--- a/src/components/notifications/index.js
+++ b/src/components/notifications/index.js
@@ -67,6 +67,7 @@ import Cellsynt from "./Cellsynt.vue";
import WPush from "./WPush.vue";
import SIGNL4 from "./SIGNL4.vue";
import SendGrid from "./SendGrid.vue";
+import YZJ from "./YZJ.vue";
/**
* Manage all notification form.
@@ -142,6 +143,7 @@ const NotificationFormList = {
"Cellsynt": Cellsynt,
"WPush": WPush,
"SendGrid": SendGrid,
+ "YZJ": YZJ,
};
export default NotificationFormList;
diff --git a/src/lang/en.json b/src/lang/en.json
index e215f1031..f89837b6e 100644
--- a/src/lang/en.json
+++ b/src/lang/en.json
@@ -1051,5 +1051,9 @@
"RabbitMQ Password": "RabbitMQ Password",
"rabbitmqHelpText": "To use the monitor, you will need to enable the Management Plugin in your RabbitMQ setup. For more information, please consult the {rabitmq_documentation}.",
"SendGrid API Key": "SendGrid API Key",
- "Separate multiple email addresses with commas": "Separate multiple email addresses with commas"
+ "Separate multiple email addresses with commas": "Separate multiple email addresses with commas",
+ "YZJ": "YZJ",
+ "YZJ Webhook URL": "YZJ Webhook URL",
+ "YZJ Robot Type": "YZJ Robot type",
+ "YZJ Robot Token": "YZJ Robot token"
}
diff --git a/src/lang/zh-CN.json b/src/lang/zh-CN.json
index 4d33c0afd..48c943e13 100644
--- a/src/lang/zh-CN.json
+++ b/src/lang/zh-CN.json
@@ -1100,5 +1100,9 @@
"RabbitMQ Nodes": "RabbitMQ 管理节点",
"Separate multiple email addresses with commas": "用逗号分隔多个电子邮件地址",
"rabbitmqHelpText": "要使用此监控项,您需要在 RabbitMQ 设置中启用管理插件。有关更多信息,请参阅 {rabitmq_documentation}。",
- "aboutSlackUsername": "更改消息发件人的显示名称。如果您想提及某人,请另行将其包含在友好名称中。"
+ "aboutSlackUsername": "更改消息发件人的显示名称。如果您想提及某人,请另行将其包含在友好名称中。",
+ "YZJ": "YZJ",
+ "YZJ Webhook URL": "YZJ Webhook 网址",
+ "YZJ Robot Type": "YZJ 机器人类型",
+ "YZJ Robot Token": "YZJ 机器人访问秘钥"
}