81 lines
2.0 KiB
JavaScript
81 lines
2.0 KiB
JavaScript
import { SQLiteMessageQueue } from "./sqlite.js";
|
|
import path from "path";
|
|
import { md5 } from "./utils.js";
|
|
import axios from "axios";
|
|
|
|
const queue = new SQLiteMessageQueue();
|
|
|
|
const stats = queue.getStats();
|
|
|
|
// function merge() {
|
|
// let files = [
|
|
// { name: "长安", path: "changan.json" },
|
|
// { name: "奇瑞变更公告", path: "chery_bg.json" },
|
|
// { name: "奇瑞采购公告", path: "chery_cg.json" },
|
|
// { name: "奇瑞寻源预告", path: "chery_xy.json" },
|
|
// { name: "零跑", path: "leapMotor.json" },
|
|
// { name: "吉利", path: "geely.json" },
|
|
// { name: "一汽", path: "yiqi.json" },
|
|
// ];
|
|
// files.forEach((file) => {
|
|
// queue.migrateFromJsonFile(file.name, path.resolve(file.path));
|
|
// });
|
|
// }
|
|
// merge();
|
|
// 把message中的数据状态改成pending
|
|
// queue.getFailedMessages()
|
|
// .forEach((message) => {
|
|
// queue.updateMessageStatus(message.id, "pending");
|
|
// });
|
|
// function getSign(timestamp) {
|
|
// let secret = "cpwyyds";
|
|
// let uri = "/common/message/push";
|
|
// const url = uri + timestamp + secret;
|
|
// console.log(url);
|
|
// const myCalc = md5(url);
|
|
// let sign =
|
|
// myCalc.substring(5, 13) +
|
|
// myCalc.substring(29, 31) +
|
|
// myCalc.substring(18, 27);
|
|
// //sign 转大写
|
|
// sign = sign.toUpperCase();
|
|
// return sign;
|
|
// }
|
|
// let time = new Date().getTime();
|
|
// let data = {
|
|
// timestamp: time,
|
|
// sign: getSign(time),
|
|
// templateNo: "A002",
|
|
// url: "https://www.baidu.com/",
|
|
// paramList: [
|
|
// {
|
|
// key: "thing8",
|
|
// value: "网站name",
|
|
// },
|
|
// {
|
|
// key: "thing2",
|
|
// value: "项目name",
|
|
// },
|
|
// {
|
|
// key: "time14",
|
|
// value: "2025-11-2",
|
|
// },
|
|
// {
|
|
// key: "time17",
|
|
// value: "2025-11-3 00:00:00",
|
|
// },
|
|
// ],
|
|
// };
|
|
// axios({
|
|
// url: "https://testadvert.shenlintech.com/platform/common/message/push",
|
|
// method: "post",
|
|
// data,
|
|
// })
|
|
// .then((res) => {
|
|
// console.log(res.data);
|
|
// })
|
|
// .catch((err) => {
|
|
// console.log(err);
|
|
// });
|
|
console.log(stats);
|