Dev #106
+22
-5
@@ -28,6 +28,12 @@ public class MinioStorageConfig {
|
||||
*/
|
||||
private String publicEndpoint;
|
||||
|
||||
/**
|
||||
* Optional MinIO region used when signing URLs. When blank, the region is resolved once
|
||||
* through the internal endpoint so that signing never depends on public DNS.
|
||||
*/
|
||||
private String region;
|
||||
|
||||
private String bucketName;
|
||||
|
||||
private String accessKey;
|
||||
@@ -43,22 +49,33 @@ public class MinioStorageConfig {
|
||||
return buildClient(endpoint);
|
||||
}
|
||||
|
||||
public MinioClient createSigningClient() {
|
||||
/**
|
||||
* Builds the client used to sign URLs. The region must be passed explicitly, otherwise the
|
||||
* MinIO SDK queries the endpoint for the bucket region before signing.
|
||||
*/
|
||||
public MinioClient createSigningClient(String signingRegion) {
|
||||
if (!Boolean.TRUE.equals(enabled) || !StringUtils.hasText(publicEndpoint)) {
|
||||
return null;
|
||||
}
|
||||
return buildClient(publicEndpoint);
|
||||
return buildClient(publicEndpoint, signingRegion);
|
||||
}
|
||||
|
||||
private MinioClient buildClient(String clientEndpoint) {
|
||||
return buildClient(clientEndpoint, null);
|
||||
}
|
||||
|
||||
private MinioClient buildClient(String clientEndpoint, String clientRegion) {
|
||||
if (!StringUtils.hasText(clientEndpoint)
|
||||
|| !StringUtils.hasText(accessKey)
|
||||
|| !StringUtils.hasText(secretKey)) {
|
||||
throw new IllegalStateException("MinIO is enabled but endpoint/accessKey/secretKey is incomplete");
|
||||
}
|
||||
return MinioClient.builder()
|
||||
MinioClient.Builder builder = MinioClient.builder()
|
||||
.endpoint(clientEndpoint)
|
||||
.credentials(accessKey, secretKey)
|
||||
.build();
|
||||
.credentials(accessKey, secretKey);
|
||||
if (StringUtils.hasText(clientRegion)) {
|
||||
builder.region(clientRegion.trim());
|
||||
}
|
||||
return builder.build();
|
||||
}
|
||||
}
|
||||
|
||||
+63
-2
@@ -17,6 +17,8 @@ import org.springframework.util.StringUtils;
|
||||
|
||||
import java.io.InputStream;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
@Slf4j
|
||||
@Service
|
||||
@@ -24,10 +26,20 @@ public class MinioObjectStorageProvider implements ObjectStorageProvider {
|
||||
|
||||
private static final long UNKNOWN_SIZE_PART_SIZE = 10 * 1024 * 1024L;
|
||||
|
||||
/**
|
||||
* Region probe key: only used to compute a signature locally, no object is written or read.
|
||||
*/
|
||||
private static final String REGION_PROBE_OBJECT = "integration-probe/region-probe.txt";
|
||||
|
||||
private static final Pattern CREDENTIAL_SCOPE = Pattern.compile(
|
||||
"X-Amz-Credential=[^&]*?%2F\\d{8}%2F([^%&]+)%2Fs3%2Faws4_request", Pattern.CASE_INSENSITIVE);
|
||||
|
||||
private final ObjectProvider<MinioClient> minioClientProvider;
|
||||
private final MinioClient signingClient;
|
||||
private final MinioStorageConfig minioStorageConfig;
|
||||
private final ObjectStorageProperties objectStorageProperties;
|
||||
private volatile MinioClient resolvedSigningClient;
|
||||
private volatile String resolvedSigningRegion;
|
||||
|
||||
@Autowired
|
||||
public MinioObjectStorageProvider(
|
||||
@@ -35,7 +47,7 @@ public class MinioObjectStorageProvider implements ObjectStorageProvider {
|
||||
MinioStorageConfig minioStorageConfig,
|
||||
ObjectStorageProperties objectStorageProperties
|
||||
) {
|
||||
this(minioClientProvider, minioStorageConfig, objectStorageProperties, minioStorageConfig.createSigningClient());
|
||||
this(minioClientProvider, minioStorageConfig, objectStorageProperties, null);
|
||||
}
|
||||
|
||||
MinioObjectStorageProvider(
|
||||
@@ -107,7 +119,7 @@ public class MinioObjectStorageProvider implements ObjectStorageProvider {
|
||||
if (!Boolean.TRUE.equals(minioStorageConfig.getPrivateBucket())) {
|
||||
return getFileUrl(objectName);
|
||||
}
|
||||
return (signingClient == null ? requireClient() : signingClient).getPresignedObjectUrl(
|
||||
return signingClientForPresign().getPresignedObjectUrl(
|
||||
GetPresignedObjectUrlArgs.builder()
|
||||
.method(Method.GET)
|
||||
.bucket(minioStorageConfig.getBucketName())
|
||||
@@ -117,6 +129,55 @@ public class MinioObjectStorageProvider implements ObjectStorageProvider {
|
||||
);
|
||||
}
|
||||
|
||||
private MinioClient signingClientForPresign() throws Exception {
|
||||
if (signingClient != null) {
|
||||
return signingClient;
|
||||
}
|
||||
MinioClient cached = resolvedSigningClient;
|
||||
if (cached != null) {
|
||||
return cached;
|
||||
}
|
||||
synchronized (this) {
|
||||
if (resolvedSigningClient == null) {
|
||||
MinioClient client = StringUtils.hasText(minioStorageConfig.getPublicEndpoint())
|
||||
? minioStorageConfig.createSigningClient(resolveSigningRegion())
|
||||
: null;
|
||||
resolvedSigningClient = client == null ? requireClient() : client;
|
||||
}
|
||||
return resolvedSigningClient;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Resolves the bucket region through the internal endpoint, so that signing does not depend on
|
||||
* the public endpoint being resolvable from this host.
|
||||
*/
|
||||
private String resolveSigningRegion() throws Exception {
|
||||
String configured = minioStorageConfig.getRegion();
|
||||
if (StringUtils.hasText(configured)) {
|
||||
return configured.trim();
|
||||
}
|
||||
if (resolvedSigningRegion != null) {
|
||||
return resolvedSigningRegion;
|
||||
}
|
||||
String probeUrl = requireClient().getPresignedObjectUrl(
|
||||
GetPresignedObjectUrlArgs.builder()
|
||||
.method(Method.GET)
|
||||
.bucket(minioStorageConfig.getBucketName())
|
||||
.object(REGION_PROBE_OBJECT)
|
||||
.expiry(1, TimeUnit.MINUTES)
|
||||
.build()
|
||||
);
|
||||
Matcher matcher = CREDENTIAL_SCOPE.matcher(probeUrl == null ? "" : probeUrl);
|
||||
if (!matcher.find()) {
|
||||
throw new IllegalStateException(
|
||||
"MinIO region cannot be resolved from internal endpoint, please configure minio.region");
|
||||
}
|
||||
resolvedSigningRegion = matcher.group(1);
|
||||
log.info("MinIO signing region resolved through internal endpoint, region={}", resolvedSigningRegion);
|
||||
return resolvedSigningRegion;
|
||||
}
|
||||
|
||||
private MinioClient requireClient() {
|
||||
MinioClient minioClient = minioClientProvider.getIfAvailable();
|
||||
if (minioClient == null) {
|
||||
|
||||
-3
@@ -433,7 +433,6 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, UserDO> implements
|
||||
if (Integer.valueOf(0).equals(userType)) {
|
||||
ensureCustomerUnique(userDTO.getNickname(), validatedWechatId, validatedPhone);
|
||||
}
|
||||
UserProfileFieldSupport.requireWechatIdForServiceUser(userType, validatedWechatId);
|
||||
|
||||
/**
|
||||
* Run business method `ensureShopBindingRequirement`.
|
||||
@@ -840,7 +839,6 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, UserDO> implements
|
||||
}
|
||||
}
|
||||
Integer targetUserType = userDO.getType();
|
||||
UserProfileFieldSupport.requireWechatIdForServiceUser(targetUserType, userDO.getWechatId());
|
||||
if (Integer.valueOf(0).equals(targetUserType)) {
|
||||
String customerPhone = validateCustomerPhone(userDO.getPhone(), false);
|
||||
ensureCustomerUnique(userDO.getNickname(), userDO.getWechatId(), customerPhone, id);
|
||||
@@ -2013,7 +2011,6 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, UserDO> implements
|
||||
if (profileApproved && userDTO.getWechatQrCode() != null) {
|
||||
userDO.setWechatQrCode(qrForUpdate.isEmpty() ? null : qrForUpdate);
|
||||
}
|
||||
UserProfileFieldSupport.requireWechatIdForServiceUser(userDO.getType(), userDO.getWechatId());
|
||||
|
||||
userDO.setUpdateTime(LocalDateTime.now());
|
||||
boolean updated = userMapper.updateById(userDO) > 0;
|
||||
|
||||
-6
@@ -13,10 +13,4 @@ public final class UserProfileFieldSupport {
|
||||
}
|
||||
return value.trim();
|
||||
}
|
||||
|
||||
public static void requireWechatIdForServiceUser(Integer userType, String wechatId) {
|
||||
if (Integer.valueOf(2).equals(userType) && !StringUtils.hasText(wechatId)) {
|
||||
throw new IllegalArgumentException("店长的微信号不能为空");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+38
@@ -51,6 +51,44 @@ class MinioObjectStorageProviderTest {
|
||||
verify(signingClient).getPresignedObjectUrl(org.mockito.ArgumentMatchers.any(GetPresignedObjectUrlArgs.class));
|
||||
}
|
||||
|
||||
@Test
|
||||
void resolvesSigningRegionThroughInternalEndpointInsteadOfPublicEndpoint() throws Exception {
|
||||
MinioClient internalClient = mock(MinioClient.class);
|
||||
ObjectProvider<MinioClient> internalClientProvider = mock(ObjectProvider.class);
|
||||
when(internalClientProvider.getIfAvailable()).thenReturn(internalClient);
|
||||
when(internalClient.getPresignedObjectUrl(org.mockito.ArgumentMatchers.any(GetPresignedObjectUrlArgs.class)))
|
||||
.thenReturn("http://192.168.10.14:9000/jayucloud-salon-sit/integration-probe/region-probe.txt"
|
||||
+ "?X-Amz-Algorithm=AWS4-HMAC-SHA256"
|
||||
+ "&X-Amz-Credential=access-key%2F20261108%2Fcn-sit-1%2Fs3%2Faws4_request"
|
||||
+ "&X-Amz-Date=20261108T000000Z&X-Amz-Expires=60&X-Amz-SignedHeaders=host"
|
||||
+ "&X-Amz-Signature=probe");
|
||||
|
||||
MinioStorageConfig config = new MinioStorageConfig();
|
||||
config.setEnabled(true);
|
||||
config.setEndpoint("http://192.168.10.14:9000");
|
||||
config.setPublicEndpoint("https://sit.minio.yunail.art");
|
||||
config.setAccessKey("access-key");
|
||||
config.setSecretKey("secret-key");
|
||||
config.setBucketName("jayucloud-salon-sit");
|
||||
config.setPrivateBucket(true);
|
||||
|
||||
MinioObjectStorageProvider provider = new MinioObjectStorageProvider(
|
||||
internalClientProvider,
|
||||
config,
|
||||
new ObjectStorageProperties()
|
||||
);
|
||||
|
||||
String signedUrl = provider.getPresignedUrl("style.jpg", 60);
|
||||
String signedAgain = provider.getPresignedUrl("style.jpg", 60);
|
||||
|
||||
assertTrue(signedUrl.startsWith("https://sit.minio.yunail.art/jayucloud-salon-sit/style.jpg?"));
|
||||
assertTrue(signedUrl.contains("X-Amz-Credential=access-key%2F"));
|
||||
assertTrue(signedUrl.contains("cn-sit-1%2Fs3%2Faws4_request"));
|
||||
assertTrue(signedAgain.contains("cn-sit-1%2Fs3%2Faws4_request"));
|
||||
verify(internalClient, org.mockito.Mockito.times(1))
|
||||
.getPresignedObjectUrl(org.mockito.ArgumentMatchers.any(GetPresignedObjectUrlArgs.class));
|
||||
}
|
||||
|
||||
@Test
|
||||
void usesInternalMinioClientForUploadDownloadAndDelete() throws Exception {
|
||||
MinioClient internalClient = mock(MinioClient.class);
|
||||
|
||||
@@ -41,7 +41,7 @@
|
||||
<a-textarea v-model:value="form.content" :rows="4" :maxlength="1000" placeholder="支持 HTML / Markdown,也可以直接输入纯文本" />
|
||||
</a-form-item>
|
||||
<a-form-item label="图片">
|
||||
<a-upload :show-upload-list="false" accept="image/*" :before-upload="uploadAnnouncementImage">
|
||||
<a-upload :show-upload-list="false" accept="image/jpeg,image/png,image/webp,image/gif" :before-upload="uploadAnnouncementImage">
|
||||
<a-button :loading="imageUploading">添加图片</a-button>
|
||||
</a-upload>
|
||||
<a-space v-if="form.imageFileIds.length" wrap class="announcement-images">
|
||||
|
||||
@@ -292,6 +292,7 @@
|
||||
<div class="upload-tip">首页轮播图,建议尺寸 750x300 像素</div>
|
||||
<a-upload
|
||||
v-model:file-list="bannerFileList"
|
||||
accept="image/jpeg,image/png,image/webp,image/gif"
|
||||
list-type="picture-card"
|
||||
:custom-request="handleUploadBanner"
|
||||
:before-upload="beforeUpload"
|
||||
@@ -313,6 +314,7 @@
|
||||
<div class="upload-tip">店铺详情展示图</div>
|
||||
<a-upload
|
||||
v-model:file-list="imageFileList"
|
||||
accept="image/jpeg,image/png,image/webp,image/gif"
|
||||
list-type="picture-card"
|
||||
:custom-request="handleUploadImage"
|
||||
:before-upload="beforeUpload"
|
||||
@@ -419,6 +421,7 @@
|
||||
<a-form-item label="背景图">
|
||||
<a-upload
|
||||
v-model:file-list="themeBackgroundFileList"
|
||||
accept="image/jpeg,image/png,image/webp,image/gif"
|
||||
list-type="picture-card"
|
||||
:custom-request="handleUploadThemeBackground"
|
||||
:before-upload="beforeUpload"
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
</a-form-item>
|
||||
<a-form-item label="消息图片">
|
||||
<div class="image-upload-row">
|
||||
<a-upload accept="image/*" list-type="picture-card" :show-upload-list="false" :custom-request="handleImageUpload">
|
||||
<a-upload accept="image/jpeg,image/png,image/webp,image/gif" list-type="picture-card" :show-upload-list="false" :custom-request="handleImageUpload">
|
||||
<div v-if="!imagePreviewUrl" class="upload-placeholder">
|
||||
<PictureOutlined />
|
||||
<span>上传图片</span>
|
||||
@@ -35,7 +35,7 @@
|
||||
</a-upload>
|
||||
<div class="image-upload-copy">
|
||||
<div>每条消息最多上传一张图片。</div>
|
||||
<small>建议使用 JPG/PNG/WebP,图片会在弹窗和通知详情中展示。</small>
|
||||
<small>建议使用 JPG/PNG/WebP/GIF,GIF 会保留动图效果,图片会在弹窗和通知详情中展示。</small>
|
||||
<a-button v-if="form.imageFileId" type="link" danger size="small" @click="removeImage">移除图片</a-button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
|
||||
<div class="settings-content">
|
||||
<div v-if="activeSection === 'runtime'" class="settings-groups">
|
||||
<section id="settings-group-account" class="settings-group">
|
||||
<section v-if="activeRuntimeGroup === 'settings-group-account'" id="settings-group-account" class="settings-group">
|
||||
<header class="settings-group__head">
|
||||
<div class="settings-group__head-main">
|
||||
<div class="settings-group__title"><h2>账号与登录</h2></div>
|
||||
@@ -87,7 +87,7 @@
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section id="settings-group-shop" class="settings-group">
|
||||
<section v-if="activeRuntimeGroup === 'settings-group-shop'" id="settings-group-shop" class="settings-group">
|
||||
<header class="settings-group__head">
|
||||
<div class="settings-group__head-main">
|
||||
<div class="settings-group__title"><h2>门店经营</h2><span class="tag">SHOP</span></div>
|
||||
@@ -782,6 +782,8 @@ const toggleProbeDetail = (service: string, operation: string) => {
|
||||
}
|
||||
|
||||
const activeGroup = ref('')
|
||||
/** activeRuntimeGroup switches the runtime groups so only one is rendered at a time. */
|
||||
const activeRuntimeGroup = ref('settings-group-account')
|
||||
/** activeServiceGroup switches the five service groups so only one is rendered at a time. */
|
||||
const activeServiceGroup = ref('settings-group-probe')
|
||||
const groupNavItems = computed<Array<{ id: string; label: string; badge?: string }>>(() => {
|
||||
@@ -836,12 +838,21 @@ const handleGroupNavClick = (id: string) => {
|
||||
activeGroup.value = id
|
||||
return
|
||||
}
|
||||
if (activeSection.value === 'runtime') {
|
||||
activeRuntimeGroup.value = id
|
||||
activeGroup.value = id
|
||||
return
|
||||
}
|
||||
scrollToGroup(id)
|
||||
}
|
||||
watch(activeSection, () => {
|
||||
activeGroup.value = activeSection.value === 'services'
|
||||
? activeServiceGroup.value
|
||||
: groupNavItems.value[0]?.id || ''
|
||||
if (activeSection.value === 'services') {
|
||||
activeGroup.value = activeServiceGroup.value
|
||||
} else if (activeSection.value === 'runtime') {
|
||||
activeGroup.value = activeRuntimeGroup.value
|
||||
} else {
|
||||
activeGroup.value = groupNavItems.value[0]?.id || ''
|
||||
}
|
||||
}, { immediate: true })
|
||||
const runProbe = async (service: string, operation: string) => {
|
||||
const key = `${service}:${operation}`
|
||||
|
||||
@@ -225,14 +225,13 @@
|
||||
<a-form-item
|
||||
label="微信号"
|
||||
name="wechatId"
|
||||
:required="[2, 3].includes(Number(formState.type))"
|
||||
>
|
||||
<a-input v-model:value="formState.wechatId" placeholder="店长和美甲师必填" />
|
||||
<a-input v-model:value="formState.wechatId" placeholder="选填" />
|
||||
</a-form-item>
|
||||
<a-form-item label="微信二维码" name="wechatQrCode">
|
||||
<div class="wechat-qr-field">
|
||||
<a-upload
|
||||
accept="image/*"
|
||||
accept="image/jpeg,image/png,image/webp"
|
||||
:show-upload-list="false"
|
||||
:before-upload="beforeUploadWechatQr"
|
||||
:custom-request="handleWechatQrUpload"
|
||||
@@ -659,9 +658,9 @@ const handlePhoneFocus = () => {
|
||||
|
||||
/** beforeUploadWechatQr validates QR image files before upload. */
|
||||
const beforeUploadWechatQr = (file: File) => {
|
||||
const isImage = file.type.startsWith('image/')
|
||||
const isImage = file.type.startsWith('image/') && file.type !== 'image/gif'
|
||||
if (!isImage) {
|
||||
message.error('只能上传图片文件')
|
||||
message.error('二维码仅支持 JPG、PNG 或 WebP 图片')
|
||||
}
|
||||
return isImage
|
||||
}
|
||||
@@ -776,15 +775,7 @@ const formRules = {
|
||||
trigger: 'blur'
|
||||
}
|
||||
],
|
||||
wechatId: [{
|
||||
validator: async (_rule: unknown, value: string) => {
|
||||
if ([2, 3].includes(Number(formState.type)) && !value?.trim()) {
|
||||
return Promise.reject('店长和美甲师必须填写微信号')
|
||||
}
|
||||
return Promise.resolve()
|
||||
},
|
||||
trigger: ['blur', 'change']
|
||||
}],
|
||||
wechatId: [],
|
||||
password: [{
|
||||
validator: async (_rule: unknown, value: string) => {
|
||||
validateOptionalPasswordStrength(value)
|
||||
|
||||
@@ -64,7 +64,8 @@ describe('admin modal and user form behavior', () => {
|
||||
expect(userFormModal).toContain('value-format="YYYY-MM-DD"')
|
||||
expect(userFormModal).toContain('class="user-date-picker"')
|
||||
expect(usersView).toContain('.user-date-picker')
|
||||
expect(wechatIdField).toContain(':required="[2, 3].includes(Number(formState.type))"')
|
||||
expect(wechatIdField).not.toContain(':required')
|
||||
expect(wechatIdField).toContain('placeholder="选填"')
|
||||
expect(shopIdsField).toContain(':required="Number(formState.type) !== 4"')
|
||||
})
|
||||
})
|
||||
|
||||
@@ -10,7 +10,8 @@ const { showActionModal } = require('../../utils/action-modal')
|
||||
const DRAFT_STORAGE_PREFIX = 'managerAppointmentDraft'
|
||||
const DRAFT_TTL_MS = 7 * 24 * 60 * 60 * 1000
|
||||
const DRAFT_SAVE_DELAY_MS = 400
|
||||
const TIME_SLOT_MINUTES = 15
|
||||
const TIME_SLOT_MINUTES = 1
|
||||
const MINUTE_VALUES = Array.from({ length: 60 }, (_, index) => index)
|
||||
|
||||
function buildClientRequestId(prefix) {
|
||||
return `${prefix}-${Date.now()}-${Math.random().toString(36).slice(2, 10)}`
|
||||
@@ -419,7 +420,7 @@ function buildTimeWheelState(slots, preferredTime) {
|
||||
: firstAvailableSlot || preferredSlot || slots[0]
|
||||
const hours = Array.from(new Set(slots.map(slot => slot.hour)))
|
||||
const selectedHourIndex = Math.max(0, hours.indexOf(selectedSlot.hour))
|
||||
const minuteValues = [0, 15, 30, 45]
|
||||
const minuteValues = MINUTE_VALUES
|
||||
const minutes = minuteValues.map(minute => {
|
||||
const slot = slots.find(item => item.hour === selectedSlot.hour && item.minute === minute)
|
||||
return {
|
||||
@@ -444,7 +445,7 @@ function buildTimeWheelState(slots, preferredTime) {
|
||||
}
|
||||
|
||||
function timeWheelStateForHour(slots, hour, selectedMinute) {
|
||||
const minuteValues = [0, 15, 30, 45]
|
||||
const minuteValues = MINUTE_VALUES
|
||||
const minutes = minuteValues.map(minute => {
|
||||
const slot = slots.find(item => item.hour === hour && item.minute === minute)
|
||||
return {
|
||||
|
||||
@@ -137,7 +137,7 @@
|
||||
<view wx:if="{{timeSheetVisible}}" class="modal-mask" bindtap="closeTimeSheet" catchtouchmove="stopTouchMove">
|
||||
<view class="time-modal" catchtap="stopTap" catchtouchmove="stopTouchMove">
|
||||
<view class="modal-head"><view><text class="modal-title">选择预约时间</text><text class="modal-subtitle">{{form.appointmentDate}} · {{selectedArtist.name || '待分配'}} · {{form.durationMinutes}}分钟</text></view><view class="modal-close" bindtap="closeTimeSheet" aria-label="关闭时间选择"></view></view>
|
||||
<view class="time-mode-switch"><button class="{{timePickerMode === 'wheel' ? 'active' : ''}}" data-mode="wheel" bindtap="onTimePickerModeChange">滚轮选择</button><button class="{{timePickerMode === 'grid' ? 'active' : ''}}" data-mode="grid" bindtap="onTimePickerModeChange">15分钟时段</button></view>
|
||||
<view class="time-mode-switch"><button class="{{timePickerMode === 'wheel' ? 'active' : ''}}" data-mode="wheel" bindtap="onTimePickerModeChange">滚轮选择</button><button class="{{timePickerMode === 'grid' ? 'active' : ''}}" data-mode="grid" bindtap="onTimePickerModeChange">逐分钟时段</button></view>
|
||||
<view wx:if="{{timeLoading}}" class="time-empty">正在计算可约时间...</view>
|
||||
<view wx:elif="{{timeError}}" class="time-empty"><text>{{businessHoursMissing && !canManageShopSettings ? '门店营业时间尚未设置,请联系店长完成设置' : timeError}}</text><button wx:if="{{businessHoursMissing && canManageShopSettings}}" class="time-empty-action" bindtap="openShopSettings">前往店铺设置</button></view>
|
||||
<block wx:elif="{{timePickerMode === 'wheel'}}">
|
||||
|
||||
@@ -76,6 +76,8 @@ async function run() {
|
||||
assert.strictEqual(page.data.availableTimeGroups.length > 0, true)
|
||||
assert.strictEqual(page.data.availableTimeGroups[0].times[0].value, '09:30')
|
||||
assert.strictEqual(page.data.timeSelectTip, '请选择预约时间,美甲师可稍后分配')
|
||||
assert.strictEqual(page.data.timePickerMinutes.length, 60)
|
||||
assert.strictEqual(page.data.timePickerSlots.some(slot => slot.value === '09:31'), true)
|
||||
const availability = await page.checkAvailability()
|
||||
assert.strictEqual(availability.ok, true)
|
||||
assert.strictEqual(page.data.conflictTip.includes('待分配'), true)
|
||||
|
||||
@@ -21,6 +21,9 @@ function resolveCalendarErrorMessage(error) {
|
||||
|
||||
const LANE_TINTS = ['#EAF3FA', '#FBF1EB', '#EEF5EF']
|
||||
|
||||
// 日视图时间轴末尾留白(rpx):避免末条时间刻度与末个预约卡片贴住滚动容器底边
|
||||
const TIMELINE_BOTTOM_SPACE = 64
|
||||
|
||||
const DESIGN_ARTIST_COLORS = {
|
||||
张小雨: '#43789E',
|
||||
林小满: '#96684B',
|
||||
@@ -747,7 +750,7 @@ Page({
|
||||
hours,
|
||||
hasTimedAppointments: timedAppointments.length > 0,
|
||||
timelineHeight: timelineHeight + laneHeaderHeight,
|
||||
timelineViewportHeight: Math.min(820, timelineHeight + laneHeaderHeight),
|
||||
timelineViewportHeight: Math.min(820, timelineHeight + laneHeaderHeight + TIMELINE_BOTTOM_SPACE),
|
||||
laneHeaderHeight,
|
||||
laneItemWidth: 248,
|
||||
laneWidth: Math.max(720, lanes.reduce((width, lane) => width + (lane.width || 248), 0)),
|
||||
|
||||
@@ -135,7 +135,7 @@ async function run() {
|
||||
})
|
||||
assert.strictEqual(shortAppointmentState.hours[0].top, 54)
|
||||
assert.strictEqual(shortAppointmentState.hours[1].top, 204)
|
||||
assert.strictEqual(shortAppointmentState.timelineViewportHeight, 204)
|
||||
assert.strictEqual(shortAppointmentState.timelineViewportHeight, 268)
|
||||
const shortAppointmentLane = shortAppointmentState.dayLanes.find(lane => lane.artistId === 1)
|
||||
assert.strictEqual(shortAppointmentLane.blocks[0].height, 40)
|
||||
assert.strictEqual(shortAppointmentLane.blocks[0].compact, true)
|
||||
|
||||
@@ -128,6 +128,7 @@
|
||||
</view>
|
||||
</scroll-view>
|
||||
</view>
|
||||
<view class="timeline-bottom-space"></view>
|
||||
</scroll-view>
|
||||
</view>
|
||||
|
||||
|
||||
@@ -371,12 +371,16 @@
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.timeline-bottom-space {
|
||||
height: calc(64rpx + env(safe-area-inset-bottom));
|
||||
}
|
||||
|
||||
.time-axis {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
z-index: 4;
|
||||
width: 92rpx;
|
||||
width: 104rpx;
|
||||
height: 100%;
|
||||
border-right: 1rpx solid #e7ece9;
|
||||
background: #ffffff;
|
||||
@@ -390,7 +394,7 @@
|
||||
|
||||
.time-label {
|
||||
position: absolute;
|
||||
right: 12rpx;
|
||||
right: 16rpx;
|
||||
color: #71807a;
|
||||
font-size: 20rpx;
|
||||
line-height: 1;
|
||||
@@ -402,7 +406,7 @@
|
||||
position: absolute;
|
||||
top: 0;
|
||||
right: 0;
|
||||
left: 104rpx;
|
||||
left: 124rpx;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
<view class="card form-card">
|
||||
<view class="field"><text class="field-label required">昵称</text><input value="{{form.nickname}}" data-field="nickname" bindinput="onInput" maxlength="30" placeholder="请输入昵称" /></view>
|
||||
<view class="field phone-field" bindtap="goAccountSettings"><text class="field-label">手机号</text><view class="phone-value"><text>{{phoneDisplay}}</text><text class="phone-arrow">›</text></view></view>
|
||||
<view class="field"><text class="field-label">微信号</text><input value="{{form.wechatId}}" data-field="wechatId" bindinput="onInput" maxlength="50" placeholder="请输入微信号" /></view>
|
||||
<view class="field"><text class="field-label">微信号</text><input value="{{form.wechatId}}" data-field="wechatId" bindinput="onInput" maxlength="50" placeholder="请输入微信号(选填)" /></view>
|
||||
<view class="field signature-field"><text class="field-label">个性签名</text><textarea value="{{form.signature}}" data-field="signature" bindinput="onInput" maxlength="200" placeholder="请输入个人签名" /></view>
|
||||
</view>
|
||||
|
||||
|
||||
@@ -0,0 +1,51 @@
|
||||
# Salon 对象存储 MinIO 预签名区域解析配置说明
|
||||
|
||||
更新时间:2026-11-08
|
||||
|
||||
## 1. 问题背景
|
||||
|
||||
SIT「对象存储三副本·往返测试」中 MinIO 卡在「生成签名地址」阶段,异常为
|
||||
`Failed to connect to sit.minio.yunail.art/198.18.220.2:443`。
|
||||
|
||||
原因:`minio-java` 在生成预签名 URL 前,若未显式指定 region,会先向客户端 endpoint 查询桶所在区域。
|
||||
签名客户端使用公网 `public-endpoint`(`https://sit.minio.yunail.art`),该域名在 SIT 上被解析为
|
||||
fake-IP(198.18.0.0/15),连接被拒,导致整步失败。
|
||||
|
||||
## 2. 处理方式
|
||||
|
||||
- 签名客户端改为**显式指定 region** 后再签名,不再触发向 `public-endpoint` 的 region 查询。
|
||||
- region 默认通过**内网 endpoint**(`minio.endpoint`,如 `http://192.168.10.14:9000`)解析一次并缓存:
|
||||
用内网客户端对探针对象做一次本地预签名,从生成的 `X-Amz-Credential` 作用域中提取 region。
|
||||
该调用只做签名计算与一次内网 `?location` 查询,不写入、不读取任何对象。
|
||||
- 签出的 URL 仍以 `public-endpoint` 为 host,上传、下载、删除继续走内网 `endpoint`,产品语义不变。
|
||||
- 支持可选配置 `minio.region`:配置后直接使用该值,不再做内网解析。
|
||||
|
||||
本次未修改任何环境的 Nacos 配置;`minio.region` 为可选项,默认留空即走内网自动解析。
|
||||
|
||||
## 3. 配置项
|
||||
|
||||
| 配置项 | 位置 | 必填 | 说明 |
|
||||
| --- | --- | --- | --- |
|
||||
| `minio.endpoint` | `infra.yaml` | 是 | 服务端内网访问地址,也是 region 解析通道 |
|
||||
| `minio.public-endpoint` | `infra.yaml` | 否 | 仅用于生成客户端签名 URL 的公网地址 |
|
||||
| `minio.region` | `infra.yaml` | 否 | 显式指定签名 region;留空时按内网解析结果签名 |
|
||||
|
||||
## 4. 验证结果(SIT,未修改 DNS)
|
||||
|
||||
- 内网解析 region:`REGION_RESOLVE=OK region=us-east-1`(首次约 391ms,含内网 `?location` 往返)。
|
||||
- 公网 endpoint 签名:`PUBLIC_PRESIGN=OK ms=11`,此时不再发起任何公网 DNS 解析或连接。
|
||||
- 签名可用性(绕过 DNS,指定真实 IP + 域名 SNI/证书校验):
|
||||
`curl --resolve sit.minio.yunail.art:443:8.137.35.61 -w '%{http_code} %{ssl_verify_result}'`
|
||||
返回 `404 NoSuchKey`(探针键不存在),说明签名被服务端接受。
|
||||
- 反向验证:篡改 `X-Amz-Signature` 后同一请求返回 `403 SignatureDoesNotMatch`,证明上一步的 404 是校验通过后的业务响应。
|
||||
|
||||
## 5. 边界说明
|
||||
|
||||
- 「生成签名地址」阶段已不再依赖公网域名解析。
|
||||
- 「签名访问」阶段仍依赖公网域名解析:真正的 GET 请求发往 `sit.minio.yunail.art`,DNS 未修复时仍会命中 fake-IP。
|
||||
- SIT 的 `*.yunail.art` 解析到 fake-IP 属于环境侧问题,未在本次改动范围内。
|
||||
|
||||
## 6. 回退方式
|
||||
|
||||
本次为代码改动,不涉及数据库迁移;回退时使用上一版本应用包即可。
|
||||
若需临时绕过内网解析,可在 `infra.yaml` 补充 `minio.region`。
|
||||
@@ -33,7 +33,7 @@
|
||||
- `gateway.yaml`:Gateway 端口、路由、白名单和网关参数。
|
||||
- `logging.yaml`:公共日志级别。
|
||||
|
||||
对象存储统一使用 `object-storage.signed-url-expire-minutes`。MinIO `endpoint` 始终指服务端内网访问地址;可选 `public-endpoint` 仅用于生成交给客户端访问的 MinIO 签名 URL,不改变服务端上传、下载、删除和对象读取路径。DEV 不配置该字段时沿用原内网 endpoint;SIT 配置为 `https://sit.minio.yunail.art`。MinIO、七牛和 OSS 的连接配置只保留各自必要字段;私有桶按环境配置 `private-bucket: true`。三套 Salon 环境默认签名有效期为 60 分钟。
|
||||
对象存储统一使用 `object-storage.signed-url-expire-minutes`。MinIO `endpoint` 始终指服务端内网访问地址;可选 `public-endpoint` 仅用于生成交给客户端访问的 MinIO 签名 URL,不改变服务端上传、下载、删除和对象读取路径。DEV 不配置该字段时沿用原内网 endpoint;SIT 配置为 `https://sit.minio.yunail.art`。MinIO、七牛和 OSS 的连接配置只保留各自必要字段;私有桶按环境配置 `private-bucket: true`。三套 Salon 环境默认签名有效期为 60 分钟。MinIO 可选 `region`:留空时签名区域经内网 `endpoint` 解析一次并缓存,签名 URL 仍以 `public-endpoint` 为 host,见 `docs/scripts/Salon对象存储MinIO预签名区域解析配置说明_20261108.md`。
|
||||
|
||||
后端启动时需要 Nacos 启动引导参数:`NACOS_SERVER_ADDR`、`NACOS_NAMESPACE`、`NACOS_GROUP`、`NACOS_USERNAME`、`NACOS_PASSWORD`。Salon Core 另需由部署环境注入 `SALON_SECURE_CONFIG_MASTER_KEY`,用于数据库安全接入配置的 AES-GCM 加解密;此密钥不放 Nacos、不提交仓库,按环境独立设置,所有同环境 Core 实例保持一致。业务数据库、Redis、RabbitMQ 和对象存储参数仍由 Nacos 提供,不通过应用环境变量覆盖。
|
||||
|
||||
|
||||
Reference in New Issue
Block a user