|
|
@@ -105,7 +105,19 @@ function handleHeaders() {
|
|
|
magicJS.logger.info(`当前Cookie已经是最新无需更新`);
|
|
|
}
|
|
|
magicJS.data.write(MoConstKey.Cookie, newCookieStr);
|
|
|
+
|
|
|
+ let username = getUserUserNameByCookie(newCookieStr);
|
|
|
+ magicJS.data.write(`${MoConstKey.Cookie}#${username}`, newCookieStr);
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+function getUserUserNameByCookie(cookieStr) {
|
|
|
+ let cookieDict = magicJS.parseCookies(cookieStr);
|
|
|
+ let jwtData = magicJS.parseJwt(cookieDict.au);
|
|
|
+ if (jwtData) {
|
|
|
+ return jwtData.username;
|
|
|
}
|
|
|
+ return '';
|
|
|
}
|
|
|
|
|
|
function updateHeaders() {
|
|
|
@@ -319,6 +331,7 @@ async function checkAutoStartMonitorTask(configData) {
|
|
|
}
|
|
|
}
|
|
|
let msgTipsText = ``;
|
|
|
+ let htmlContent = ``;
|
|
|
if (taskAccIds.length > 0) {
|
|
|
let retCheck = await preStartTask();
|
|
|
if (!retCheck) {
|
|
|
@@ -334,6 +347,7 @@ async function checkAutoStartMonitorTask(configData) {
|
|
|
return;
|
|
|
}
|
|
|
}
|
|
|
+ htmlContent += `<h1><strong><span style="text-align: center;">监控信息</span></strong></h1>`;
|
|
|
let nowTimeStr = magicJS.formatDate(new Date(), 'HH:mm:ss');
|
|
|
if (nowTimeStr >= configData.startTime && nowTimeStr <= configData.endTime) {
|
|
|
let retStart = await startTask(taskAccIds);
|
|
|
@@ -341,9 +355,11 @@ async function checkAutoStartMonitorTask(configData) {
|
|
|
startedLst = startedLst.concat(willStartLst);
|
|
|
let resData = retStart.data;
|
|
|
let taskRetText = `账号监控任务启动账号数量:${willStartLst.length},相关账号如下:\n`;
|
|
|
+ htmlContent += `<p style="margin-bottom: 10px;">账号监控任务启动账号数量:${willStartLst.length},相关账号如下:</p>`;
|
|
|
for (let i = 0; i < willStartLst.length; i++) {
|
|
|
let accountInfo = willStartLst[i];
|
|
|
taskRetText += `账号[${accountInfo.xmAccount}]启动...\n`;
|
|
|
+ htmlContent += `<p style="margin-bottom: 10px;">账号[${accountInfo.xmAccount}]启动...</p>`;
|
|
|
}
|
|
|
taskRetText += `账号监控任务启动结果概览:\n`;
|
|
|
taskRetText += `新增:${resData.addCount}\n`;
|
|
|
@@ -352,6 +368,12 @@ async function checkAutoStartMonitorTask(configData) {
|
|
|
taskRetText += `现存账号数:${resData.occNodeNum}\n`;
|
|
|
magicJS.logger.info(taskRetText);
|
|
|
msgTipsText += taskRetText + '\n';
|
|
|
+
|
|
|
+ htmlContent += `<p style="margin-bottom: 10px;">账号监控任务启动结果概览:</p>`;
|
|
|
+ htmlContent += `<p style="margin-bottom: 10px;">新增:${resData.addCount}</p>`;
|
|
|
+ htmlContent += `<p style="margin-bottom: 10px;">关闭:${resData.closeCount}</p>`;
|
|
|
+ htmlContent += `<p style="margin-bottom: 10px;">失败:${resData.failCount}</p>`;
|
|
|
+ htmlContent += `<p style="margin-bottom: 10px;">现存账号数:${resData.occNodeNum}</p>`;
|
|
|
}
|
|
|
} else {
|
|
|
msgTipsText += `当前时间不在运行时间段内,不执行任务!\n`;
|
|
|
@@ -370,6 +392,7 @@ async function checkAutoStartMonitorTask(configData) {
|
|
|
fastAccountIds = retFastData.data.account.split(',');
|
|
|
}
|
|
|
msgTipsText += `神秘空间剩余可用名额:${left},启动结果如下:\n`;
|
|
|
+ htmlContent += `<p style="margin-bottom: 10px;">神秘空间剩余可用名额:${left},启动结果如下:</p>`;
|
|
|
for (let i = 0; i < startedLst.length; i++) {
|
|
|
let accountInfo = startedLst[i];
|
|
|
if (fastAccountIds.includes(accountInfo.xmAccount)) {
|
|
|
@@ -378,12 +401,14 @@ async function checkAutoStartMonitorTask(configData) {
|
|
|
let retSet = await setCommonFastTrackAccount(accountInfo.xmAccount);
|
|
|
if (retSet && retSet.code == 0) {
|
|
|
msgTipsText += `账号[${accountInfo.xmAccount}]添加成功\n`;
|
|
|
+ htmlContent += `<p style="margin-bottom: 10px;">账号[${accountInfo.xmAccount}]添加成功</p>`;
|
|
|
left -= 1;
|
|
|
if (left <= 0) {
|
|
|
break;
|
|
|
}
|
|
|
} else {
|
|
|
msgTipsText += `账号[${accountInfo.xmAccount}]添加失败,原因:${retSet?.message}\n`;
|
|
|
+ htmlContent += `<p style="margin-bottom: 10px;">账号[${accountInfo.xmAccount}]添加失败,原因:${retSet?.message}</p>`;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
@@ -393,21 +418,25 @@ async function checkAutoStartMonitorTask(configData) {
|
|
|
(!retFastData.data.compensateAccount || retFastData.data.compensateAccount.length === 0) &&
|
|
|
retFastData.data.account) {
|
|
|
magicJS.logger.info(`设置可添加补偿的账号`);
|
|
|
+ msgTipsText += `光头补偿补偿设置结果如下:\n`;
|
|
|
+ htmlContent += `<p style="margin-bottom: 10px;">光头补偿补偿设置结果如下:</p>`;
|
|
|
let accountArr = retFastData.data.account.split(",");
|
|
|
if (accountArr.length > 0) {
|
|
|
let randAccount = accountArr[Math.floor(Math.random() * accountArr.length)];
|
|
|
let retCompensate = await setCompensateFastTrackAccount(randAccount);
|
|
|
if (retCompensate && retCompensate.code == 0) {
|
|
|
msgTipsText += `账号[${randAccount}]设置为补偿的账号成功\n`;
|
|
|
+ htmlContent += `<p style="margin-bottom: 10px;">账号[${randAccount}]设置为补偿的账号成功</p>`;
|
|
|
} else {
|
|
|
msgTipsText += `账号[${randAccount}]设置为补偿的账号失败,原因:${retCompensate?.message}\n`;
|
|
|
+ htmlContent += `<p style="margin-bottom: 10px;">账号[${randAccount}]设置为补偿的账号失败,原因:${retCompensate?.message}</p>`;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
if (msgTipsText.length > 0) {
|
|
|
magicJS.notification.appendNotifyInfo(msgTipsText);
|
|
|
- await doCustomWxpusherSend(`小芒嫩模助手监控任务开启`, msgTipsText, 'https://mo.10coo.com/');
|
|
|
+ await doCustomWxpusherSend(`小芒嫩模助手监控任务开启`, htmlContent, 'https://mo.10coo.com/');
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -430,6 +459,8 @@ async function doLogin(username, password) {
|
|
|
if (rspData.code == 0) {
|
|
|
let cookieSetStr = headers['Set-Cookie'];
|
|
|
magicJS.data.write(MoConstKey.Cookie, cookieSetStr);
|
|
|
+ let username = getUserUserNameByCookie(cookieSetStr);
|
|
|
+ magicJS.data.write(`${MoConstKey.Cookie}#${username}`, cookieSetStr);
|
|
|
updateHeaders();
|
|
|
}
|
|
|
magicJS.logger.info(`rspData=${JSON.stringify(rspData)}`);
|
|
|
@@ -968,6 +999,8 @@ async function checkExistOrderNoPay() {
|
|
|
let msgTipsText = '';
|
|
|
let nopayCount = 0;
|
|
|
let orderList = retOrderList.data;
|
|
|
+
|
|
|
+ let htmlContent = `<h1><strong><span style="text-align: center;">订单信息</span></strong></h1>`;
|
|
|
for (let i = 0; i < orderList.length; i++) {
|
|
|
let d = orderList[i];
|
|
|
let orderId = d.id;
|
|
|
@@ -979,7 +1012,10 @@ async function checkExistOrderNoPay() {
|
|
|
let priceStr = `¥${d.amount}`;
|
|
|
let payStatus = await doPayResultCheck(orderId);
|
|
|
if (payStatus) {
|
|
|
- msgTipsText += `账号[${xmAccount}]${alias}下的订单:\n${goodsStr}(${priceStr})已付款,无需处理\n`;
|
|
|
+ msgTipsText += `账号[${xmAccount}](${alias})下的订单:\n${goodsStr}(${priceStr})已付款,无需处理\n`;
|
|
|
+ htmlContent += `<p style="margin-bottom: 10px; font-weight: bold;">账号[${xmAccount}](${alias})下的订单:</p>`;
|
|
|
+ htmlContent += `<p style="margin-bottom: 10px;">订单产品:${goodsStr}(${priceStr})</p>`;
|
|
|
+ htmlContent += `<p style="margin-bottom: 10px;">订单状态:已付款,无需处理</p>`;
|
|
|
} else {
|
|
|
nopayCount += 1;
|
|
|
let retDetail = await queryOrderDetail(orderId);
|
|
|
@@ -999,8 +1035,10 @@ async function checkExistOrderNoPay() {
|
|
|
};
|
|
|
let officialStatus = data.officialStatus;
|
|
|
magicJS.logger.info(`订单状态:${statusMap[officialStatus] || `未知状态[${officialStatus}]`},订单号:${orderId}`);
|
|
|
- msgTipsText += `账号[${xmAccount}]${alias}下的订单:\n${goodsStr}(${priceStr})${[officialStatus]},请尽快去处理!过期时间:${expireStr}\n`;
|
|
|
-
|
|
|
+ msgTipsText += `账号[${xmAccount}]${alias}下的订单:\n${goodsStr}(${priceStr})${statusMap[officialStatus]},请尽快去处理!过期时间:${expireStr}\n`;
|
|
|
+ htmlContent += `<p style="margin-bottom: 10px;">账号[${xmAccount}](${alias})下的订单:</p>`;
|
|
|
+ htmlContent += `<p style="margin-bottom: 10px;">订单产品:${goodsStr}(${priceStr})</p>`;
|
|
|
+ htmlContent += `<p style="margin-bottom: 10px;">订单状态:${expireStr}</p>`;
|
|
|
if (officialStatus === -3 || officialStatus === 0) {
|
|
|
let wxKey = `${MoConstKey.OrderWxPayUrlData}#${orderId}`;
|
|
|
let wxPayUrl = magicJS.data.read(wxKey, null);
|
|
|
@@ -1012,6 +1050,9 @@ async function checkExistOrderNoPay() {
|
|
|
}
|
|
|
if (wxPayUrl) {
|
|
|
msgTipsText += `微信支付链接,请在微信内打开进行支付:\n${wxPayUrl}\n`;
|
|
|
+ msgTipsText += `\n`;
|
|
|
+
|
|
|
+ htmlContent += `<p style="margin-bottom: 10px;">请在微信内打开进行支付:<a href="${wxPayUrl}" style="color: #007bff; text-decoration: none;">请点击链接</a></p>`;
|
|
|
}
|
|
|
|
|
|
let zfbKey = `${MoConstKey.OrderZfbPayUrlData}#${orderId}`;
|
|
|
@@ -1024,7 +1065,10 @@ async function checkExistOrderNoPay() {
|
|
|
}
|
|
|
if (zfbPayUrl) {
|
|
|
msgTipsText += `支付宝支付链接,请浏览器打开跳转支付宝支付:\n${zfbPayUrl}\n`;
|
|
|
+ msgTipsText += `\n`;
|
|
|
+ htmlContent += `<p style="margin-bottom: 10px;">请浏览器打开跳转支付宝支付:<a href="${zfbPayUrl}" style="color: #007bff; text-decoration: none;">请点击链接</a></p>`;
|
|
|
}
|
|
|
+ htmlContent += `<p><br /></p>`;
|
|
|
msgTipsText += `\n`;
|
|
|
}
|
|
|
} else {
|
|
|
@@ -1034,7 +1078,7 @@ async function checkExistOrderNoPay() {
|
|
|
}
|
|
|
magicJS.logger.info(msgTipsText);
|
|
|
if (nopayCount > 0) {
|
|
|
- await doCustomWxpusherSend(`存在待付订单(${nopayCount})`, msgTipsText, 'https://mo.10coo.com/');
|
|
|
+ await doCustomWxpusherSend(`存在待付订单(${nopayCount})`, htmlContent, 'https://mo.10coo.com/');
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
@@ -1043,7 +1087,7 @@ async function doCustomWxpusherSend(title, content, url = '') {
|
|
|
appToken: "AT_7wDWqSoT8xpJCQqJtHpshKhw7kXc0XCW",
|
|
|
content: content,// 这是主体内容
|
|
|
summary: title,// 该参数可选,默认为 msg 的前10个字符
|
|
|
- contentType: 1,
|
|
|
+ contentType: 2,// 1:纯文本,2:html,3:markdown
|
|
|
// topicIds: [32852],
|
|
|
topicIds: [],
|
|
|
uids: [
|