useEffect(() => {
// 计算当前时间和第二天零点时间之间的时间
const nextDayMidnight = new Date(serverTimeRef.current);
nextDayMidnight.setHours(config?.updateHours || 0, config?.updateMinutes || 0, 3, 0);
if (nextDayMidnight.getTime() < serverTimeRef.current) {
nextDayMidnight.setDate(nextDayMidnight.getDate() + 1);
}
// 计算时间差
const timeDifference = nextDayMidnight.getTime() - serverTimeRef.current;
if (fetchActivityList) {
timeRef.current = setTimeout(() => {
fetchActivityList();
}, timeDifference);
}
return () => {
clearTimeout(timeRef.current);
};
}, []);