接入MessageHub标准MQ验证码投递 #43
@@ -15,6 +15,7 @@ jobs:
|
||||
WEB_TARGET_PORT: 22
|
||||
WEB_TARGET_USER: root
|
||||
SALON_PROD_SSH_PASSWORD: ${{ secrets.SALON_PROD_SSH_PASSWORD }}
|
||||
MESSAGEHUB_ACCESS_TOKEN: ${{ secrets.MESSAGEHUB_SIT_ACCESS_TOKEN }}
|
||||
WEB_REMOTE_DIR: /opt/jc-salon-frontend-sit
|
||||
steps:
|
||||
- name: 从内网 Gitea 检出代码
|
||||
@@ -75,6 +76,18 @@ jobs:
|
||||
{"Name":"salon-web-sit","Host":"${WEB_TARGET_HOST}","Port":${WEB_TARGET_PORT},"User":"${WEB_TARGET_USER}","Purpose":"Salon SIT NGINX","Environment":"sit"}
|
||||
]
|
||||
JSON
|
||||
- name: 写入 MessageHub 运行时 Token
|
||||
shell: bash
|
||||
env:
|
||||
SALON_PROD_SSH_PASSWORD: ${{ secrets.SALON_PROD_SSH_PASSWORD }}
|
||||
MESSAGEHUB_ACCESS_TOKEN: ${{ secrets.MESSAGEHUB_SIT_ACCESS_TOKEN }}
|
||||
run: |
|
||||
set -euo pipefail
|
||||
test -n "$SALON_PROD_SSH_PASSWORD"
|
||||
test -n "$MESSAGEHUB_ACCESS_TOKEN"
|
||||
printf 'MESSAGEHUB_ACCESS_TOKEN=%s\n' "$MESSAGEHUB_ACCESS_TOKEN" |
|
||||
SSHPASS="$SALON_PROD_SSH_PASSWORD" sshpass -e ssh -o StrictHostKeyChecking=no -p 22 root@192.168.10.106 \
|
||||
'install -d -m 700 /etc/sysconfig /etc/systemd/system/jc-salon-core-sit.service.d; install -m 600 /dev/stdin /etc/sysconfig/jc-salon-messagehub; printf "[Service]\\nEnvironmentFile=/etc/sysconfig/jc-salon-messagehub\\n" | install -m 644 /dev/stdin /etc/systemd/system/jc-salon-core-sit.service.d/messagehub.conf; systemctl daemon-reload'
|
||||
- name: 自动发布 Salon SIT
|
||||
shell: pwsh
|
||||
env:
|
||||
|
||||
@@ -123,7 +123,7 @@ const DEFAULT_DOMAINS = {
|
||||
local: 'http://127.0.0.1:80',
|
||||
tunnel: 'https://yunail.art',
|
||||
'dev-remote': 'https://yunail.art',
|
||||
trial: 'https://yunail.art',
|
||||
trial: 'https://sit.yunail.art',
|
||||
release: 'https://yunail.art'
|
||||
}
|
||||
|
||||
@@ -140,7 +140,7 @@ const DOMAIN_MAP = {
|
||||
* Purpose: DEFAULT_DEVELOP_TARGET supports config.js by holding or executing the default develop target page or API role.
|
||||
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
|
||||
*/
|
||||
const DEFAULT_DEVELOP_TARGET = IS_DEVTOOLS ? 'local' : 'dev-remote'
|
||||
const DEFAULT_DEVELOP_TARGET = 'local'
|
||||
/**
|
||||
* Purpose: DEVELOP_TARGET supports config.js by holding or executing the develop target page or API role.
|
||||
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
|
||||
|
||||
@@ -9,7 +9,7 @@ module.exports = {
|
||||
local: 'http://127.0.0.1:80',
|
||||
tunnel: 'https://yunail.art',
|
||||
'dev-remote': 'https://yunail.art',
|
||||
trial: 'https://yunail.art',
|
||||
trial: 'https://sit.yunail.art',
|
||||
release: 'https://yunail.art'
|
||||
}
|
||||
}
|
||||
|
||||
+79
-12
@@ -1,11 +1,11 @@
|
||||
package com.xiaowang.jacyucloudsalon.core.modules.integration.service.impl;
|
||||
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.fasterxml.jackson.databind.JsonNode;
|
||||
import com.xiaowang.jacyucloudsalon.core.config.BrandProperties;
|
||||
import com.xiaowang.jacyucloudsalon.core.modules.integration.entity.MessageHubPushConfigDO;
|
||||
import com.xiaowang.jacyucloudsalon.core.modules.integration.service.MessageHubClientService;
|
||||
import com.xiaowang.jacyucloudsalon.core.modules.integration.service.MessageHubPushConfigService;
|
||||
import com.xiaowang.jacyucloudsalon.core.support.id.TimeOrderedSnowflakeIdGenerator;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.amqp.core.Message;
|
||||
@@ -13,8 +13,13 @@ import org.springframework.amqp.core.MessageBuilder;
|
||||
import org.springframework.amqp.rabbit.core.RabbitTemplate;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.cloud.context.config.annotation.RefreshScope;
|
||||
import org.springframework.http.HttpEntity;
|
||||
import org.springframework.http.HttpHeaders;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.util.StringUtils;
|
||||
import org.springframework.web.client.RestTemplate;
|
||||
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.HashMap;
|
||||
@@ -35,14 +40,11 @@ public class MessageHubClientServiceImpl implements MessageHubClientService {
|
||||
* Variable `rabbitTemplate`: Spring-injected collaborator used by this class to finish database access, validation, or downstream calls.
|
||||
*/
|
||||
private final RabbitTemplate rabbitTemplate;
|
||||
private final RestTemplate restTemplate;
|
||||
/**
|
||||
* Variable `objectMapper`: Spring-injected collaborator used by this class to finish database access, validation, or downstream calls.
|
||||
*/
|
||||
private final ObjectMapper objectMapper;
|
||||
/**
|
||||
* Variable `snowflakeIdGenerator`: Spring-injected collaborator used by this class to finish database access, validation, or downstream calls.
|
||||
*/
|
||||
private final TimeOrderedSnowflakeIdGenerator snowflakeIdGenerator;
|
||||
/**
|
||||
* Variable `messageHubPushConfigService`: Spring-injected collaborator used by this class to finish database access, validation, or downstream calls.
|
||||
*/
|
||||
@@ -52,6 +54,18 @@ public class MessageHubClientServiceImpl implements MessageHubClientService {
|
||||
*/
|
||||
private final BrandProperties brandProperties;
|
||||
|
||||
@Value("${messagehub.client.base-url:http://192.168.10.107:8080}")
|
||||
private String messageHubBaseUrl;
|
||||
|
||||
@Value("${messagehub.client.access-token:}")
|
||||
private String messageHubAccessToken;
|
||||
|
||||
@Value("${messagehub.client.ingress-exchange:messagehub.ingress.exchange}")
|
||||
private String ingressExchange;
|
||||
|
||||
@Value("${messagehub.client.ingress-routing-key:message.send}")
|
||||
private String ingressRoutingKey;
|
||||
|
||||
@Value("${messagehub.client.sms-queue:smsQueue}")
|
||||
/**
|
||||
* Purpose: smsQueue supports MessageHubClientServiceImpl.java by holding or executing the sms queue business role.
|
||||
@@ -59,7 +73,7 @@ public class MessageHubClientServiceImpl implements MessageHubClientService {
|
||||
*/
|
||||
private String smsQueue;
|
||||
|
||||
@Value("${messagehub.client.source-system:fingertipdesigner}")
|
||||
@Value("${messagehub.client.source-system:jayucloud-salon}")
|
||||
/**
|
||||
* Purpose: sourceSystem supports MessageHubClientServiceImpl.java by holding or executing the source system business role.
|
||||
* Usage: reference this field from the owning layer and pass validated inputs before reading or updating related state.
|
||||
@@ -110,7 +124,8 @@ public class MessageHubClientServiceImpl implements MessageHubClientService {
|
||||
public void sendSmsVerificationCode(String sceneCode, String phone, String code) {
|
||||
try {
|
||||
MessageHubPushConfigDO config = messageHubPushConfigService.getEnabledConfig(sceneCode);
|
||||
String messageId = snowflakeIdGenerator.nextIdString();
|
||||
String resolvedSourceSystem = resolveSourceSystem(config);
|
||||
String messageId = reserveMessageId(resolvedSourceSystem);
|
||||
Map<String, Object> messageBody = buildSmsMessageBody(config, sceneCode, phone, code, messageId);
|
||||
String jsonBody = objectMapper.writeValueAsString(messageBody);
|
||||
Message message = MessageBuilder
|
||||
@@ -120,16 +135,68 @@ public class MessageHubClientServiceImpl implements MessageHubClientService {
|
||||
.setMessageId(messageId)
|
||||
.build();
|
||||
|
||||
String queueName = config == null ? smsQueue : config.getQueueName();
|
||||
rabbitTemplate.convertAndSend(queueName, message);
|
||||
log.info("短信验证码消息已投递到 MessageHub,sceneCode: {}, phone: {}, queue: {}, sourceSystem: {}, templateCode: {}",
|
||||
sceneCode, phone, queueName, messageBody.get("sourceSystem"), messageBody.get("templateCode"));
|
||||
message.getMessageProperties().setHeader("X-MessageHub-Access-Token", requireAccessToken());
|
||||
rabbitTemplate.send(ingressExchange, ingressRoutingKey, message);
|
||||
log.info("短信验证码消息已投递到 MessageHub,sceneCode: {}, phone: {}, exchange: {}, sourceSystem: {}, templateCode: {}",
|
||||
sceneCode, phone, ingressExchange, messageBody.get("sourceSystem"), messageBody.get("templateCode"));
|
||||
} catch (Exception exception) {
|
||||
log.error("发送短信验证码失败", exception);
|
||||
throw new RuntimeException("发送短信验证码失败: " + exception.getMessage(), exception);
|
||||
}
|
||||
}
|
||||
|
||||
private String reserveMessageId(String resolvedSourceSystem) throws Exception {
|
||||
HttpHeaders headers = new HttpHeaders();
|
||||
headers.setContentType(MediaType.APPLICATION_JSON);
|
||||
headers.set("X-MessageHub-Access-Token", requireAccessToken());
|
||||
Map<String, String> requestBody = Map.of("sourceSystem", resolvedSourceSystem);
|
||||
ResponseEntity<JsonNode> response = restTemplate.postForEntity(
|
||||
requireBaseUrl() + "/api/v1/messages/ids",
|
||||
new HttpEntity<>(requestBody, headers),
|
||||
JsonNode.class);
|
||||
if (!response.getStatusCode().is2xxSuccessful() || response.getBody() == null) {
|
||||
throw new IllegalStateException("MessageHub 预留消息 ID 失败,HTTP 状态: " + response.getStatusCode().value());
|
||||
}
|
||||
JsonNode body = response.getBody();
|
||||
if (body.path("code").asInt(-1) != 0) {
|
||||
throw new IllegalStateException("MessageHub 预留消息 ID 失败,响应码: " + body.path("code").asInt(-1)
|
||||
+ ",原因: " + body.path("message").asText("未知错误"));
|
||||
}
|
||||
String messageId = body.path("data").path("messageId").asText("");
|
||||
if (!StringUtils.hasText(messageId)) {
|
||||
throw new IllegalStateException("MessageHub 预留消息 ID 响应缺少 data.messageId");
|
||||
}
|
||||
return messageId;
|
||||
}
|
||||
|
||||
private String resolveSourceSystem(MessageHubPushConfigDO config) {
|
||||
if (config != null && StringUtils.hasText(config.getSourceSystem())) {
|
||||
return config.getSourceSystem();
|
||||
}
|
||||
return requireSourceSystem();
|
||||
}
|
||||
|
||||
private String requireBaseUrl() {
|
||||
if (!StringUtils.hasText(messageHubBaseUrl)) {
|
||||
throw new IllegalStateException("未配置 messagehub.client.base-url");
|
||||
}
|
||||
return messageHubBaseUrl.replaceAll("/$", "");
|
||||
}
|
||||
|
||||
private String requireAccessToken() {
|
||||
if (!StringUtils.hasText(messageHubAccessToken)) {
|
||||
throw new IllegalStateException("未配置 messagehub.client.access-token");
|
||||
}
|
||||
return messageHubAccessToken;
|
||||
}
|
||||
|
||||
private String requireSourceSystem() {
|
||||
if (!StringUtils.hasText(sourceSystem)) {
|
||||
throw new IllegalStateException("未配置 messagehub.client.source-system");
|
||||
}
|
||||
return sourceSystem;
|
||||
}
|
||||
|
||||
/**
|
||||
* Run business method `buildSmsMessageBody`.
|
||||
* Call guide: pass the named parameters below from the controller or caller; the method validates them and returns the business result.
|
||||
@@ -152,7 +219,7 @@ public class MessageHubClientServiceImpl implements MessageHubClientService {
|
||||
messageBody.put("templateCode", config == null ? verifyTemplateCode : config.getTemplateCode());
|
||||
messageBody.put("sourceSystem", config == null ? sourceSystem : config.getSourceSystem());
|
||||
messageBody.put("uniqueId", messageId);
|
||||
messageBody.put("sendMethod", StringUtils.hasText(resolvedSendMethod) ? resolvedSendMethod : "OTHER");
|
||||
messageBody.put("platformParams", Map.of("sendMethod", StringUtils.hasText(resolvedSendMethod) ? resolvedSendMethod : "OTHER"));
|
||||
if (config != null && config.getChannelId() != null) {
|
||||
messageBody.put("channelId", config.getChannelId());
|
||||
}
|
||||
|
||||
@@ -24,9 +24,9 @@ export const ADMIN_DASHBOARD_PATH = '/admin/dashboard'
|
||||
|
||||
export const adminNavigationItems: AdminNavigationItem[] = [
|
||||
{ path: ADMIN_HOME_PATH, iconKey: 'home', label: '首页', permissionCode: '' },
|
||||
{ path: ADMIN_DASHBOARD_PATH, iconKey: 'dashboard', label: '仪表盘', permissionCode: 'dashboard:view' },
|
||||
{ path: '/admin/users', iconKey: 'user', label: '用户管理', permissionCode: 'user:view' },
|
||||
{ path: '/admin/users', iconKey: 'user', label: '店长账号', permissionCode: 'user:view' },
|
||||
{ path: '/admin/shops', iconKey: 'home', label: '店铺管理', permissionCode: 'shop:view' },
|
||||
{ path: '/admin/settings', iconKey: 'tool', label: '系统设置', permissionCode: 'messagehub:config:manage' },
|
||||
{ path: '/admin/profile', iconKey: 'user', label: '个人设置', permissionCode: '' }
|
||||
]
|
||||
|
||||
|
||||
@@ -8,12 +8,13 @@ import {
|
||||
} from '@/utils/admin-auth-bootstrap'
|
||||
|
||||
const pageNames = [
|
||||
['', 'HomeView', 'admin', undefined], ['dashboard', 'DashboardView', 'admin-dashboard', 'dashboard:view'],
|
||||
['', 'HomeView', 'admin', undefined],
|
||||
['users', 'UsersView', 'admin-users', 'user:view'], ['shops', 'ShopsView', 'admin-shops', 'shop:view'],
|
||||
['profile', 'ProfileView', 'admin-profile', undefined]
|
||||
['profile', 'ProfileView', 'admin-profile', undefined], ['settings', 'SystemSettingsView', 'admin-settings', 'messagehub:config:manage']
|
||||
] as const
|
||||
|
||||
const routes = [
|
||||
{ path: '/', redirect: '/admin' },
|
||||
{ path: '/admin/login', name: 'admin-login', component: () => import('../views/admin/AdminLoginView.vue'), meta: { requiresAuth: false, isAdmin: true, hideNav: true } },
|
||||
{
|
||||
path: '/admin', component: () => import('../views/admin/AdminLayout.vue'), meta: { requiresAuth: true, isAdmin: true, hideNav: true },
|
||||
@@ -21,7 +22,7 @@ const routes = [
|
||||
path, name, component: () => import(`../views/admin/${view}.vue`), meta: { requiresAuth: true, isAdmin: true, hideNav: true, permissionCode }
|
||||
}))
|
||||
},
|
||||
{ path: '/:pathMatch(.*)*', name: 'not-found', component: () => import('../views/NotFoundView.vue'), meta: { requiresAuth: false, isAdmin: true, hideNav: true } }
|
||||
{ path: '/:pathMatch(.*)*', name: 'not-found', component: () => import('../views/NotFoundView.vue'), meta: { requiresAuth: false, isAdmin: false, hideNav: true } }
|
||||
]
|
||||
|
||||
const router = createRouter({ history: createWebHistory(import.meta.env.BASE_URL), routes })
|
||||
|
||||
@@ -12,11 +12,11 @@
|
||||
<span class="not-found-kicker">{{ BRAND_CONFIG.appName }}</span>
|
||||
<div class="error-code">404</div>
|
||||
<h1>这页去做护理了</h1>
|
||||
<p>您访问的页面不存在或已被删除,我们带您回到首页继续浏览作品。</p>
|
||||
<p>您访问的页面不存在或已被删除,我们将在 5 秒后返回上一页。</p>
|
||||
<p class="redirect-message">
|
||||
将在 <span class="countdown">{{ countdown }}</span> 秒后自动跳转到首页...
|
||||
将在 <span class="countdown">{{ countdown }}</span> 秒后返回上一页...
|
||||
</p>
|
||||
<a-button type="primary" @click="redirectToHome">立即前往首页</a-button>
|
||||
<a-button type="primary" @click="handleBackClick">返回上一页</a-button>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
@@ -53,16 +53,20 @@ const handleBackClick = () => {
|
||||
router.back()
|
||||
return
|
||||
}
|
||||
router.push('/home')
|
||||
router.replace('/admin/login')
|
||||
}
|
||||
|
||||
/** redirectToHome is a local helper used by this page script. */
|
||||
const redirectToHome = () => {
|
||||
/** redirectToLogin 将无历史来源的访问导回管理端登录页。 */
|
||||
const redirectToLogin = () => {
|
||||
clearRedirectTimer()
|
||||
router.push('/home')
|
||||
router.replace('/admin/login')
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
if (window.history.length <= 1) {
|
||||
redirectToLogin()
|
||||
return
|
||||
}
|
||||
timer = window.setInterval(() => {
|
||||
if (countdown.value > 0) {
|
||||
countdown.value--
|
||||
@@ -70,7 +74,7 @@ onMounted(() => {
|
||||
if (timer) {
|
||||
clearInterval(timer)
|
||||
}
|
||||
redirectToHome()
|
||||
handleBackClick()
|
||||
}
|
||||
}, 1000)
|
||||
})
|
||||
|
||||
@@ -154,7 +154,6 @@
|
||||
import { computed, onBeforeUnmount, onMounted, ref } from 'vue'
|
||||
import { useRouter } from 'vue-router'
|
||||
import {
|
||||
DashboardOutlined,
|
||||
HomeOutlined,
|
||||
SafetyCertificateOutlined,
|
||||
UserOutlined
|
||||
@@ -231,16 +230,9 @@ const quickActions = computed(() => {
|
||||
return []
|
||||
}
|
||||
const actions = [
|
||||
{
|
||||
key: 'dashboard',
|
||||
title: '仪表盘',
|
||||
path: '/admin/dashboard',
|
||||
icon: DashboardOutlined,
|
||||
permissionCode: 'dashboard:view'
|
||||
},
|
||||
{
|
||||
key: 'users',
|
||||
title: '用户管理',
|
||||
title: '店长账号',
|
||||
path: '/admin/users',
|
||||
icon: UserOutlined,
|
||||
permissionCode: 'user:view'
|
||||
|
||||
@@ -103,7 +103,7 @@
|
||||
@change="(checked: any) => handleStatusChange(record, checked === true)"
|
||||
/>
|
||||
</template>
|
||||
<template v-else-if="column.key === 'authorization'">
|
||||
<template v-else-if="column.key === 'authorization' && false">
|
||||
<a-space direction="vertical" size="small">
|
||||
<a-tag :color="record.authorizationExpired ? 'red' : 'green'">
|
||||
{{ record.authorizationStatusText || (record.authorizationExpired ? '已到期' : '有效') }}
|
||||
@@ -262,7 +262,7 @@
|
||||
/>
|
||||
</div>
|
||||
</a-form-item>
|
||||
<a-form-item label="授权起始日" name="authorizationStartDate">
|
||||
<a-form-item v-if="false" label="授权起始日" name="authorizationStartDate">
|
||||
<a-date-picker
|
||||
v-model:value="formState.authorizationStartDate"
|
||||
value-format="YYYY-MM-DD"
|
||||
@@ -272,7 +272,7 @@
|
||||
style="width: 100%"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item label="有效期天数" name="authorizationDays">
|
||||
<a-form-item v-if="false" label="有效期天数" name="authorizationDays">
|
||||
<a-input-number
|
||||
v-model:value="formState.authorizationDays"
|
||||
:min="1"
|
||||
@@ -282,7 +282,7 @@
|
||||
style="width: 100%"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item label="到期时间">
|
||||
<a-form-item v-if="false" label="到期时间">
|
||||
<a-input :value="computedAuthorizationExpireTimeText" disabled />
|
||||
</a-form-item>
|
||||
<a-form-item label="Banner图片">
|
||||
@@ -327,7 +327,7 @@
|
||||
<img alt="预览" style="width: 100%" :src="previewImage" />
|
||||
</a-modal>
|
||||
</a-form-item>
|
||||
<div class="theme-section">
|
||||
<div v-if="false" class="theme-section">
|
||||
<div class="theme-section__header">
|
||||
<div>
|
||||
<div class="theme-section__title">前台主题</div>
|
||||
@@ -500,19 +500,19 @@
|
||||
<a-form-item label="营业时间">
|
||||
<a-input v-model:value="viewFormState.businessHours" :disabled="true" />
|
||||
</a-form-item>
|
||||
<a-form-item label="授权状态">
|
||||
<a-form-item v-if="false" label="授权状态">
|
||||
<a-input :value="viewFormState.authorizationStatusText || '有效'" :disabled="true" />
|
||||
</a-form-item>
|
||||
<a-form-item label="授权起始日">
|
||||
<a-form-item v-if="false" label="授权起始日">
|
||||
<a-input :value="viewFormState.authorizationStartDate || '长期有效'" :disabled="true" />
|
||||
</a-form-item>
|
||||
<a-form-item label="有效期天数">
|
||||
<a-form-item v-if="false" label="有效期天数">
|
||||
<a-input :value="viewFormState.authorizationDays ? `${viewFormState.authorizationDays} 天` : '长期有效'" :disabled="true" />
|
||||
</a-form-item>
|
||||
<a-form-item label="授权有效期">
|
||||
<a-form-item v-if="false" label="授权有效期">
|
||||
<a-input :value="formatAuthorizationExpireTime(viewFormState.authorizationExpireTime)" :disabled="true" />
|
||||
</a-form-item>
|
||||
<a-form-item label="前台主题">
|
||||
<a-form-item v-if="false" label="前台主题">
|
||||
<div class="theme-view-swatches">
|
||||
<span :style="{ background: viewThemePreview.primaryColor }"></span>
|
||||
<span :style="{ background: viewThemePreview.secondaryColor }"></span>
|
||||
@@ -1241,7 +1241,6 @@ const columns = [
|
||||
{ title: '店铺地址', dataIndex: 'address', key: 'address' },
|
||||
{ title: '营业时间', dataIndex: 'businessHours', key: 'businessHours' },
|
||||
{ title: '状态', key: 'status', width: 120 },
|
||||
{ title: '授权', key: 'authorization', width: 180 },
|
||||
{ title: '创建时间', dataIndex: 'createTime', key: 'createTime' },
|
||||
{ title: '操作', key: 'actions', width: 150, fixed: 'right' as const }
|
||||
]
|
||||
|
||||
@@ -0,0 +1,95 @@
|
||||
<template>
|
||||
<div class="system-settings">
|
||||
<a-page-header title="系统设置" sub-title="管理店长账号默认密码" />
|
||||
<a-card title="店长默认密码" :loading="loading">
|
||||
<a-alert
|
||||
message="用于新增或重置店长账号"
|
||||
description="店长未设置密码时,以及管理员执行重置密码时,系统会使用这里配置的默认密码。修改后只对后续新增或重置生效。"
|
||||
show-icon
|
||||
type="info"
|
||||
/>
|
||||
<a-form class="settings-form" layout="vertical" @submit.prevent="save">
|
||||
<a-form-item label="默认密码">
|
||||
<a-input-password v-model:value="form.configValue" autocomplete="new-password" placeholder="请输入默认密码" />
|
||||
</a-form-item>
|
||||
<a-form-item label="状态">
|
||||
<a-switch v-model:checked="enabled" checked-children="启用" un-checked-children="停用" />
|
||||
</a-form-item>
|
||||
<a-button type="primary" :loading="saving" @click="save">保存默认密码</a-button>
|
||||
</a-form>
|
||||
</a-card>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { onMounted, reactive, ref } from 'vue'
|
||||
import { message } from 'ant-design-vue'
|
||||
import { adminSystemParameterConfigApi, type SystemParameterConfigVO } from '@/api/admin'
|
||||
|
||||
const loading = ref(false)
|
||||
const saving = ref(false)
|
||||
const enabled = ref(true)
|
||||
const form = reactive<SystemParameterConfigVO>({
|
||||
configGroup: 'USER',
|
||||
configKey: 'DEFAULT_PASSWORD',
|
||||
configName: '店长默认密码',
|
||||
configValue: 'Fingertip@123',
|
||||
enabled: 1,
|
||||
remark: '新增或重置店长账号时使用的默认密码'
|
||||
})
|
||||
|
||||
const load = async () => {
|
||||
loading.value = true
|
||||
try {
|
||||
const configs = await adminSystemParameterConfigApi.listConfigs('USER')
|
||||
const config = configs.find(item => item.configKey === 'DEFAULT_PASSWORD')
|
||||
if (config) {
|
||||
Object.assign(form, config)
|
||||
enabled.value = config.enabled === 1
|
||||
}
|
||||
} catch (error) {
|
||||
message.error(error instanceof Error ? error.message : '默认密码加载失败')
|
||||
} finally {
|
||||
loading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
const save = async () => {
|
||||
const password = form.configValue.trim()
|
||||
if (password.length < 8 || password.length > 32) {
|
||||
message.warning('默认密码长度需为 8-32 位')
|
||||
return
|
||||
}
|
||||
const categoryCount = [/[0-9]/.test(password), /[a-z]/.test(password), /[A-Z]/.test(password), /[^A-Za-z0-9]/.test(password)].filter(Boolean).length
|
||||
if (categoryCount < 3) {
|
||||
message.warning('默认密码需至少包含数字、小写字母、大写字母、特殊符号中的 3 类')
|
||||
return
|
||||
}
|
||||
saving.value = true
|
||||
try {
|
||||
await adminSystemParameterConfigApi.saveConfig({ ...form, configValue: password, enabled: enabled.value ? 1 : 0 })
|
||||
message.success('默认密码已保存')
|
||||
await load()
|
||||
} catch (error) {
|
||||
message.error(error instanceof Error ? error.message : '默认密码保存失败')
|
||||
} finally {
|
||||
saving.value = false
|
||||
}
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
void load()
|
||||
})
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.system-settings {
|
||||
display: grid;
|
||||
gap: 18px;
|
||||
}
|
||||
|
||||
.settings-form {
|
||||
max-width: 560px;
|
||||
margin-top: 24px;
|
||||
}
|
||||
</style>
|
||||
@@ -1,10 +1,10 @@
|
||||
<template>
|
||||
<div class="users">
|
||||
<a-page-header v-if="!isMobile" title="用户管理" sub-title="管理系统用户" />
|
||||
<a-page-header v-if="!isMobile" title="店长账号" sub-title="管理店长账号及店铺授权" />
|
||||
|
||||
<section v-else class="admin-page-intro">
|
||||
<span class="admin-page-intro__eyebrow">经营</span>
|
||||
<h1 class="admin-page-intro__title">用户管理</h1>
|
||||
<h1 class="admin-page-intro__title">店长账号</h1>
|
||||
<div class="admin-page-intro__meta">
|
||||
<span class="admin-page-chip">用户 {{ userList.length }}</span>
|
||||
</div>
|
||||
@@ -12,7 +12,7 @@
|
||||
|
||||
<a-card :bordered="false">
|
||||
<template #title v-if="isMobile">
|
||||
用户列表
|
||||
店长账号列表
|
||||
</template>
|
||||
<template #extra>
|
||||
<div class="admin-toolbar" :class="{ 'admin-toolbar--stacked': isMobile }">
|
||||
@@ -26,7 +26,7 @@
|
||||
<template #icon>
|
||||
<PlusOutlined />
|
||||
</template>
|
||||
新增用户
|
||||
新增店长
|
||||
</a-button>
|
||||
</div>
|
||||
</template>
|
||||
@@ -49,12 +49,6 @@
|
||||
{{ shop.shopName }}
|
||||
</a-select-option>
|
||||
</a-select>
|
||||
<a-select v-model:value="typeFilter" allow-clear placeholder="用户类型" style="width: 140px" @change="handleSearch">
|
||||
<a-select-option :value="0">普通用户</a-select-option>
|
||||
<a-select-option :value="2">店长</a-select-option>
|
||||
<a-select-option :value="3">美甲师</a-select-option>
|
||||
<a-select-option :value="4">管理员</a-select-option>
|
||||
</a-select>
|
||||
<a-select v-model:value="vipLevelFilter" allow-clear placeholder="VIP等级" style="width: 140px" @change="handleSearch">
|
||||
<a-select-option v-for="level in vipLevelOptions" :key="level" :value="level">{{ level }}</a-select-option>
|
||||
</a-select>
|
||||
@@ -206,7 +200,7 @@
|
||||
|
||||
<AdminResponsiveModal
|
||||
v-model:open="modalVisible"
|
||||
:title="isEdit ? '编辑用户' : '新增用户'"
|
||||
:title="isEdit ? '编辑店长' : '新增店长'"
|
||||
:confirm-loading="modalLoading"
|
||||
@ok="handleModalOk"
|
||||
@cancel="handleModalCancel"
|
||||
@@ -285,7 +279,7 @@
|
||||
v-if="!isEdit"
|
||||
label="密码"
|
||||
name="password"
|
||||
extra="留空则使用参数管理中配置的后台新增用户默认密码"
|
||||
extra="留空则使用参数管理中配置的店长默认密码"
|
||||
>
|
||||
<a-input-password
|
||||
v-model:value="formState.password"
|
||||
@@ -314,7 +308,7 @@
|
||||
</a-select-option>
|
||||
</a-select>
|
||||
</a-form-item>
|
||||
<a-form-item label="用户类型" name="type">
|
||||
<a-form-item label="用户类型" name="type" style="display: none">
|
||||
<a-select v-model:value="formState.type" placeholder="请选择用户类型">
|
||||
<a-select-option
|
||||
v-for="option in availableUserTypeOptions"
|
||||
@@ -537,7 +531,7 @@
|
||||
|
||||
<AdminMobileFab
|
||||
:visible="isMobile && canCreateUser && !modalVisible && !viewModalVisible && !assetModalVisible"
|
||||
label="新增用户"
|
||||
label="新增店长"
|
||||
@click="showAddModal"
|
||||
/>
|
||||
</div>
|
||||
@@ -645,6 +639,19 @@ const showDefaultPasswordCreateNotice = async () => {
|
||||
})
|
||||
}
|
||||
|
||||
const showDefaultPasswordResetNotice = async () => {
|
||||
const password = await resolveAdminDefaultPasswordForNotice()
|
||||
Modal.success({
|
||||
title: '密码重置成功',
|
||||
content: h('div', { class: 'default-password-notice' }, [
|
||||
h('p', '该用户的密码已重置为后台默认密码,请及时告知用户并提醒首次登录后修改。'),
|
||||
h('div', { class: 'default-password-notice__value' }, password)
|
||||
]),
|
||||
okText: '一键复制密码',
|
||||
onOk: () => copyTextToClipboard(password)
|
||||
})
|
||||
}
|
||||
|
||||
/** normalizeUserType is a local helper used by this page script. */
|
||||
const normalizeUserType = (value: unknown) => {
|
||||
const type = Number(value)
|
||||
@@ -674,7 +681,7 @@ const shopFilter = ref<string | undefined>()
|
||||
* Purpose: typeFilter supports UsersView.vue by holding or executing the type filter page or API role.
|
||||
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
|
||||
*/
|
||||
const typeFilter = ref<number | undefined>()
|
||||
const typeFilter = ref<number | undefined>(2)
|
||||
/**
|
||||
* Purpose: vipLevelFilter supports UsersView.vue by holding or executing the vip level filter page or API role.
|
||||
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
|
||||
@@ -862,7 +869,7 @@ const formState = reactive({
|
||||
wechatId: '',
|
||||
wechatQrCode: '',
|
||||
password: '',
|
||||
type: 0,
|
||||
type: 2,
|
||||
shopIds: [] as string[]
|
||||
})
|
||||
|
||||
@@ -1369,7 +1376,7 @@ const fetchUserList = async () => {
|
||||
const resetFilters = () => {
|
||||
searchText.value = ''
|
||||
shopFilter.value = currentUserType.value !== 4 ? normalizeShopId(currentUserInfo?.shopId) : undefined
|
||||
typeFilter.value = undefined
|
||||
typeFilter.value = 2
|
||||
vipLevelFilter.value = undefined
|
||||
statusFilter.value = undefined
|
||||
createdRange.value = undefined
|
||||
@@ -1380,10 +1387,6 @@ const resetFilters = () => {
|
||||
|
||||
/** resetFormState is a local helper used by this page script. */
|
||||
const resetFormState = () => {
|
||||
const defaultUserType = currentUserType.value === 4 && shopList.value.length === 0
|
||||
? availableUserTypeOptions.value.find(option => option.value === 4)?.value
|
||||
: availableUserTypeOptions.value[0]?.value
|
||||
|
||||
Object.assign(formState, {
|
||||
account: '',
|
||||
nickname: '',
|
||||
@@ -1393,7 +1396,7 @@ const resetFormState = () => {
|
||||
wechatId: '',
|
||||
wechatQrCode: '',
|
||||
password: '',
|
||||
type: defaultUserType ?? 0,
|
||||
type: 2,
|
||||
shopIds: currentUserType.value !== 4 && currentUserInfo?.shopId
|
||||
? [normalizeShopId(currentUserInfo.shopId)!]
|
||||
: []
|
||||
@@ -1646,7 +1649,7 @@ const handleResetPassword = (record: any) => {
|
||||
try {
|
||||
await runWithGlobalLoading(async () => {
|
||||
await adminUserApi.resetPassword(record.id)
|
||||
message.success('密码重置成功')
|
||||
await showDefaultPasswordResetNotice()
|
||||
})
|
||||
} catch (error) {
|
||||
console.error('重置密码失败:', error)
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
const employeesApi = require('../../api/employees')
|
||||
const planningApi = require('../../api/planning')
|
||||
const dateUtil = require('../../utils/date')
|
||||
const { chooseImageFilePath, uploadObjectFile } = require('../../utils/upload')
|
||||
|
||||
const EMPLOYEE_COLORS = ['#7AA9C2', '#8EB99B', '#BDA7D8', '#D7B17D', '#D98D8D']
|
||||
@@ -34,8 +36,14 @@ Page({
|
||||
|
||||
async loadEmployees() {
|
||||
try {
|
||||
const data = await employeesApi.list({ page: 1, size: 50 })
|
||||
const today = dateUtil.formatDate(new Date())
|
||||
const [data, calendar] = await Promise.all([
|
||||
employeesApi.list({ page: 1, size: 50 }),
|
||||
planningApi.calendar({ startDate: today, endDate: today })
|
||||
])
|
||||
const list = data.list || data || []
|
||||
const appointments = calendar.appointments || []
|
||||
const artists = calendar.artists || []
|
||||
this.setData({
|
||||
loadError: '',
|
||||
employees: list.map((item, index) => ({
|
||||
@@ -46,7 +54,18 @@ Page({
|
||||
color: EMPLOYEE_COLORS[index % EMPLOYEE_COLORS.length],
|
||||
monthOrders: item.monthOrders || item.orderCount || 0,
|
||||
monthAmount: item.monthAmount || item.turnover || 0,
|
||||
scheduleSummary: buildScheduleSummary(item)
|
||||
scheduleSummary: buildScheduleSummary(item),
|
||||
todaySchedule: (() => {
|
||||
const artist = artists.find(entry => String(entry.id) === String(item.userId || item.id))
|
||||
return artist && artist.workStartTime && artist.workEndTime
|
||||
? `${artist.workStartTime.slice(0, 5)}-${artist.workEndTime.slice(0, 5)}`
|
||||
: '今日未排班'
|
||||
})(),
|
||||
todayAvailable: (() => {
|
||||
const artist = artists.find(entry => String(entry.id) === String(item.userId || item.id))
|
||||
return !!artist && Number(artist.status) !== 0
|
||||
})(),
|
||||
todayOrders: appointments.filter(entry => String(entry.artistId) === String(item.userId || item.id)).length
|
||||
}))
|
||||
})
|
||||
} catch (error) {
|
||||
|
||||
@@ -18,8 +18,8 @@
|
||||
<view wx:else class="avatar" style="background: {{item.color}};">{{item.shortName}}</view>
|
||||
<view>
|
||||
<text class="employee-name">{{item.name}}</text>
|
||||
<text class="employee-schedule">{{item.scheduleSummary}}</text>
|
||||
<text class="employee-meta">本月 {{item.monthOrders}} 单 · ¥{{item.monthAmount}}</text>
|
||||
<text class="employee-schedule">{{item.todaySchedule}} · {{item.todayAvailable ? '可预约' : '休息中'}}</text>
|
||||
<text class="employee-meta">今日 {{item.todayOrders}} 单 · 本月 {{item.monthOrders}} 单</text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="color-pill" style="background: {{item.color}};"></view>
|
||||
|
||||
@@ -320,6 +320,10 @@ Page({
|
||||
|
||||
async openLoginShopSelector() {
|
||||
const shopOptions = await this.loadLoginShopOptions()
|
||||
if (shopOptions.length === 1) {
|
||||
await this.loginWithSelectedShop(shopOptions[0].id)
|
||||
return
|
||||
}
|
||||
this.setData({
|
||||
shopOptions,
|
||||
shopSelectVisible: true,
|
||||
@@ -436,7 +440,7 @@ Page({
|
||||
this.saveLoginPreference()
|
||||
wx.reLaunch({ url: '/pages/planning/index' })
|
||||
} catch (error) {
|
||||
if (isShopSelectionRequiredError(error) || await this.tryOpenLoginShopSelector()) {
|
||||
if (isShopSelectionRequiredError(error)) {
|
||||
try {
|
||||
if (!this.data.shopSelectVisible) {
|
||||
await this.openLoginShopSelector()
|
||||
|
||||
@@ -418,5 +418,48 @@ Page({
|
||||
wx.navigateTo({
|
||||
url: `/pages/appointment-detail/index?id=${event.currentTarget.dataset.id}`
|
||||
})
|
||||
},
|
||||
|
||||
stopTap() {
|
||||
},
|
||||
|
||||
async quickUpdateStatus(event) {
|
||||
const appointment = this.data.appointments.find(item => String(item.orderItemId) === String(event.currentTarget.dataset.id))
|
||||
if (!appointment) return
|
||||
try {
|
||||
await planningApi.updateStatus(appointment.orderId, Number(event.currentTarget.dataset.status))
|
||||
wx.showToast({ title: '预约已确认', icon: 'success' })
|
||||
this.loadCalendar()
|
||||
} catch (error) {
|
||||
wx.showToast({ title: error.message || '预约状态更新失败', icon: 'none' })
|
||||
}
|
||||
},
|
||||
|
||||
quickTransfer(event) {
|
||||
wx.navigateTo({ url: `/pages/artist-transfer/index?id=${event.currentTarget.dataset.id}` })
|
||||
},
|
||||
|
||||
quickCancel(event) {
|
||||
const appointment = this.data.appointments.find(item => String(item.orderItemId) === String(event.currentTarget.dataset.id))
|
||||
if (!appointment) return
|
||||
wx.showModal({
|
||||
title: '取消预约',
|
||||
content: '确定取消这条预约吗?',
|
||||
success: result => {
|
||||
if (result.confirm) {
|
||||
this.updateAppointmentStatus(appointment.orderId, 3)
|
||||
}
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
async updateAppointmentStatus(orderId, status) {
|
||||
try {
|
||||
await planningApi.updateStatus(orderId, status)
|
||||
wx.showToast({ title: '预约已取消', icon: 'success' })
|
||||
this.loadCalendar()
|
||||
} catch (error) {
|
||||
wx.showToast({ title: error.message || '预约取消失败', icon: 'none' })
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
@@ -67,6 +67,11 @@
|
||||
<text class="block-title">{{block.customerName}}</text>
|
||||
<text class="block-meta">{{block.timeText}} · {{block.productTitle}}</text>
|
||||
<text class="block-status">{{block.statusText}}</text>
|
||||
<view class="block-actions" catchtap="stopTap">
|
||||
<text wx:if="{{block.status === 0}}" data-id="{{block.orderItemId}}" data-status="1" catchtap="quickUpdateStatus">确认</text>
|
||||
<text data-id="{{block.orderItemId}}" catchtap="quickTransfer">改派</text>
|
||||
<text data-id="{{block.orderItemId}}" catchtap="quickCancel">取消</text>
|
||||
</view>
|
||||
</view>
|
||||
<view wx:if="{{item.blocks.length === 0}}" class="lane-empty">全天可约</view>
|
||||
</view>
|
||||
|
||||
@@ -320,6 +320,19 @@
|
||||
line-height: 1.25;
|
||||
}
|
||||
|
||||
.block-actions {
|
||||
display: flex;
|
||||
gap: 10rpx;
|
||||
margin-top: 6rpx;
|
||||
color: #2f6f62;
|
||||
font-size: 20rpx;
|
||||
font-weight: 800;
|
||||
}
|
||||
|
||||
.block-actions text {
|
||||
padding: 2rpx 6rpx;
|
||||
}
|
||||
|
||||
.lane-empty {
|
||||
position: absolute;
|
||||
top: 76rpx;
|
||||
|
||||
@@ -2,6 +2,10 @@ const { BRAND_CONFIG } = require('../../utils/config')
|
||||
const userApi = require('../../api/user')
|
||||
const auth = require('../../utils/auth')
|
||||
const { chooseImageFilePath, uploadProfileImage } = require('../../utils/upload')
|
||||
const planningApi = require('../../api/planning')
|
||||
const employeesApi = require('../../api/employees')
|
||||
const shopApi = require('../../api/shop')
|
||||
const dateUtil = require('../../utils/date')
|
||||
|
||||
function resolveRoleText(type) {
|
||||
const role = Number(type)
|
||||
@@ -27,6 +31,17 @@ Page({
|
||||
wechatId: '',
|
||||
signature: ''
|
||||
},
|
||||
overviewLoading: false,
|
||||
overview: {
|
||||
date: '',
|
||||
todayAppointments: 0,
|
||||
pendingAppointments: 0,
|
||||
upcomingAppointments: 0,
|
||||
availableEmployees: 0,
|
||||
scheduleExceptions: 0,
|
||||
shopOpen: true,
|
||||
shopStatus: '营业中'
|
||||
},
|
||||
menus: [
|
||||
{ title: '个人信息', action: 'editProfile' },
|
||||
{ title: '店铺设置', url: '/pages/shop-settings/index' },
|
||||
@@ -39,6 +54,56 @@ Page({
|
||||
onShow() {
|
||||
this.refreshFromSession()
|
||||
this.loadProfile()
|
||||
this.loadOverview()
|
||||
},
|
||||
|
||||
async loadOverview() {
|
||||
const today = dateUtil.formatDate(new Date())
|
||||
this.setData({ overviewLoading: true })
|
||||
try {
|
||||
const [calendar, shop] = await Promise.all([
|
||||
planningApi.calendar({ startDate: today, endDate: today }),
|
||||
shopApi.settings()
|
||||
])
|
||||
const appointments = Array.isArray(calendar.appointments) ? calendar.appointments : []
|
||||
const now = Date.now()
|
||||
const upcomingAppointments = appointments.filter(item => {
|
||||
const appointmentTime = new Date(String(item.appointmentTime || item.startTime || '').replace(/-/g, '/')).getTime()
|
||||
return Number.isFinite(appointmentTime) && appointmentTime >= now
|
||||
}).length
|
||||
const artists = Array.isArray(calendar.artists) ? calendar.artists : []
|
||||
const scheduleRules = await Promise.all(artists.map(artist => employeesApi.scheduleRule({ artistId: artist.id })))
|
||||
const scheduleExceptions = scheduleRules.reduce((total, setting) => {
|
||||
const exceptions = Array.isArray(setting && setting.exceptions) ? setting.exceptions : []
|
||||
return total + exceptions.filter(item => item.workDate === today).length
|
||||
}, 0)
|
||||
const shopOpen = Number(shop && shop.status) !== 0
|
||||
this.setData({
|
||||
overview: {
|
||||
date: `${today.slice(5, 7)}月${today.slice(8, 10)}日`,
|
||||
todayAppointments: appointments.length,
|
||||
pendingAppointments: appointments.filter(item => Number(item.status) === 0).length,
|
||||
upcomingAppointments,
|
||||
availableEmployees: artists.filter(item => Number(item.status) !== 0).length,
|
||||
scheduleExceptions,
|
||||
shopOpen,
|
||||
shopStatus: shopOpen ? '营业中' : '已暂停'
|
||||
}
|
||||
})
|
||||
} catch (error) {
|
||||
wx.showToast({ title: error.message || '今日概览加载失败', icon: 'none' })
|
||||
} finally {
|
||||
this.setData({ overviewLoading: false })
|
||||
}
|
||||
},
|
||||
|
||||
goOverviewAction(event) {
|
||||
const action = event.currentTarget.dataset.action
|
||||
if (action === 'scheduleExceptions') {
|
||||
wx.navigateTo({ url: '/pages/leave-management/index' })
|
||||
return
|
||||
}
|
||||
wx.switchTab({ url: '/pages/planning/index' })
|
||||
},
|
||||
|
||||
refreshFromSession() {
|
||||
|
||||
@@ -10,6 +10,41 @@
|
||||
<text class="role-badge">{{roleText}}</text>
|
||||
</view>
|
||||
|
||||
<view class="card overview-card">
|
||||
<view class="overview-head">
|
||||
<text class="overview-title">店铺今日概览</text>
|
||||
<text class="overview-date">{{overview.date}}</text>
|
||||
</view>
|
||||
<view wx:if="{{overviewLoading}}" class="overview-loading">正在加载今日数据...</view>
|
||||
<view wx:else class="overview-grid">
|
||||
<view class="overview-item" data-action="todayAppointments" bindtap="goOverviewAction">
|
||||
<text class="overview-value">{{overview.todayAppointments}}</text>
|
||||
<text class="overview-label">今日预约</text>
|
||||
</view>
|
||||
<view class="overview-item overview-item--warning" data-action="pendingAppointments" bindtap="goOverviewAction">
|
||||
<text class="overview-value">{{overview.pendingAppointments}}</text>
|
||||
<text class="overview-label">待确认预约</text>
|
||||
</view>
|
||||
<view class="overview-item" data-action="upcomingAppointments" bindtap="goOverviewAction">
|
||||
<text class="overview-value">{{overview.upcomingAppointments}}</text>
|
||||
<text class="overview-label">即将开始</text>
|
||||
</view>
|
||||
<view class="overview-item">
|
||||
<text class="overview-value">{{overview.availableEmployees}}</text>
|
||||
<text class="overview-label">今日可预约员工</text>
|
||||
</view>
|
||||
<view class="overview-item overview-item--warning" data-action="scheduleExceptions" bindtap="goOverviewAction">
|
||||
<text class="overview-value">{{overview.scheduleExceptions}}</text>
|
||||
<text class="overview-label">请假/调班待处理</text>
|
||||
</view>
|
||||
<view class="overview-item overview-item--status">
|
||||
<view class="status-dot {{overview.shopOpen ? 'is-open' : 'is-closed'}}"></view>
|
||||
<text class="overview-status">{{overview.shopStatus}}</text>
|
||||
<text class="overview-label">店铺当前状态</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="section menu-list card">
|
||||
<view wx:for="{{menus}}" wx:key="title" class="menu-row" data-url="{{item.url}}" data-action="{{item.action}}" bindtap="go">
|
||||
<text>{{item.title}}</text>
|
||||
|
||||
@@ -61,6 +61,92 @@
|
||||
line-height: 1.2;
|
||||
}
|
||||
|
||||
.overview-card {
|
||||
margin-top: 20rpx;
|
||||
padding: 24rpx;
|
||||
}
|
||||
|
||||
.overview-head {
|
||||
display: flex;
|
||||
align-items: baseline;
|
||||
justify-content: space-between;
|
||||
margin-bottom: 20rpx;
|
||||
}
|
||||
|
||||
.overview-title {
|
||||
color: #302c27;
|
||||
font-size: 28rpx;
|
||||
font-weight: 900;
|
||||
}
|
||||
|
||||
.overview-date,
|
||||
.overview-loading {
|
||||
color: #91897f;
|
||||
font-size: 22rpx;
|
||||
}
|
||||
|
||||
.overview-loading {
|
||||
padding: 28rpx 0;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.overview-grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(3, 1fr);
|
||||
gap: 12rpx;
|
||||
}
|
||||
|
||||
.overview-item {
|
||||
display: flex;
|
||||
min-height: 112rpx;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
flex-direction: column;
|
||||
border-radius: 16rpx;
|
||||
background: #f8f3ec;
|
||||
}
|
||||
|
||||
.overview-item--warning {
|
||||
background: #fff3e7;
|
||||
}
|
||||
|
||||
.overview-item--status {
|
||||
gap: 5rpx;
|
||||
}
|
||||
|
||||
.overview-value {
|
||||
color: #2f6f62;
|
||||
font-size: 38rpx;
|
||||
font-weight: 900;
|
||||
line-height: 1;
|
||||
}
|
||||
|
||||
.overview-label,
|
||||
.overview-status {
|
||||
margin-top: 10rpx;
|
||||
color: #756b62;
|
||||
font-size: 21rpx;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.overview-status {
|
||||
margin-top: 0;
|
||||
color: #2f6f62;
|
||||
font-size: 27rpx;
|
||||
font-weight: 800;
|
||||
}
|
||||
|
||||
.status-dot {
|
||||
width: 18rpx;
|
||||
height: 18rpx;
|
||||
border-radius: 50%;
|
||||
background: #c4bdb5;
|
||||
}
|
||||
|
||||
.status-dot.is-open {
|
||||
background: #55a27f;
|
||||
}
|
||||
|
||||
.menu-list {
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
@@ -237,7 +237,8 @@ Page({
|
||||
wx.showToast({ title: '排班规则已保存', icon: 'success' })
|
||||
await this.loadRule()
|
||||
} catch (error) {
|
||||
wx.showToast({ title: error.message || '保存失败', icon: 'none' })
|
||||
const message = error.message || '保存失败'
|
||||
wx.showModal({ title: '排班保存失败', content: message, showCancel: false, confirmText: '知道了' })
|
||||
} finally {
|
||||
this.setData({ saving: false })
|
||||
}
|
||||
@@ -267,7 +268,8 @@ Page({
|
||||
wx.showToast({ title: '例外已保存', icon: 'success' })
|
||||
await this.loadRule()
|
||||
} catch (error) {
|
||||
wx.showToast({ title: error.message || '例外保存失败', icon: 'none' })
|
||||
const message = error.message || '例外保存失败'
|
||||
wx.showModal({ title: '特殊日期保存失败', content: message, showCancel: false, confirmText: '知道了' })
|
||||
} finally {
|
||||
this.setData({ saving: false })
|
||||
}
|
||||
|
||||
@@ -127,12 +127,12 @@ const DEFAULT_DOMAINS = {
|
||||
local: 'http://127.0.0.1:80',
|
||||
tunnel: 'http://wcy111.top:18888',
|
||||
'dev-remote': 'http://wcy111.top:18888',
|
||||
trial: 'https://yunail.art',
|
||||
trial: 'https://sit.yunail.art',
|
||||
release: 'https://yunail.art'
|
||||
}
|
||||
|
||||
const DOMAIN_MAP = mergeDomains(DEFAULT_DOMAINS, localOverride.domains)
|
||||
const DEFAULT_DEVELOP_TARGET = IS_DEVTOOLS ? 'local' : 'dev-remote'
|
||||
const DEFAULT_DEVELOP_TARGET = 'local'
|
||||
const DEVELOP_TARGET = Object.prototype.hasOwnProperty.call(localOverride, 'developTarget')
|
||||
? String(localOverride.developTarget)
|
||||
: DEFAULT_DEVELOP_TARGET
|
||||
|
||||
@@ -12,7 +12,7 @@ module.exports = {
|
||||
local: 'http://127.0.0.1:80',
|
||||
tunnel: 'http://dev.yunail.art:18888',
|
||||
'dev-remote': 'http://dev.yunail.art:18888',
|
||||
trial: 'https://yunail.art',
|
||||
trial: 'https://sit.yunail.art',
|
||||
release: 'https://yunail.art'
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
# Salon Core 接入 MessageHub 标准 MQ
|
||||
|
||||
## 运行时配置
|
||||
|
||||
在 SIT 或生产 Core 服务的 systemd 环境文件中配置以下非敏感项,并通过安全的运行时变量注入访问 Token:
|
||||
|
||||
```text
|
||||
MESSAGEHUB_BASE_URL=http://<MessageHub地址>:8080
|
||||
MESSAGEHUB_ACCESS_TOKEN=<仅运行时注入,不写入仓库>
|
||||
MESSAGEHUB_INGRESS_EXCHANGE=messagehub.ingress.exchange
|
||||
MESSAGEHUB_INGRESS_ROUTING_KEY=message.send
|
||||
MESSAGEHUB_SOURCE_SYSTEM=jayucloud-salon
|
||||
```
|
||||
|
||||
SIT 的 `core.yaml` 已将上述变量映射为 `messagehub.client.*` 配置项;Gitea Secret 名称为 `MESSAGEHUB_SIT_ACCESS_TOKEN`,工作流会把它写入 Core 专用的 `/etc/sysconfig/jc-salon-messagehub`,不写入仓库或 Nacos。短信发送流程先调用 `/api/v1/messages/ids` 预留消息 ID,再向 RabbitMQ ingress 交换机投递,并在 AMQP Header 中携带 `X-MessageHub-Access-Token`。
|
||||
|
||||
## 验证
|
||||
|
||||
验证时检查 Core 日志中仅出现场景、手机号、交换机和模板编码,不得输出 Token;再通过 MessageHub 状态接口确认消息进入 `ACCEPTED` 或后续成功状态。
|
||||
@@ -7,7 +7,7 @@
|
||||
- Core/Gateway:`192.168.10.106:22`,独立目录 `/opt/jc-salon-core-sit`、`/opt/jc-salon-gateway-sit`,服务名 `jc-salon-core-sit`、`jc-salon-gateway-sit`。
|
||||
- 前端:与生产共用阿里云入口服务器,独立目录 `/opt/jc-salon-frontend-sit`,域名 `sit.yunail.art`。
|
||||
- 前端构建阶段显式注入 `VITE_API_BASE_URL=https://sit.yunail.art/api` 和 `VITE_ADMIN_API_BASE_URL=https://sit.yunail.art/admin/api`,避免构建产物使用生产接口默认值。
|
||||
- SIT 中间件:Nacos `192.168.10.103:8848`、MySQL `192.168.10.102:3306`、Redis `192.168.10.101:6379`、RabbitMQ `192.168.10.104:5672`,由 SIT Nacos 配置注入。
|
||||
- SIT 中间件:Nacos `192.168.10.103:8848`、MySQL `192.168.10.102:3306`、Redis `192.168.10.101:6379`、RabbitMQ `192.168.10.104:5672`、MinIO `192.168.10.105:9000`,由 SIT Nacos 配置注入。
|
||||
- 工作流显式传入 `-AllowSitTarget`,仅允许 `Environment=sit` 的目标;生产工作流不传入该开关,仍拒绝非生产节点。
|
||||
|
||||
## 前置配置
|
||||
@@ -17,6 +17,13 @@
|
||||
3. Nginx 修改后执行 `nginx -t`,通过后再 reload。
|
||||
4. 首次部署前确认 `192.168.10.106` 已安装 Java 17、systemd 可用,且网络可访问 SIT Nacos、MySQL、Redis 和 RabbitMQ。
|
||||
|
||||
## 已确认的 SIT 前置条件
|
||||
|
||||
- 数据库 `jayucloud_salon` 已完成初始化;部署工作流继续跳过数据库执行。
|
||||
- RabbitMQ 已创建/更新业务用户 `xiaowang`,已授权 `/` 和 `/jayucloud-salon-sit`;业务 vhost 使用 `/jayucloud-salon-sit`。
|
||||
- MinIO 使用 `192.168.10.105:9000`;七牛 Kodo 和阿里云 OSS 沿用生产凭据与连接参数,SIT 使用带 `sit` 后缀的 Bucket。
|
||||
- RabbitMQ 密码、对象存储密钥和 Nacos 凭据仅通过受控环境或 Gitea Secrets 注入,不写入本文档。
|
||||
|
||||
## 验证
|
||||
|
||||
- 推送 `sit` 后确认工作流完成 Core/Gateway 健康检查和前端文件发布。
|
||||
|
||||
@@ -1,5 +1,12 @@
|
||||
# 项目变更记录
|
||||
|
||||
## 2026-09-04 SIT Salon 部署前置配置确认
|
||||
|
||||
- 已确认 SIT `jayucloud_salon` 数据库完成初始化,SIT 发布继续跳过数据库执行。
|
||||
- 已确认 SIT RabbitMQ 地址为 `192.168.10.104:5672`,业务 vhost 为 `/jayucloud-salon-sit`,用户为 `xiaowang`;密码不写入仓库。
|
||||
- 已确认 SIT MinIO 地址为 `192.168.10.105:9000`;七牛 Kodo、阿里云 OSS 沿用生产连接参数,Bucket 使用 SIT 后缀。
|
||||
- 修正两端 SIT Nacos 配置源的 MinIO 默认地址,避免后续配置发布覆盖运行时地址。
|
||||
|
||||
## 2026-08-28 修复 Salon 生产包 Maven 构建阻塞
|
||||
|
||||
- Maven 构建参数移除静默输出,保留批处理模式,流水线失败时会显示实际构建错误。
|
||||
|
||||
@@ -105,7 +105,7 @@ spring:
|
||||
fingertip-designer:
|
||||
security:
|
||||
jwt:
|
||||
issuer: fingertip-designer
|
||||
issuer: jayucloud-artlist
|
||||
clock-skew-seconds: 30
|
||||
gateway:
|
||||
whitelist:
|
||||
|
||||
@@ -129,7 +129,7 @@ spring:
|
||||
fingertip-designer:
|
||||
security:
|
||||
jwt:
|
||||
issuer: fingertip-designer
|
||||
issuer: jayucloud-salon
|
||||
clock-skew-seconds: 30
|
||||
gateway:
|
||||
whitelist:
|
||||
|
||||
@@ -105,7 +105,7 @@ spring:
|
||||
fingertip-designer:
|
||||
security:
|
||||
jwt:
|
||||
issuer: fingertip-designer
|
||||
issuer: jayucloud-artlist
|
||||
clock-skew-seconds: 30
|
||||
gateway:
|
||||
whitelist:
|
||||
|
||||
@@ -126,7 +126,7 @@ spring:
|
||||
fingertip-designer:
|
||||
security:
|
||||
jwt:
|
||||
issuer: fingertip-designer
|
||||
issuer: jayucloud-salon
|
||||
clock-skew-seconds: 30
|
||||
gateway:
|
||||
whitelist:
|
||||
|
||||
@@ -105,7 +105,7 @@ spring:
|
||||
fingertip-designer:
|
||||
security:
|
||||
jwt:
|
||||
issuer: fingertip-designer
|
||||
issuer: jayucloud-artlist
|
||||
clock-skew-seconds: 30
|
||||
gateway:
|
||||
whitelist:
|
||||
|
||||
@@ -32,7 +32,7 @@ object-storage:
|
||||
|
||||
minio:
|
||||
enabled: ${MINIO_ENABLED:true}
|
||||
endpoint: ${MINIO_ENDPOINT:http://192.168.5.15:9000}
|
||||
endpoint: ${MINIO_ENDPOINT:http://192.168.10.105:9000}
|
||||
bucket-name: ${MINIO_BUCKET_NAME:jayucloud-sit}
|
||||
access-key: ${MINIO_ACCESS_KEY}
|
||||
secret-key: ${MINIO_SECRET_KEY}
|
||||
|
||||
@@ -90,6 +90,14 @@ fingertip-designer:
|
||||
max-total-connections: 200
|
||||
max-connections-per-route: 50
|
||||
|
||||
messagehub:
|
||||
client:
|
||||
base-url: ${MESSAGEHUB_BASE_URL:http://192.168.10.107:8080}
|
||||
access-token: ${MESSAGEHUB_ACCESS_TOKEN:}
|
||||
ingress-exchange: ${MESSAGEHUB_INGRESS_EXCHANGE:messagehub.ingress.exchange}
|
||||
ingress-routing-key: ${MESSAGEHUB_INGRESS_ROUTING_KEY:message.send}
|
||||
source-system: ${MESSAGEHUB_SOURCE_SYSTEM:jayucloud-salon}
|
||||
|
||||
object-storage:
|
||||
provider-order:
|
||||
- MINIO
|
||||
|
||||
@@ -126,7 +126,7 @@ spring:
|
||||
fingertip-designer:
|
||||
security:
|
||||
jwt:
|
||||
issuer: fingertip-designer
|
||||
issuer: jayucloud-salon
|
||||
clock-skew-seconds: 30
|
||||
gateway:
|
||||
whitelist:
|
||||
|
||||
@@ -32,7 +32,7 @@ object-storage:
|
||||
|
||||
minio:
|
||||
enabled: ${MINIO_ENABLED:true}
|
||||
endpoint: ${MINIO_ENDPOINT:http://192.168.5.15:9000}
|
||||
endpoint: ${MINIO_ENDPOINT:http://192.168.10.105:9000}
|
||||
bucket-name: ${MINIO_BUCKET_NAME:jayucloud-sit}
|
||||
access-key: ${MINIO_ACCESS_KEY}
|
||||
secret-key: ${MINIO_SECRET_KEY}
|
||||
|
||||
Reference in New Issue
Block a user