Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
C
cpas6-install
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
李金钢
cpas6-install
Commits
1df965af
Commit
1df965af
authored
Mar 12, 2026
by
李金钢
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add new file
parent
906822ad
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
39 additions
and
0 deletions
+39
-0
updateVersion.js
updateVersion.js
+39
-0
No files found.
updateVersion.js
0 → 100644
View file @
1df965af
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
}
`
);
});
});
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment