fetch(modify):修复BUG
All checks were successful
构建并部署前端到测试环境 / build-and-deploy (push) Successful in 3m27s

This commit is contained in:
sexygoat
2026-02-03 14:39:45 +08:00
parent 2c6fe4375b
commit de9753f42d
28 changed files with 4344 additions and 5092 deletions

View File

@@ -0,0 +1,47 @@
/**
* 编码生成工具
*/
/**
* 生成套餐系列编码
* 规则: PS + 年月日时分秒 + 4位随机数
* 示例: PS20260203143025ABCD
*/
export function generateSeriesCode(): string {
const now = new Date()
const year = now.getFullYear()
const month = String(now.getMonth() + 1).padStart(2, '0')
const day = String(now.getDate()).padStart(2, '0')
const hours = String(now.getHours()).padStart(2, '0')
const minutes = String(now.getMinutes()).padStart(2, '0')
const seconds = String(now.getSeconds()).padStart(2, '0')
// 生成4位随机大写字母
const randomChars = Array.from({ length: 4 }, () =>
String.fromCharCode(65 + Math.floor(Math.random() * 26))
).join('')
return `PS${year}${month}${day}${hours}${minutes}${seconds}${randomChars}`
}
/**
* 生成套餐编码
* 规则: PKG + 年月日时分秒 + 4位随机数
* 示例: PKG20260203143025ABCD
*/
export function generatePackageCode(): string {
const now = new Date()
const year = now.getFullYear()
const month = String(now.getMonth() + 1).padStart(2, '0')
const day = String(now.getDate()).padStart(2, '0')
const hours = String(now.getHours()).padStart(2, '0')
const minutes = String(now.getMinutes()).padStart(2, '0')
const seconds = String(now.getSeconds()).padStart(2, '0')
// 生成4位随机大写字母
const randomChars = Array.from({ length: 4 }, () =>
String.fromCharCode(65 + Math.floor(Math.random() * 26))
).join('')
return `PKG${year}${month}${day}${hours}${minutes}${seconds}${randomChars}`
}