1111111
This commit is contained in:
@@ -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()) {
|
||||
|
||||
Reference in New Issue
Block a user