🚨 修复 qodana 报错

This commit is contained in:
BTMuli
2023-10-25 18:32:33 +08:00
parent efa2156fb2
commit 73bf525d42
2 changed files with 3 additions and 4 deletions

View File

@@ -331,7 +331,7 @@ class TGClient {
async getDS(dsType: 2, callback: string, payload: any): Promise<void>;
async getDS(dsType: 1 | 2, callback: string, payload?: any): Promise<void> {
const saltType = dsType === 1 ? "lk2" : "common";
let ds = "";
let ds: string;
if (dsType === 2) {
const { body, query } = payload;
ds = getDS4JS(saltType, dsType, body, query);

View File

@@ -142,8 +142,7 @@ export function getDS4JS(
const salt = getSalt(saltType);
const time = Math.floor(Date.now() / 1000).toString();
let random = getRandomNumber(100000, 200000).toString();
let hashStr = "";
let md5Str = "";
let hashStr: string;
if (dsType === 1) {
random = getRandomString(6);
hashStr = `salt=${salt}&t=${time}&r=${random}`;
@@ -154,6 +153,6 @@ export function getDS4JS(
const queryStr = typeof query === "string" ? query : transParams(query);
hashStr = `salt=${salt}&t=${time}&r=${random}&b=${bodyStr}&q=${queryStr}`;
}
md5Str = Md5.md5.update(hashStr).hex();
const md5Str = Md5.md5.update(hashStr).hex();
return `${time},${random},${md5Str}`;
}