Skip to content

Commit

Permalink
feat(hook): fallback to local time if 'now' property does not exist
Browse files Browse the repository at this point in the history
Fixes: #1362

Signed-off-by: Tianling Shen <[email protected]>
  • Loading branch information
1715173329 committed Feb 19, 2024
1 parent 09bbff0 commit 60de7bd
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/hook.js
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,9 @@ hook.request.after = (ctx) => {
LOCAL_VIP_UID.includes(info.data.userId))
) {
try {
const expireTime = info.data.now + 31622400000;
const nowTime =
info.data.now || new Date().getTime();
const expireTime = nowTime + 31622400000;
info.data.redVipLevel = vipLevel;
info.data.redVipAnnualCount = 1;

Expand Down

0 comments on commit 60de7bd

Please sign in to comment.