feat:增加时分字符串转二进制方法

This commit is contained in:
liyi 2025-03-07 11:15:19 +08:00
parent 7c4a3a9039
commit 0c689286ad

View File

@ -26,6 +26,18 @@ export function timestampToArray(timestamp) {
array[3] = timestamp & 0xff
return array
}
// 时分字符串转二进制
export function parseTimeToList(timeString) {
let timeList = [0, 0, 0, 0]
if (timeString.includes(':')) {
let timeParts = timeString.split(':')
timeList[2] = parseInt(timeParts[0], 10)
timeList[3] = parseInt(timeParts[1], 10)
}
return new Uint8Array(timeList)
}
// md5加密
export function md5Encrypt(text, token, key) {