修复:全局治理雪花ID精度问题

This commit is contained in:
xiaowang
2026-03-27 14:55:41 +08:00
parent 824e35366a
commit d2b63e0c71
34 changed files with 459 additions and 255 deletions
+5 -5
View File
@@ -143,7 +143,7 @@ const loading = ref(false)
const showSearch = ref(false)
const searchKeyword = ref('')
const imageIdCache = ref<Record<string, string>>({})
const imageUrls = ref<Record<number, string[]>>({})
const imageUrls = ref<Record<string, string[]>>({})
const isLoggedIn = computed(() => Boolean(localStorage.getItem('accessToken') || sessionStorage.getItem('accessToken')))
const activeBannerText = computed(() => {
@@ -170,7 +170,7 @@ const ensureLoginForAction = (actionText: string) => {
const loadImageUrls = async (productList: ProductVO[]) => {
for (const product of productList) {
if (!product.imageFileIds) {
imageUrls.value[product.id] = [DEFAULT_PRODUCT_IMAGE]
imageUrls.value[String(product.id)] = [DEFAULT_PRODUCT_IMAGE]
continue
}
@@ -180,7 +180,7 @@ const loadImageUrls = async (productList: ProductVO[]) => {
for (const id of ids) {
try {
if (!imageIdCache.value[id]) {
imageIdCache.value[id] = await fileApi.getSignedUrl(Number(id)) as unknown as string
imageIdCache.value[id] = await fileApi.getSignedUrl(id) as unknown as string
}
if (imageIdCache.value[id]) {
urls.push(imageIdCache.value[id])
@@ -190,11 +190,11 @@ const loadImageUrls = async (productList: ProductVO[]) => {
}
}
imageUrls.value[product.id] = urls.length ? urls : [DEFAULT_PRODUCT_IMAGE]
imageUrls.value[String(product.id)] = urls.length ? urls : [DEFAULT_PRODUCT_IMAGE]
}
}
const getProductImages = (product: ProductVO): string[] => imageUrls.value[product.id] || [DEFAULT_PRODUCT_IMAGE]
const getProductImages = (product: ProductVO): string[] => imageUrls.value[String(product.id)] || [DEFAULT_PRODUCT_IMAGE]
const fetchTags = async () => {
try {