This commit is contained in:
cao123
2026-08-13 14:28:23 +08:00
parent d0776f9676
commit 5a27caee6d
7 changed files with 142 additions and 17 deletions
+12 -3
View File
@@ -7,8 +7,17 @@ type RequestProps = {
needLogin?: boolean;
};
// 每次请求动态生成 header,确保使用最新的 openId
const fingerprint = wx.getSystemInfoSync();
// 生成设备指纹字符串
const generateFingerprint = (): string => {
const info = wx.getSystemInfoSync();
return [
String(info.system),
String(info.platform),
String(info.SDKVersion),
String(info.screenWidth),
String(info.screenHeight),
].join("&");
};
export const request = <T = any>(
@@ -16,7 +25,7 @@ export const request = <T = any>(
): Promise<T> => {
const app = getApp<IAppOption>();
const header: any = {
"X-Fingerprint": fingerprint,
"X-Fingerprint": generateFingerprint(),
};
if (needLogin) {
if (!app.checkLoginState()) {