Skip to content

Commit 70d29e5

Browse files
committed
🐞fix(wechat-public-account-push): 天行接口加入缓存后,永远只取第一个城市
1 parent c2fa8c9 commit 70d29e5

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/services/index.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -616,9 +616,9 @@ export const buildTianApi = async (apiType, params = null) => {
616616
return []
617617
}
618618

619-
if (RUN_TIME_STORAGE[`${apiType}_${count}`]) {
620-
console.log(`获取了相同的数据,读取缓存 >>> ${apiType}_${count}`)
621-
return RUN_TIME_STORAGE[`${apiType}_${count}`]
619+
if (RUN_TIME_STORAGE[`${apiType}_${JSON.stringify(params)}_${count}`]) {
620+
console.log(`获取了相同的数据,读取缓存 >>> ${apiType}_${JSON.stringify(params)}_${count}`)
621+
return RUN_TIME_STORAGE[`${apiType}_${JSON.stringify(params)}_${count}`]
622622
}
623623

624624
const url = `http://api.tianapi.com/${apiType}/index`
@@ -629,7 +629,7 @@ export const buildTianApi = async (apiType, params = null) => {
629629
if (res && res.data && res.data.code === 200) {
630630
const result = (res.data.newslist || []).slice(0, count)
631631

632-
RUN_TIME_STORAGE[`${apiType}_${count}`] = cloneDeep(result)
632+
RUN_TIME_STORAGE[`${apiType}_${JSON.stringify(params)}_${count}`] = cloneDeep(result)
633633

634634
return result
635635
}

0 commit comments

Comments
 (0)