diff --git a/JC-Salon-Core/src/main/java/com/xiaowang/jayucloud/salon/core/modules/artist/service/impl/NailArtistInfoServiceImpl.java b/JC-Salon-Core/src/main/java/com/xiaowang/jayucloud/salon/core/modules/artist/service/impl/NailArtistInfoServiceImpl.java index 995cdee2..6f136c9c 100644 --- a/JC-Salon-Core/src/main/java/com/xiaowang/jayucloud/salon/core/modules/artist/service/impl/NailArtistInfoServiceImpl.java +++ b/JC-Salon-Core/src/main/java/com/xiaowang/jayucloud/salon/core/modules/artist/service/impl/NailArtistInfoServiceImpl.java @@ -700,7 +700,7 @@ public class NailArtistInfoServiceImpl extends ServiceImpl= 0) { return uri.getPort(); diff --git a/JC-Salon-Core/src/main/java/com/xiaowang/jayucloud/salon/core/modules/planning/service/impl/PlanningServiceImpl.java b/JC-Salon-Core/src/main/java/com/xiaowang/jayucloud/salon/core/modules/planning/service/impl/PlanningServiceImpl.java index 5b1e77f6..616abf90 100644 --- a/JC-Salon-Core/src/main/java/com/xiaowang/jayucloud/salon/core/modules/planning/service/impl/PlanningServiceImpl.java +++ b/JC-Salon-Core/src/main/java/com/xiaowang/jayucloud/salon/core/modules/planning/service/impl/PlanningServiceImpl.java @@ -30,6 +30,7 @@ import com.xiaowang.jayucloud.salon.core.modules.order.service.OrderService; import com.xiaowang.jayucloud.salon.core.modules.planning.service.PlanningService; import com.xiaowang.jayucloud.salon.core.modules.security.support.AdminScopeHelper; import com.xiaowang.jayucloud.salon.core.modules.order.support.OrderStatus; +import com.xiaowang.jayucloud.salon.core.modules.file.support.ObjectStorageUrlSupport; import com.xiaowang.jayucloud.salon.core.modules.planning.support.PlanningCalendarSupport; import com.xiaowang.jayucloud.salon.core.modules.planning.support.PlanningTodayOverviewSupport; import com.xiaowang.jayucloud.salon.core.support.id.TimeOrderedSnowflakeIdGenerator; @@ -96,6 +97,7 @@ public class PlanningServiceImpl implements PlanningService { private final AppointmentCapacityService appointmentCapacityService; private final OrderService orderService; private final TimeOrderedSnowflakeIdGenerator snowflakeIdGenerator; + private final ObjectStorageUrlSupport objectStorageUrlSupport; @Override public PlanningCalendarVO getCalendar(UserDO currentUser, LocalDate startDate, LocalDate endDate, Long artistId) { @@ -425,7 +427,7 @@ public class PlanningServiceImpl implements PlanningService { vo.setName(firstNonBlank(user.getNickname(), user.getAccount(), "美甲师" + (i + 1))); vo.setShortName(PlanningCalendarSupport.shortName(vo.getName())); vo.setPhone(firstNonBlank(user.getContactPhone(), user.getPhone(), "")); - vo.setAvatar(user.getAvatar()); + vo.setAvatar(objectStorageUrlSupport.toAccessibleUrl(user.getAvatar())); vo.setColor(info != null && StringUtils.hasText(info.getColor()) ? info.getColor() : colorForArtist(user.getId(), i)); vo.setStatus(info == null || info.getStatus() == null ? user.getStatus() : info.getStatus()); diff --git a/JC-Salon-Core/src/main/java/com/xiaowang/jayucloud/salon/core/modules/registration/service/impl/WorkbenchRegistrationServiceImpl.java b/JC-Salon-Core/src/main/java/com/xiaowang/jayucloud/salon/core/modules/registration/service/impl/WorkbenchRegistrationServiceImpl.java index 57ec282d..87b7e038 100644 --- a/JC-Salon-Core/src/main/java/com/xiaowang/jayucloud/salon/core/modules/registration/service/impl/WorkbenchRegistrationServiceImpl.java +++ b/JC-Salon-Core/src/main/java/com/xiaowang/jayucloud/salon/core/modules/registration/service/impl/WorkbenchRegistrationServiceImpl.java @@ -31,6 +31,7 @@ import com.xiaowang.jayucloud.salon.core.modules.user.mapper.UserMapper; import com.xiaowang.jayucloud.salon.core.modules.user.service.UserService; import com.xiaowang.jayucloud.salon.core.modules.system.service.SystemParameterConfigService; import com.xiaowang.jayucloud.salon.core.modules.file.service.ObjectStorageFileService; +import com.xiaowang.jayucloud.salon.core.modules.file.support.ObjectStorageUrlSupport; import com.xiaowang.jayucloud.salon.core.modules.file.vo.ObjectStorageFileVO; import org.springframework.beans.BeanUtils; import org.springframework.stereotype.Service; @@ -64,6 +65,7 @@ public class WorkbenchRegistrationServiceImpl implements WorkbenchRegistrationSe private final TransactionTemplate transactionTemplate; private final WechatMiniBindingMapper wechatMiniBindingMapper; private final ObjectStorageFileService objectStorageFileService; + private final ObjectStorageUrlSupport objectStorageUrlSupport; public WorkbenchRegistrationServiceImpl( WorkbenchRegistrationApplicationMapper applicationMapper, @@ -79,7 +81,8 @@ public class WorkbenchRegistrationServiceImpl implements WorkbenchRegistrationSe ShopBusinessExpiryService shopBusinessExpiryService, PlatformTransactionManager transactionManager, WechatMiniBindingMapper wechatMiniBindingMapper, - ObjectStorageFileService objectStorageFileService + ObjectStorageFileService objectStorageFileService, + ObjectStorageUrlSupport objectStorageUrlSupport ) { this.applicationMapper = applicationMapper; this.userMapper = userMapper; @@ -95,6 +98,7 @@ public class WorkbenchRegistrationServiceImpl implements WorkbenchRegistrationSe this.transactionTemplate = new TransactionTemplate(transactionManager); this.wechatMiniBindingMapper = wechatMiniBindingMapper; this.objectStorageFileService = objectStorageFileService; + this.objectStorageUrlSupport = objectStorageUrlSupport; } @Override @@ -324,7 +328,8 @@ public class WorkbenchRegistrationServiceImpl implements WorkbenchRegistrationSe if (request != null && Boolean.TRUE.equals(request.getUseApplicantAvatar()) && application.getApplicantAvatarFileId() != null) { requireApplicantProfileApproved(application); ObjectStorageFileVO file = contentModerationFile(application.getApplicantAvatarFileId()); - target.setAvatar(file.getFileUrl()); + target.setAvatar(objectStorageUrlSupport.toStoredUrl(StringUtils.hasText(file.getObjectName()) + ? file.getObjectName() : file.getFileUrl())); } target.setStatus(1); userMapper.updateById(target); @@ -367,7 +372,8 @@ public class WorkbenchRegistrationServiceImpl implements WorkbenchRegistrationSe return users.stream() .filter(user -> !hasActiveWechatBinding(user.getId())) .filter(user -> !hasPendingAssociation(user.getId(), applicationId)) - .map(user -> new WorkbenchRegistrationArtistVO(user.getId(), user.getNickname(), user.getAvatar())) + .map(user -> new WorkbenchRegistrationArtistVO(user.getId(), user.getNickname(), + objectStorageUrlSupport.toAccessibleUrl(user.getAvatar()))) .collect(Collectors.toList()); } diff --git a/JC-Salon-Core/src/test/java/com/xiaowang/jayucloud/salon/core/modules/file/support/ObjectStorageUrlSupportTest.java b/JC-Salon-Core/src/test/java/com/xiaowang/jayucloud/salon/core/modules/file/support/ObjectStorageUrlSupportTest.java new file mode 100644 index 00000000..d28d07b5 --- /dev/null +++ b/JC-Salon-Core/src/test/java/com/xiaowang/jayucloud/salon/core/modules/file/support/ObjectStorageUrlSupportTest.java @@ -0,0 +1,61 @@ +package com.xiaowang.jayucloud.salon.core.modules.file.support; + +import com.xiaowang.jayucloud.salon.core.config.ObjectStorageProperties; +import com.xiaowang.jayucloud.salon.core.modules.file.config.AliyunOssConfig; +import com.xiaowang.jayucloud.salon.core.modules.file.config.MinioStorageConfig; +import com.xiaowang.jayucloud.salon.core.modules.file.config.QiniuKodoConfig; +import com.xiaowang.jayucloud.salon.core.modules.file.service.AliyunOssService; +import com.xiaowang.jayucloud.salon.core.modules.file.service.ObjectStorageOrchestrationService; +import com.xiaowang.jayucloud.salon.core.modules.file.service.PrimaryObjectStorageService; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNull; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.when; + +class ObjectStorageUrlSupportTest { + + private ObjectStorageUrlSupport support; + private ObjectStorageOrchestrationService orchestrationService; + + @BeforeEach + void setUp() { + MinioStorageConfig minio = new MinioStorageConfig(); + minio.setEndpoint("http://192.168.10.14:9000"); + minio.setPublicEndpoint("https://sit.minio.yunail.art"); + minio.setBucketName("jayucloud-salon-sit"); + AliyunOssConfig aliyun = new AliyunOssConfig(); + aliyun.setEndpoint("https://oss-cn-hangzhou.aliyuncs.com"); + aliyun.setBucketName("salon"); + QiniuKodoConfig qiniu = new QiniuKodoConfig(); + qiniu.setDomain("https://sit.qiniu.yunail.art"); + ObjectStorageProperties properties = new ObjectStorageProperties(); + properties.setSignedUrlExpireMinutes(60); + orchestrationService = mock(ObjectStorageOrchestrationService.class); + support = new ObjectStorageUrlSupport(mock(PrimaryObjectStorageService.class), minio, aliyun, + qiniu, mock(AliyunOssService.class), properties, orchestrationService); + } + + @Test + void extractsObjectNameFromMinioInternalAndPublicUrls() { + assertEquals("avatar/7/photo.jpg", support.extractObjectName( + "http://192.168.10.14:9000/jayucloud-salon-sit/avatar/7/photo.jpg")); + assertEquals("avatar/7/photo.jpg", support.extractObjectName( + "https://sit.minio.yunail.art/jayucloud-salon-sit/avatar/7/photo.jpg?X-Amz-Signature=test")); + } + + @Test + void keepsQiniuAndOssReferencesSupported() { + assertEquals("avatar/7/photo.jpg", support.extractObjectName("https://sit.qiniu.yunail.art/avatar/7/photo.jpg")); + assertEquals("avatar/7/photo.jpg", support.extractObjectName("oss://salon/avatar/7/photo.jpg")); + } + + @Test + void doesNotReturnKnownPrivateUrlWhenSigningFails() { + when(orchestrationService.getPresignedUrl("avatar/7/photo.jpg", 60)) + .thenThrow(new IllegalStateException("storage unavailable")); + assertNull(support.toAccessibleUrl("https://sit.minio.yunail.art/jayucloud-salon-sit/avatar/7/photo.jpg")); + } +} diff --git a/JC-Salon-Core/src/test/java/com/xiaowang/jayucloud/salon/core/modules/planning/service/impl/PlanningServiceImplTest.java b/JC-Salon-Core/src/test/java/com/xiaowang/jayucloud/salon/core/modules/planning/service/impl/PlanningServiceImplTest.java index 1122e8f5..554e5e1d 100644 --- a/JC-Salon-Core/src/test/java/com/xiaowang/jayucloud/salon/core/modules/planning/service/impl/PlanningServiceImplTest.java +++ b/JC-Salon-Core/src/test/java/com/xiaowang/jayucloud/salon/core/modules/planning/service/impl/PlanningServiceImplTest.java @@ -15,6 +15,7 @@ import com.xiaowang.jayucloud.salon.core.modules.planning.dto.PlanningAppointmen import com.xiaowang.jayucloud.salon.core.modules.planning.dto.PlanningBackfillOrderCreateDTO; import com.xiaowang.jayucloud.salon.core.modules.planning.mapper.AppointmentReservationMapper; import com.xiaowang.jayucloud.salon.core.modules.planning.service.AppointmentCapacityService; +import com.xiaowang.jayucloud.salon.core.modules.file.support.ObjectStorageUrlSupport; import com.xiaowang.jayucloud.salon.core.modules.product.mapper.ProductMapper; import com.xiaowang.jayucloud.salon.core.modules.product.entity.ProductDO; import com.xiaowang.jayucloud.salon.core.modules.security.support.AdminScopeHelper; @@ -61,6 +62,7 @@ class PlanningServiceImplTest { @Mock private AppointmentCapacityService appointmentCapacityService; @Mock private OrderService orderService; @Mock private TimeOrderedSnowflakeIdGenerator snowflakeIdGenerator; + @Mock private ObjectStorageUrlSupport objectStorageUrlSupport; private PlanningServiceImpl service; @@ -68,7 +70,8 @@ class PlanningServiceImplTest { void setUp() { service = new PlanningServiceImpl(adminScopeHelper, userMapper, userService, nailArtistInfoMapper, artistScheduleMapper, artistScheduleExceptionMapper, appointmentReservationMapper, orderMapper, orderItemMapper, - productMapper, shopMapper, shopBusinessExpiryService, appointmentCapacityService, orderService, snowflakeIdGenerator); + productMapper, shopMapper, shopBusinessExpiryService, appointmentCapacityService, orderService, snowflakeIdGenerator, + objectStorageUrlSupport); } @Test diff --git a/JC-Salon-Core/src/test/java/com/xiaowang/jayucloud/salon/core/modules/registration/service/impl/WorkbenchRegistrationServiceImplTest.java b/JC-Salon-Core/src/test/java/com/xiaowang/jayucloud/salon/core/modules/registration/service/impl/WorkbenchRegistrationServiceImplTest.java index 7d162e2f..616bf0f7 100644 --- a/JC-Salon-Core/src/test/java/com/xiaowang/jayucloud/salon/core/modules/registration/service/impl/WorkbenchRegistrationServiceImplTest.java +++ b/JC-Salon-Core/src/test/java/com/xiaowang/jayucloud/salon/core/modules/registration/service/impl/WorkbenchRegistrationServiceImplTest.java @@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.conditions.Wrapper; import com.xiaowang.jayucloud.salon.core.modules.integration.service.WechatMiniAuthService; import com.xiaowang.jayucloud.salon.core.modules.integration.mapper.WechatMiniBindingMapper; import com.xiaowang.jayucloud.salon.core.modules.file.service.ObjectStorageFileService; +import com.xiaowang.jayucloud.salon.core.modules.file.support.ObjectStorageUrlSupport; import com.xiaowang.jayucloud.salon.core.modules.privacy.moderation.LocalMockContentModerationProvider; import com.xiaowang.jayucloud.salon.core.modules.privacy.moderation.ModerationOutcome; import com.xiaowang.jayucloud.salon.core.modules.privacy.entity.ContentModerationRecordDO; @@ -57,6 +58,7 @@ class WorkbenchRegistrationServiceImplTest { @Mock private PlatformTransactionManager transactionManager; @Mock private WechatMiniBindingMapper wechatMiniBindingMapper; @Mock private ObjectStorageFileService objectStorageFileService; + @Mock private ObjectStorageUrlSupport objectStorageUrlSupport; private WorkbenchRegistrationServiceImpl service; @@ -65,7 +67,7 @@ class WorkbenchRegistrationServiceImplTest { service = new WorkbenchRegistrationServiceImpl(applicationMapper, userMapper, shopMapper, userService, userShopBindingSupport, userShopBindingMapper, wechatMiniAuthService, systemParameterConfigService, contentModerationService, contentModerationRecordMapper, shopBusinessExpiryService, transactionManager, - wechatMiniBindingMapper, objectStorageFileService); + wechatMiniBindingMapper, objectStorageFileService, objectStorageUrlSupport); } @Test diff --git a/JC-Salon-WeChat/components/entity-selector-sheet/index.js b/JC-Salon-WeChat/components/entity-selector-sheet/index.js index 943ae555..29d533cf 100644 --- a/JC-Salon-WeChat/components/entity-selector-sheet/index.js +++ b/JC-Salon-WeChat/components/entity-selector-sheet/index.js @@ -33,6 +33,12 @@ Component({ if (item) this.triggerEvent('select', { item }) }, + onAvatarError(event) { + const index = Number(event.currentTarget.dataset.index) + if (!Number.isInteger(index) || !this.data.items[index]) return + this.setData({ [`items[${index}].avatar`]: '' }) + }, + retry() { this.triggerEvent('retry') }, diff --git a/JC-Salon-WeChat/components/entity-selector-sheet/index.wxml b/JC-Salon-WeChat/components/entity-selector-sheet/index.wxml index cdba0c65..28903c9b 100644 --- a/JC-Salon-WeChat/components/entity-selector-sheet/index.wxml +++ b/JC-Salon-WeChat/components/entity-selector-sheet/index.wxml @@ -30,7 +30,7 @@ {{emptyText}} - + {{item.title}} diff --git a/JC-Salon-WeChat/components/product-selector-sheet/index.js b/JC-Salon-WeChat/components/product-selector-sheet/index.js index c9e9d6e3..d3a2e47c 100644 --- a/JC-Salon-WeChat/components/product-selector-sheet/index.js +++ b/JC-Salon-WeChat/components/product-selector-sheet/index.js @@ -25,6 +25,14 @@ Component({ const item = this.data.items[Number(event.currentTarget.dataset.index)] if (item) this.triggerEvent('select', { item }) }, + onCoverImageError(event) { + const index = Number(event.currentTarget.dataset.index) + if (!Number.isInteger(index) || !this.data.items[index]) return + this.setData({ [`items[${index}].coverImage`]: '' }) + }, + onManualImageError() { + this.setData({ manualImageUrl: '' }) + }, openManual() { this.triggerEvent('openmanual') }, backToList() { this.triggerEvent('backtolist') }, onManualInput(event) { diff --git a/JC-Salon-WeChat/components/product-selector-sheet/index.wxml b/JC-Salon-WeChat/components/product-selector-sheet/index.wxml index 6e7abc60..7c11f39b 100644 --- a/JC-Salon-WeChat/components/product-selector-sheet/index.wxml +++ b/JC-Salon-WeChat/components/product-selector-sheet/index.wxml @@ -12,7 +12,7 @@ {{emptyText}} - 图 + 图 {{item.title}}{{item.priceText || (item.price == null ? '价格待定' : '¥' + item.price)}}{{item.durationText || '时长待定'}} · {{item.artistText || '全部美甲师'}}{{tag}}{{selectedId == item.id ? '✓' : '›'}} @@ -22,7 +22,7 @@ {{manualMoreExpanded ? '⌃ 收起更多信息' : '⌄ 补充更多信息'}} - 图 + 图 diff --git a/JC-Salon-WeChat/pages/appointment-form/index.js b/JC-Salon-WeChat/pages/appointment-form/index.js index 5fcff649..b778560e 100644 --- a/JC-Salon-WeChat/pages/appointment-form/index.js +++ b/JC-Salon-WeChat/pages/appointment-form/index.js @@ -2065,6 +2065,10 @@ Page({ this.persistDraft(true) }, + onSelectedProductImageError() { + this.setData({ 'selectedProduct.coverImage': '' }) + }, + back() { wx.navigateBack() } diff --git a/JC-Salon-WeChat/pages/appointment-form/index.wxml b/JC-Salon-WeChat/pages/appointment-form/index.wxml index f11e7683..afedb8a1 100644 --- a/JC-Salon-WeChat/pages/appointment-form/index.wxml +++ b/JC-Salon-WeChat/pages/appointment-form/index.wxml @@ -27,7 +27,7 @@ › - + ✦ {{selectedProduct.title}}参考价 {{selectedProductPriceText || '待定'}} · 本次 {{form.amount || '待填'}} 元 · {{form.durationMinutes || '60'}} 分钟 diff --git a/JC-Salon-WeChat/pages/backfill-order/index.js b/JC-Salon-WeChat/pages/backfill-order/index.js index 5fb06490..665c051d 100644 --- a/JC-Salon-WeChat/pages/backfill-order/index.js +++ b/JC-Salon-WeChat/pages/backfill-order/index.js @@ -121,6 +121,7 @@ Page({ async chooseManualProductImage() { if (this.data.manualImageUploading) return; const remaining = 9 - (this.data.form.manualProductImages || []).length; if (remaining <= 0) { wx.showToast({ title: '最多添加9张图片', icon: 'none' }); return } try { this.setData({ manualImageUploading: true }); const paths = await chooseImages(remaining); for (const filePath of paths) { const result = await uploadObjectFile(filePath); const fileId = result.id || result.fileId; if (!fileId) throw new Error('图片上传成功但未返回文件ID'); this.setData(imagePatch((this.data.form.manualProductImages || []).concat({ fileId: String(fileId), fileUrl: result.fileUrl || result.primaryUrl || '', previewUrl: filePath }))) } } catch (error) { wx.showToast({ title: error.message || '图片上传失败', icon: 'none' }) } finally { this.setData({ manualImageUploading: false }) } }, removeManualProductImage(event) { const index = Number(event.currentTarget.dataset.index); this.setData(imagePatch((this.data.form.manualProductImages || []).filter((item, itemIndex) => itemIndex !== index))) }, onManualProductImageError(event) { const index = Number(event.currentTarget.dataset.index); const images = this.data.form.manualProductImages || []; if (!images[index] || !images[index].fileUrl) return; const fallback = images.slice(); fallback[index] = { ...fallback[index], previewUrl: fallback[index].fileUrl }; this.setData(imagePatch(fallback)) }, + onSelectedProductImageError() { this.setData({ 'selectedProduct.coverImage': '' }) }, onInput(event) { const field = event.currentTarget.dataset.field; const value = event.detail.value; this.setData({ [`form.${field}`]: value, ...(field === 'amount' ? { 'manualProductDraft.price': value } : {}) }) }, onDateChange(event) { this.setData({ 'form.serviceDate': event.detail.value }) }, onTimeChange(event) { this.setData({ 'form.serviceTime': event.detail.value }) }, diff --git a/JC-Salon-WeChat/pages/backfill-order/index.wxml b/JC-Salon-WeChat/pages/backfill-order/index.wxml index 05080ead..4cf35371 100644 --- a/JC-Salon-WeChat/pages/backfill-order/index.wxml +++ b/JC-Salon-WeChat/pages/backfill-order/index.wxml @@ -25,7 +25,7 @@ › - + ✦ {{selectedProduct.title}}参考价 {{selectedProductPriceText || '待定'}} · 本次 {{form.amount || '待填'}} 元 · {{form.durationMinutes || '60'}} 分钟 diff --git a/JC-Salon-WeChat/pages/employee-create/index.js b/JC-Salon-WeChat/pages/employee-create/index.js index dba2f3a7..0a95d798 100644 --- a/JC-Salon-WeChat/pages/employee-create/index.js +++ b/JC-Salon-WeChat/pages/employee-create/index.js @@ -56,10 +56,11 @@ Page({ if (!filePath) return this.setData({ avatarUploading: true }) const uploadResult = await uploadObjectFile(filePath) - const avatarUrl = uploadResult.fileUrl || uploadResult.primaryUrl || filePath + // 私有对象存储地址可能无法被小程序直接访问,上传完成后先用本地临时文件即时预览。 + const storedAvatar = uploadResult.fileUrl || uploadResult.primaryUrl || '' this.setData({ - 'form.avatar': avatarUrl, - 'form.avatarUrl': avatarUrl + 'form.avatar': storedAvatar, + 'form.avatarUrl': filePath }) } catch (error) { wx.showToast({ title: error.message || '头像上传失败', icon: 'none' }) @@ -72,6 +73,10 @@ Page({ this.setData({ 'form.avatar': '', 'form.avatarUrl': '' }) }, + onAvatarError() { + this.setData({ 'form.avatarUrl': '' }) + }, + stopTouchMove() { }, diff --git a/JC-Salon-WeChat/pages/employee-create/index.wxml b/JC-Salon-WeChat/pages/employee-create/index.wxml index ba8f37fb..5d1c7de6 100644 --- a/JC-Salon-WeChat/pages/employee-create/index.wxml +++ b/JC-Salon-WeChat/pages/employee-create/index.wxml @@ -5,7 +5,7 @@ - + 美甲师头像 diff --git a/JC-Salon-WeChat/pages/employee-detail/index.js b/JC-Salon-WeChat/pages/employee-detail/index.js index 62831a66..aafcebdd 100644 --- a/JC-Salon-WeChat/pages/employee-detail/index.js +++ b/JC-Salon-WeChat/pages/employee-detail/index.js @@ -44,6 +44,10 @@ Page({ wx.navigateTo({ url: `${event.currentTarget.dataset.url}?id=${this.data.id}` }) }, + onAvatarError() { + this.setData({ 'employee.avatar': '' }) + }, + back() { wx.navigateBack() } diff --git a/JC-Salon-WeChat/pages/employee-detail/index.wxml b/JC-Salon-WeChat/pages/employee-detail/index.wxml index be9a8833..b4e82f9f 100644 --- a/JC-Salon-WeChat/pages/employee-detail/index.wxml +++ b/JC-Salon-WeChat/pages/employee-detail/index.wxml @@ -5,7 +5,8 @@ - {{employee.shortName}} + + {{employee.shortName}} {{employee.name}} 美甲师色 diff --git a/JC-Salon-WeChat/pages/employee-detail/index.wxss b/JC-Salon-WeChat/pages/employee-detail/index.wxss index 2212bace..6ed875b3 100644 --- a/JC-Salon-WeChat/pages/employee-detail/index.wxss +++ b/JC-Salon-WeChat/pages/employee-detail/index.wxss @@ -26,6 +26,12 @@ color: #fff; font-size: 34rpx; font-weight: 900; + overflow: hidden; +} + +.image-avatar image { + width: 100%; + height: 100%; } .employee-name { diff --git a/JC-Salon-WeChat/pages/employees/index.js b/JC-Salon-WeChat/pages/employees/index.js index ac3ec785..2136f665 100644 --- a/JC-Salon-WeChat/pages/employees/index.js +++ b/JC-Salon-WeChat/pages/employees/index.js @@ -291,6 +291,18 @@ Page({ } }, + onEmployeeAvatarError(event) { + const index = Number(event.currentTarget.dataset.index) + if (!Number.isInteger(index) || !this.data.employees[index]) return + this.setData({ [`employees[${index}].avatar`]: '' }) + }, + + onReviewAvatarError(event) { + const index = Number(event.currentTarget.dataset.index) + if (!Number.isInteger(index) || !this.data.reviewApplications[index]) return + this.setData({ [`reviewApplications[${index}].applicantAvatar`]: '' }) + }, + openDetail(event) { wx.navigateTo({ url: `/pages/employee-detail/index?id=${event.currentTarget.dataset.id}` }) }, diff --git a/JC-Salon-WeChat/pages/employees/index.wxml b/JC-Salon-WeChat/pages/employees/index.wxml index a62372c8..30caa0f9 100644 --- a/JC-Salon-WeChat/pages/employees/index.wxml +++ b/JC-Salon-WeChat/pages/employees/index.wxml @@ -20,7 +20,7 @@ 暂无待审核美甲师申请 - + {{item.applicantDisplayName}} 已预关联美甲师 @@ -45,7 +45,7 @@ - + {{item.shortName}} diff --git a/JC-Salon-WeChat/pages/planning/index.js b/JC-Salon-WeChat/pages/planning/index.js index 2161f3ad..8a23f9c4 100644 --- a/JC-Salon-WeChat/pages/planning/index.js +++ b/JC-Salon-WeChat/pages/planning/index.js @@ -331,6 +331,10 @@ Page({ this.loadCalendar() }, + onProfileAvatarError() { + this.setData({ 'profileForm.avatar': '' }) + }, + selectWeekDate(event) { const appointmentDate = dateUtil.formatDate(event.currentTarget.dataset.date) const target = toLocalDate(appointmentDate) diff --git a/JC-Salon-WeChat/pages/planning/index.wxml b/JC-Salon-WeChat/pages/planning/index.wxml index 3c9c03fb..0dde0bb6 100644 --- a/JC-Salon-WeChat/pages/planning/index.wxml +++ b/JC-Salon-WeChat/pages/planning/index.wxml @@ -44,7 +44,7 @@ 完善你的工作名片头像和昵称会用于门店协作展示,可暂时跳过。 diff --git a/JC-Salon-WeChat/pages/profile-edit/index.js b/JC-Salon-WeChat/pages/profile-edit/index.js index 976999dd..5e6f0138 100644 --- a/JC-Salon-WeChat/pages/profile-edit/index.js +++ b/JC-Salon-WeChat/pages/profile-edit/index.js @@ -139,6 +139,10 @@ Page({ } }, + onAvatarImageError() { + this.setData({ 'form.avatar': '' }) + }, + async chooseWechatAvatar(event) { if (this.data.loading || this.data.avatarUploading || this.data.saving) return try { diff --git a/JC-Salon-WeChat/pages/profile-edit/index.wxml b/JC-Salon-WeChat/pages/profile-edit/index.wxml index 9313a9aa..487202de 100644 --- a/JC-Salon-WeChat/pages/profile-edit/index.wxml +++ b/JC-Salon-WeChat/pages/profile-edit/index.wxml @@ -3,7 +3,7 @@ - + {{avatarText}} {{avatarUploading ? '上传中' : '点击更换'}} diff --git a/JC-Salon-WeChat/pages/profile/index.js b/JC-Salon-WeChat/pages/profile/index.js index 89de49de..25f793b7 100644 --- a/JC-Salon-WeChat/pages/profile/index.js +++ b/JC-Salon-WeChat/pages/profile/index.js @@ -90,6 +90,10 @@ Page({ wx.navigateTo({ url: event.currentTarget.dataset.url }) }, + onProfileAvatarError() { + this.setData({ 'profileCard.avatar': '' }) + }, + async loadProfile() { try { const profile = await profileCache.getProfile() diff --git a/JC-Salon-WeChat/pages/profile/index.wxml b/JC-Salon-WeChat/pages/profile/index.wxml index 589376b8..e1ef8abf 100644 --- a/JC-Salon-WeChat/pages/profile/index.wxml +++ b/JC-Salon-WeChat/pages/profile/index.wxml @@ -2,7 +2,7 @@ diff --git a/docs/项目变更记录.md b/docs/项目变更记录.md index d6a5e8b6..8582cd82 100644 --- a/docs/项目变更记录.md +++ b/docs/项目变更记录.md @@ -1,5 +1,14 @@ # 项目变更记录 +## 2026-11-01 Salon 对象存储头像与文件展示修复 + +- 修复 DEV/SIT 使用 MinIO 时,数据库中的内网或公共 MinIO 地址无法解析对象名,导致头像、作品和其他文件不能生成可访问签名地址的问题;统一支持 MinIO 内网端点、MinIO 公共端点、七牛域名和 OSS 引用。 +- 已识别的私有对象存储地址在签名失败时不再原样返回,避免小程序拿到不可访问或不应公开的内网地址;外部默认头像仍保持兼容。 +- 日程员工列表、注册审核候选美甲师统一使用可访问头像地址;审核采用申请头像时保存规范化存储地址,避免把临时/内网 URL 写入员工资料。 +- 小程序新增美甲师上传后优先使用本地临时文件预览;员工列表、员工详情、审核关联选择器、作品选择器、预约/补录款式图片和个人资料头像增加加载失败回退。 +- 新增 `JC-Salon-Core/src/test/java/com/xiaowang/jayucloud/salon/core/modules/file/support/ObjectStorageUrlSupportTest.java`,覆盖 MinIO 内外网 URL、七牛、OSS 解析及签名失败不泄露私有地址;该测试目录受仓库 `test/` 忽略规则影响,提交时需显式纳入。 +- Core 对象存储、日程、注册关联相关测试 29 项通过;小程序相关测试及 JavaScript 语法检查通过。 + ## 2026-10-30 Salon 安全接入配置服务启动循环修复 - 安全接入配置服务不再依赖 `AdminScopeHelper` / `UserServiceImpl`,改为在服务边界校验调用方必须为平台管理员 `type = 4`,保留配置读取和写入的管理员门禁。