fix(listings): 首页卡片统一接入 AuthImage 解决私有对象存储鉴权加载失败问题
This commit is contained in:
@@ -416,10 +416,22 @@ export function isTopTierInsurance(value: string | undefined | null): boolean {
|
||||
export function getCoinScreenshotURL(item: Listing): string {
|
||||
const groups = item.asset_summary?.screenshot_groups
|
||||
if (typeof groups === 'object' && groups !== null) {
|
||||
const coinUrls = (groups as Record<string, unknown>)['coin']
|
||||
if (Array.isArray(coinUrls)) {
|
||||
const firstCoin = coinUrls.find(url => typeof url === 'string' && Boolean(url))
|
||||
if (firstCoin) return firstCoin
|
||||
const groupRecord = groups as Record<string, unknown>
|
||||
const orderedKeys = ['coin', 'tencentSecurity', 'skin', 'gameId', 'totalAsset']
|
||||
for (const key of orderedKeys) {
|
||||
const urls = groupRecord[key]
|
||||
if (Array.isArray(urls)) {
|
||||
const found = urls.find(url => typeof url === 'string' && Boolean(url))
|
||||
if (found) return found
|
||||
}
|
||||
}
|
||||
for (const key of Object.keys(groupRecord)) {
|
||||
if (orderedKeys.includes(key)) continue
|
||||
const urls = groupRecord[key]
|
||||
if (Array.isArray(urls)) {
|
||||
const found = urls.find(url => typeof url === 'string' && Boolean(url))
|
||||
if (found) return found
|
||||
}
|
||||
}
|
||||
}
|
||||
return item.cover_url || item.screenshot_urls?.[0] || ''
|
||||
|
||||
Reference in New Issue
Block a user