Skip to content

Fix: 企微三方获取授权企业accesstoken过期时间错误#3964

Merged
binarywang merged 2 commits intobinarywang:developfrom
HelloMrShu:develop
Apr 15, 2026
Merged

Fix: 企微三方获取授权企业accesstoken过期时间错误#3964
binarywang merged 2 commits intobinarywang:developfrom
HelloMrShu:develop

Conversation

@HelloMrShu
Copy link
Copy Markdown
Contributor

在AbstractWxCpTpInRedisConfigImpl类中,更新accessToken的方法中
1

使用的是凭证有效时长,单位是秒

3 但是在获取时,错误的将expire当作截止时间点的shi时间戳进行了有效期时长计算,所得有效期为负值,不符合预期,因此需要做如上修改

祝好。

@binarywang binarywang requested a review from Copilot April 14, 2026 14:26
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

该 PR 修复了企业微信第三方(服务商)授权企业的 access_token 在 Redis 存储场景下,读取有效期时把 TTL(秒)误当成“到期时间戳”参与计算,导致 expiresIn 变成负数的问题,从而影响上层对 token 有效期的判断与使用。

Changes:

  • getAccessTokenEntity 改为直接使用 Redis TTL(秒)作为 WxAccessToken.expiresIn 的来源,避免把 TTL 当时间戳计算导致负值。

Copy link
Copy Markdown
Contributor Author

@HelloMrShu HelloMrShu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

根据修改建议,做了调整,对expire做toIntExact并用Math.max兜底,避免静默截断

@binarywang binarywang merged commit 673af5e into binarywang:develop Apr 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants