添加验证码处理逻辑

This commit is contained in:
张成
2025-08-24 15:40:37 +08:00
parent b92301a887
commit 5e31adee53
5 changed files with 152 additions and 33 deletions

View File

@@ -85,6 +85,17 @@ class TokenManager {
return !!token && !this.isTokenExpired()
}
// 获取令牌剩余有效时间(毫秒)
getTokenRemainingTime(): number {
const expiresAt = this.getTokenExpires()
if (!expiresAt) {
return 0 // 如果没有过期时间返回0
}
const remaining = expiresAt - Date.now()
return remaining > 0 ? remaining : 0
}
// 获取Authorization头
getAuthHeader(): Record<string, string> {
const token = this.getAccessToken()
@@ -93,7 +104,7 @@ class TokenManager {
}
return {
'Authorization': `Bearer ${token}`
'applet-token': `${token}`
}
}
}