修复:全局治理雪花ID精度问题
This commit is contained in:
@@ -138,17 +138,18 @@ import { productApi, type ProductVO } from '../api/product'
|
||||
import { shopApi, type ShopVO } from '../api/shop'
|
||||
import { fileApi } from '../api/file'
|
||||
import { DEFAULT_AVATAR, DEFAULT_PRODUCT_IMAGE } from '@/constants'
|
||||
import type { IdType } from '@/utils/id'
|
||||
|
||||
interface BannerImage {
|
||||
id: string
|
||||
shopId: number
|
||||
shopId: IdType
|
||||
shopName: string
|
||||
businessHours?: string
|
||||
url: string
|
||||
}
|
||||
|
||||
interface ProductCardItem {
|
||||
id: number
|
||||
id: IdType
|
||||
name: string
|
||||
price: string
|
||||
meta: string
|
||||
@@ -187,7 +188,7 @@ const getProductCoverUrl = async (product: ProductVO): Promise<string> => {
|
||||
}
|
||||
if (!productImageCache.value[firstImageId]) {
|
||||
try {
|
||||
productImageCache.value[firstImageId] = await fileApi.getSignedUrl(Number(firstImageId)) as unknown as string
|
||||
productImageCache.value[firstImageId] = await fileApi.getSignedUrl(firstImageId) as unknown as string
|
||||
} catch (error) {
|
||||
console.error('获取首页作品封面失败:', error)
|
||||
productImageCache.value[firstImageId] = DEFAULT_PRODUCT_IMAGE
|
||||
@@ -250,11 +251,11 @@ const loadBannerImages = async () => {
|
||||
.filter(Boolean)
|
||||
for (const id of coverIds) {
|
||||
try {
|
||||
const url = await fileApi.getSignedUrl(Number(id)) as unknown as string
|
||||
const url = await fileApi.getSignedUrl(id) as unknown as string
|
||||
if (url) {
|
||||
banners.push({
|
||||
id: `${shop.id}-${id}`,
|
||||
shopId: Number(shop.id),
|
||||
shopId: shop.id,
|
||||
shopName: shop.shopName,
|
||||
businessHours: shop.businessHours,
|
||||
url
|
||||
@@ -339,7 +340,7 @@ const handleProductClick = (item: ProductCardItem) => {
|
||||
router.push(`/product/${item.id}`)
|
||||
}
|
||||
|
||||
const openShopById = (shopId: number) => {
|
||||
const openShopById = (shopId: IdType) => {
|
||||
router.push(`/shop/${shopId}`)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user