From d1fd76e242a30e76110b64e8e719b5e4634a492e Mon Sep 17 00:00:00 2001 From: tsui110 Date: Sun, 28 Dec 2025 13:34:51 +0800 Subject: [PATCH] =?UTF-8?q?feat:=E7=A7=BB=E9=99=A4=E4=BA=86=E4=B8=8D?= =?UTF-8?q?=E5=BF=85=E8=A6=81=E7=9A=84=E7=BC=93=E5=AD=98=E6=9C=BA=E5=88=B6?= =?UTF-8?q?=EF=BC=8C=E7=A1=AE=E4=BF=9D=E6=95=B0=E6=8D=AE=E7=9A=84=E5=8F=8A?= =?UTF-8?q?=E6=97=B6=E6=80=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages-activity/activity/duiduipeng/index.vue | 30 ++------------------ 1 file changed, 3 insertions(+), 27 deletions(-) diff --git a/pages-activity/activity/duiduipeng/index.vue b/pages-activity/activity/duiduipeng/index.vue index 2beeae0..0aa32b2 100644 --- a/pages-activity/activity/duiduipeng/index.vue +++ b/pages-activity/activity/duiduipeng/index.vue @@ -521,41 +521,17 @@ function normalizeRewards(list) { enriched.sort((a, b) => (b.percent - a.percent)) return enriched } -function isFresh(ts) { - const now = Date.now() - const v = Number(ts || 0) - return now - v < 24 * 60 * 60 * 1000 -} -function getRewardCache() { - const obj = uni.getStorageSync('reward_cache_v1') || {} - return typeof obj === 'object' && obj ? obj : {} -} async function fetchRewardsForIssues(activityId) { const list = issues.value || [] - const cache = getRewardCache() - const act = cache[activityId] || {} - const toFetch = [] - list.forEach(it => { - const c = act[it.id] - if (c && isFresh(c.ts) && Array.isArray(c.value)) { - rewardsMap.value = { ...(rewardsMap.value || {}), [it.id]: c.value } - } else { - toFetch.push(it) - } - }) - if (!toFetch.length) return - const promises = toFetch.map(it => getActivityIssueRewards(activityId, it.id)) + const promises = list.map(it => getActivityIssueRewards(activityId, it.id)) const results = await Promise.allSettled(promises) - const nextAct = { ...act } + results.forEach((res, i) => { - const issueId = toFetch[i] && toFetch[i].id + const issueId = list[i] && list[i].id if (!issueId) return const value = res.status === 'fulfilled' ? normalizeRewards(res.value) : [] rewardsMap.value = { ...(rewardsMap.value || {}), [issueId]: value } - nextAct[issueId] = { value, ts: Date.now() } }) - cache[activityId] = nextAct - uni.setStorageSync('reward_cache_v1', cache) } async function fetchIssues(id) {