fix: lincan support

This commit is contained in:
lyz05
2022-12-14 15:50:55 +08:00
parent 62492dc809
commit 1dfc243689
2 changed files with 11 additions and 5 deletions

View File

@@ -2,11 +2,18 @@ const axios = require('axios');
const tgbot = require("../tgbot/tgbot.js");
const rootPath = 'https://eservice.ssm.gov.mo/covidvacbook/'
const chatID = 619935997;
const chatID = [619935997, 5646988443];
const IDTYPES = ["J", "f", "M", "h", "O", "n"]
console.log('covidbook.js loaded')
function sendMessage(msg) {
const bot = tgbot.hkaliyun;
chatID.forEach(id => {
bot.sendMessage(id, msg);
});
}
async function GetLocationQuotaList() {
const url = rootPath + 'Booking/GetLocationQuotaList';
const res = await axios.post(url, {});
@@ -51,8 +58,6 @@ async function GetlocationList() {
}
async function main() {
const bot = tgbot.hkaliyun;
const { ivlocationquotalist, mrnalocationquotalist } = await GetLocationQuotaList();
const quotalist = mrnalocationquotalist;
@@ -63,7 +68,7 @@ async function main() {
const { location } = await getlocationbyidtype(idtype)
const name = location[0].name_c;
if (bookdatelist.length != 0) {
bot.sendMessage(chatID, name + "\n" + bookdatelist.join('\n'));
sendMessage(name + "\n" + bookdatelist.join('\n'));
}
}
@@ -97,4 +102,5 @@ if (!module.parent) {
// 引入环境变量
require("dotenv").config('../.env');
main()
sendMessage('测试')
}

View File

@@ -33,7 +33,7 @@ module.exports = (app) => {
});
});
});
cron.schedule("*/15 * * * * *", () => {
cron.schedule("*/30 * * * * *", () => {
covidbook();
});
};