修复:全局治理雪花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
+15 -15
View File
@@ -326,8 +326,8 @@ const bannerPreviewImage = ref('')
const imageFileList = ref<any[]>([])
const uploadedFileIds = ref<string[]>([])
const imageIdCache = ref<Record<string, string>>({})
const shopImageUrls = ref<Record<number, string[]>>({})
const shopBannerUrls = ref<Record<number, string[]>>({})
const shopImageUrls = ref<Record<string, string[]>>({})
const shopBannerUrls = ref<Record<string, string[]>>({})
const viewImageUrls = ref<string[]>([])
const viewBannerUrls = ref<string[]>([])
const previewVisible = ref(false)
@@ -426,7 +426,7 @@ const loadImageUrls = async (shops: Shop[]) => {
try {
// 检查缓存
if (!imageIdCache.value[id]) {
const response = await adminFileApi.getSignedUrl(Number(id || '0')) as any
const response = await adminFileApi.getSignedUrl(id.trim()) as any
imageIdCache.value[id] = response
}
urls.push(imageIdCache.value[id]!)
@@ -438,11 +438,11 @@ const loadImageUrls = async (shops: Shop[]) => {
}
if (shop.id !== undefined) {
shopImageUrls.value[shop.id] = urls
shopImageUrls.value[String(shop.id)] = urls
}
} else {
if (shop.id !== undefined) {
shopImageUrls.value[shop.id] = []
shopImageUrls.value[String(shop.id)] = []
}
}
@@ -456,7 +456,7 @@ const loadImageUrls = async (shops: Shop[]) => {
try {
// 检查缓存
if (!imageIdCache.value[id]) {
const response = await adminFileApi.getSignedUrl(Number(id || '0')) as any
const response = await adminFileApi.getSignedUrl(id.trim()) as any
imageIdCache.value[id] = response
}
urls.push(imageIdCache.value[id]!)
@@ -468,11 +468,11 @@ const loadImageUrls = async (shops: Shop[]) => {
}
if (shop.id !== undefined) {
shopBannerUrls.value[shop.id] = urls
shopBannerUrls.value[String(shop.id)] = urls
}
} else {
if (shop.id !== undefined) {
shopBannerUrls.value[shop.id] = []
shopBannerUrls.value[String(shop.id)] = []
}
}
}
@@ -481,7 +481,7 @@ const loadImageUrls = async (shops: Shop[]) => {
const getShopImages = (shop: Shop | Record<string, any>): string[] => {
const shopId = 'id' in shop ? shop.id : (shop as any).id
if (shopId !== undefined) {
return shopImageUrls.value[shopId] || []
return shopImageUrls.value[String(shopId)] || []
}
return []
}
@@ -489,7 +489,7 @@ const getShopImages = (shop: Shop | Record<string, any>): string[] => {
const getShopBannerImages = (shop: Shop | Record<string, any>): string[] => {
const shopId = 'id' in shop ? shop.id : (shop as any).id
if (shopId !== undefined) {
return shopBannerUrls.value[shopId] || []
return shopBannerUrls.value[String(shopId)] || []
}
return []
}
@@ -600,7 +600,7 @@ const handleBannerPreview = async (file: any) => {
}
if (!imageIdCache.value[fileId]) {
const response = await adminFileApi.getSignedUrl(Number(fileId)) as any
const response = await adminFileApi.getSignedUrl(fileId) as any
imageIdCache.value[fileId] = response
}
bannerPreviewImage.value = imageIdCache.value[fileId] || ''
@@ -680,7 +680,7 @@ const handlePreview = async (file: any) => {
}
if (!imageIdCache.value[fileId]) {
const response = await adminFileApi.getSignedUrl(Number(fileId)) as any
const response = await adminFileApi.getSignedUrl(fileId) as any
imageIdCache.value[fileId] = response
}
previewImage.value = imageIdCache.value[fileId] || ''
@@ -805,7 +805,7 @@ const showViewModal = async (record: Shop | Record<string, any>) => {
try {
// 检查缓存
if (!imageIdCache.value[id]) {
const response = await adminFileApi.getSignedUrl(Number(id || '0')) as any
const response = await adminFileApi.getSignedUrl(id.trim()) as any
imageIdCache.value[id] = response
}
urls.push(imageIdCache.value[id]!)
@@ -829,7 +829,7 @@ const showViewModal = async (record: Shop | Record<string, any>) => {
try {
// 检查缓存
if (!imageIdCache.value[id]) {
const response = await adminFileApi.getSignedUrl(Number(id || '0')) as any
const response = await adminFileApi.getSignedUrl(id.trim()) as any
imageIdCache.value[id] = response
}
urls.push(imageIdCache.value[id]!)
@@ -879,7 +879,7 @@ const buildShopUploadFileList = async (ids: string[], fileNamePrefix: string) =>
for (const [index, id] of ids.entries()) {
try {
if (!imageIdCache.value[id]) {
const response = await adminFileApi.getSignedUrl(Number(id || '0')) as any
const response = await adminFileApi.getSignedUrl(id.trim()) as any
imageIdCache.value[id] = response
}
fileList.push({