🔨 修改系统设置逻辑.

This commit is contained in:
lijiahang
2025-01-20 10:24:40 +08:00
parent 27e3e65ea1
commit dc42a31711
10 changed files with 721 additions and 66 deletions

View File

@@ -129,6 +129,21 @@ export function formatDuration(start: number, end?: number): string {
return result;
}
/**
* 转为匿名数字 number | undefined
*/
export function toAnonymousNumber(value: string | undefined): number {
if (value === undefined || value === null) {
return value as unknown as number;
}
const num = Number.parseInt(value);
if (Number.isNaN(num)) {
return undefined as unknown as number;
} else {
return num;
}
}
/**
* 格式化数字为 ,分割
*/

View File

@@ -9,9 +9,9 @@ export const encrypt = async (data: string | undefined): Promise<string | undefi
return data;
}
// 获取公钥
const { encrypt } = await useCacheStore().loadSystemSetting();
const publicKey = (await useCacheStore().loadSystemSetting()).encrypt_publicKey;
const encryptor = new JSEncrypt();
encryptor.setPublicKey(encrypt?.publicKey);
encryptor.setPublicKey(publicKey);
// 加密
const value = encryptor.encrypt(data);
if (value === false) {