Commit 1df965af authored by 李金钢's avatar 李金钢

Add new file

parent 906822ad
const fs = require("fs");
// 定义变量
const xmlFile = "E:\\CPAS6-101 UFCPAS6.0 致同智审IAS版_测试版\\Config\\Config.xml"; // 替换为你的 XML 文件路径
const currentDate = new Date();
const newDate = currentDate.toISOString().split("T")[0]; // 获取当前日期 (格式为 YYYY-MM-DD)
const vernoPrefix = "6.0."; // 定义 APP_VERNO 的固定前缀
// 随机生成一个 6 位版本号
const randomPart1 = Math.floor(Math.random() * 100);
const randomPart2 = Math.floor(Math.random() * 100);
const newVerNoNum = `${randomPart1}${randomPart2}`.padStart(6, "0"); // 确保版本号为 6 位
// 读取文件并处理内容
fs.readFile(xmlFile, "utf8", (err, data) => {
if (err) {
console.error("读取文件时出错:", err);
return;
}
// 替换 APP_DATE 和 APP_VERNO
let updatedData = data.replace(/APP_DATE="[^"]*"/, `APP_DATE="${newDate}"`);
updatedData = updatedData.replace(
/APP_VERNO="[^"]*"/,
`APP_VERNO="${vernoPrefix}${newVerNoNum}"`
);
// 将更新后的内容写回到文件
fs.writeFile(xmlFile, updatedData, "utf8", (err) => {
if (err) {
console.error("写入文件时出错:", err);
return;
}
console.log("4.0查账工具版本号更新完成!");
console.log(`APP_DATE 已更新为 ${newDate}`);
console.log(`APP_VERNO 已更新为 ${vernoPrefix}${newVerNoNum}`);
});
});
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment