From 4e9b8c8ede441a83bcf3c1849fb8bbd938693380 Mon Sep 17 00:00:00 2001 From: xiaowang <2161656029@qq.com> Date: Wed, 26 Aug 2026 18:06:49 +0800 Subject: [PATCH 01/19] =?UTF-8?q?=E4=BF=AE=E6=AD=A3=E5=BA=97=E5=8A=A1Core?= =?UTF-8?q?=E7=9A=84MyBatis=E6=89=AB=E6=8F=8F=E5=8C=85=E5=90=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../core/config/MyBatisPlusConfig.java | 32 ++-- .../src/main/resources/application.yaml | 138 ------------------ 2 files changed, 16 insertions(+), 154 deletions(-) delete mode 100644 JC-Salon-Core/src/main/resources/application.yaml diff --git a/JC-Salon-Core/src/main/java/com/xiaowang/jacyucloudsalon/core/config/MyBatisPlusConfig.java b/JC-Salon-Core/src/main/java/com/xiaowang/jacyucloudsalon/core/config/MyBatisPlusConfig.java index a8039495..70606e3b 100644 --- a/JC-Salon-Core/src/main/java/com/xiaowang/jacyucloudsalon/core/config/MyBatisPlusConfig.java +++ b/JC-Salon-Core/src/main/java/com/xiaowang/jacyucloudsalon/core/config/MyBatisPlusConfig.java @@ -20,22 +20,22 @@ import org.springframework.context.annotation.Configuration; */ @Configuration @MapperScan({ - "com.xiaowang.fingertipdesigner.core.modules.artist.mapper", - "com.xiaowang.fingertipdesigner.core.modules.auth.mapper", - "com.xiaowang.fingertipdesigner.core.modules.content.mapper", - "com.xiaowang.fingertipdesigner.core.modules.file.mapper", - "com.xiaowang.fingertipdesigner.core.modules.integration.mapper", - "com.xiaowang.fingertipdesigner.core.modules.inventory.mapper", - "com.xiaowang.fingertipdesigner.core.modules.marketing.mapper", - "com.xiaowang.fingertipdesigner.core.modules.message.mapper", - "com.xiaowang.fingertipdesigner.core.modules.order.mapper", - "com.xiaowang.fingertipdesigner.core.modules.payment.mapper", - "com.xiaowang.fingertipdesigner.core.modules.planning.mapper", - "com.xiaowang.fingertipdesigner.core.modules.product.mapper", - "com.xiaowang.fingertipdesigner.core.modules.security.mapper", - "com.xiaowang.fingertipdesigner.core.modules.shop.mapper", - "com.xiaowang.fingertipdesigner.core.modules.system.mapper", - "com.xiaowang.fingertipdesigner.core.modules.user.mapper" + "com.xiaowang.jacyucloudsalon.core.modules.artist.mapper", + "com.xiaowang.jacyucloudsalon.core.modules.auth.mapper", + "com.xiaowang.jacyucloudsalon.core.modules.content.mapper", + "com.xiaowang.jacyucloudsalon.core.modules.file.mapper", + "com.xiaowang.jacyucloudsalon.core.modules.integration.mapper", + "com.xiaowang.jacyucloudsalon.core.modules.inventory.mapper", + "com.xiaowang.jacyucloudsalon.core.modules.marketing.mapper", + "com.xiaowang.jacyucloudsalon.core.modules.message.mapper", + "com.xiaowang.jacyucloudsalon.core.modules.order.mapper", + "com.xiaowang.jacyucloudsalon.core.modules.payment.mapper", + "com.xiaowang.jacyucloudsalon.core.modules.planning.mapper", + "com.xiaowang.jacyucloudsalon.core.modules.product.mapper", + "com.xiaowang.jacyucloudsalon.core.modules.security.mapper", + "com.xiaowang.jacyucloudsalon.core.modules.shop.mapper", + "com.xiaowang.jacyucloudsalon.core.modules.system.mapper", + "com.xiaowang.jacyucloudsalon.core.modules.user.mapper" }) public class MyBatisPlusConfig { diff --git a/JC-Salon-Core/src/main/resources/application.yaml b/JC-Salon-Core/src/main/resources/application.yaml deleted file mode 100644 index e0a1f54c..00000000 --- a/JC-Salon-Core/src/main/resources/application.yaml +++ /dev/null @@ -1,138 +0,0 @@ -spring: - datasource: - url: jdbc:mysql://localhost:3306/jayucloud_salon?useUnicode=true&characterEncoding=utf-8&serverTimezone=Asia/Shanghai - servlet: - multipart: - max-file-size: 5MB - max-request-size: 10MB - jackson: - time-zone: Asia/Shanghai - date-format: yyyy-MM-dd HH:mm:ss - -logging: - pattern: - console: "%d{yyyy-MM-dd HH:mm:ss} [%thread] %-5level %logger{36} - %msg%n" - -server: - servlet: - encoding: - charset: UTF-8 - force: true - enabled: true - timezone: Asia/Shanghai - -mybatis: - configuration: - map-underscore-to-camel-case: true - -fingertip-designer: - brand: - message-template-name: ${PLATFORM_MESSAGE_TEMPLATE_NAME:FingertipDesigner} - manager-register-shop-description: ${PLATFORM_MANAGER_REGISTER_SHOP_DESCRIPTION:甲屿店务注册店铺} - security: - jwt: - issuer: fingertip-designer - access-token-expiration-seconds: 7200 - remember-me-access-token-expiration-seconds: 604800 - refresh-token-expiration-seconds: 604800 - clock-skew-seconds: 30 - signature: - enabled: true - window-seconds: 300 - nonce-retention-seconds: 600 - rate-limit: - login: - limit: 10 - window-seconds: 60 - send-code: - limit: 5 - window-seconds: 60 - reset-password: - limit: 5 - window-seconds: 600 - authenticated-write: - limit: 80 - window-seconds: 60 - order-create: - limit: 10 - window-seconds: 60 - cache: - local-max-size: 2048 - product-detail: - local-ttl-seconds: 120 - redis-ttl-seconds: 900 - product-list: - local-ttl-seconds: 60 - redis-ttl-seconds: 300 - product-search: - local-ttl-seconds: 60 - redis-ttl-seconds: 300 - shop: - local-ttl-seconds: 180 - redis-ttl-seconds: 900 - tag: - local-ttl-seconds: 300 - redis-ttl-seconds: 1200 - object-storage-file: - local-ttl-seconds: 300 - redis-ttl-seconds: 1800 - dashboard: - local-ttl-seconds: 30 - redis-ttl-seconds: 90 - slow-request: - enabled: true - threshold-ms: 300 - log-response-header-request-id: true - http-client: - connect-timeout-ms: 3000 - read-timeout-ms: 5000 - connection-request-timeout-ms: 1000 - max-total-connections: 200 - max-connections-per-route: 50 - -object-storage: - provider-order: - - MINIO - - QINIU_KODO - - ALIYUN_OSS - replica-required-providers: - - MINIO - - QINIU_KODO - - ALIYUN_OSS - primary-provider: MINIO - backup-provider: QINIU_KODO,ALIYUN_OSS - signed-url-expire-minutes: 60 - backup-queue-name: fingertip-designer.file.object-storage.backup.queue - backup-exchange-name: fingertip-designer.file.object-storage.backup.exchange - backup-routing-key: fingertip-designer.file.object-storage.backup - backup-retry-batch-limit: 500 - backup-retry-cron: "0 0 2 * * ?" - -qiniu: - kodo: - access-key: ${QINIU_KODO_ACCESS_KEY:} - secret-key: ${QINIU_KODO_SECRET_KEY:} - bucket-name: ${QINIU_KODO_BUCKET_NAME:} - domain: ${QINIU_KODO_DOMAIN:} - zone: ${QINIU_KODO_ZONE:z2} - private-bucket: ${QINIU_KODO_PRIVATE_BUCKET:true} - signed-url-expire-minutes: ${QINIU_KODO_SIGNED_URL_EXPIRE_MINUTES:60} - -minio: - enabled: ${MINIO_ENABLED:false} - endpoint: ${MINIO_ENDPOINT:} - bucket-name: ${MINIO_BUCKET_NAME:} - access-key: ${MINIO_ACCESS_KEY:} - secret-key: ${MINIO_SECRET_KEY:} - private-bucket: ${MINIO_PRIVATE_BUCKET:true} - signed-url-expire-minutes: ${MINIO_SIGNED_URL_EXPIRE_MINUTES:60} - -aliyun: - oss: - enabled: ${ALIYUN_OSS_ENABLED:false} - endpoint: ${ALIYUN_OSS_ENDPOINT:} - region: ${ALIYUN_OSS_REGION:} - bucket-name: ${ALIYUN_OSS_BUCKET_NAME:} - access-key-id: ${ALIYUN_OSS_ACCESS_KEY_ID:} - access-key-secret: ${ALIYUN_OSS_ACCESS_KEY_SECRET:} - signed-url-expire-minutes: ${ALIYUN_OSS_SIGNED_URL_EXPIRE_MINUTES:60} -- 2.54.0 From abf34267a116abc10e4b31b20357d48b59b48a76 Mon Sep 17 00:00:00 2001 From: xiaowang <2161656029@qq.com> Date: Wed, 26 Aug 2026 18:20:38 +0800 Subject: [PATCH 02/19] =?UTF-8?q?=E9=85=8D=E7=BD=AEDev=E5=BA=97=E5=8A=A1Co?= =?UTF-8?q?re=E5=92=8CGateway=E7=AB=AF=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- nacos/namespaces/dev/jayucloud-salon/DEFAULT_GROUP/core.yaml | 1 + .../namespaces/dev/jayucloud-salon/DEFAULT_GROUP/gateway.yaml | 3 +++ scripts/开发店务Nacos默认参数说明_20260826.md | 2 ++ 3 files changed, 6 insertions(+) diff --git a/nacos/namespaces/dev/jayucloud-salon/DEFAULT_GROUP/core.yaml b/nacos/namespaces/dev/jayucloud-salon/DEFAULT_GROUP/core.yaml index a5b01556..2d5b82dc 100644 --- a/nacos/namespaces/dev/jayucloud-salon/DEFAULT_GROUP/core.yaml +++ b/nacos/namespaces/dev/jayucloud-salon/DEFAULT_GROUP/core.yaml @@ -14,6 +14,7 @@ logging: console: "%d{yyyy-MM-dd HH:mm:ss} [%thread] %-5level %logger{36} - %msg%n" server: + port: 8081 servlet: encoding: charset: UTF-8 diff --git a/nacos/namespaces/dev/jayucloud-salon/DEFAULT_GROUP/gateway.yaml b/nacos/namespaces/dev/jayucloud-salon/DEFAULT_GROUP/gateway.yaml index 9c91bc17..2ff5be66 100644 --- a/nacos/namespaces/dev/jayucloud-salon/DEFAULT_GROUP/gateway.yaml +++ b/nacos/namespaces/dev/jayucloud-salon/DEFAULT_GROUP/gateway.yaml @@ -1,3 +1,6 @@ +server: + port: 80 + spring: cloud: gateway: diff --git a/scripts/开发店务Nacos默认参数说明_20260826.md b/scripts/开发店务Nacos默认参数说明_20260826.md index 8d4e843f..b7168348 100644 --- a/scripts/开发店务Nacos默认参数说明_20260826.md +++ b/scripts/开发店务Nacos默认参数说明_20260826.md @@ -6,6 +6,8 @@ Dev 的 Nacos、Redis、RabbitMQ、MinIO、七牛云和阿里云 OSS 参数已提供默认值,运行环境中的同名变量可以覆盖默认值。Core 的 bootstrap 配置同样默认连接 Dev Nacos,避免首次拉取 Nacos 配置时仍指向生产集群。 +Dev 店务端端口固定为:`jc-salon-core` 使用 `8081`,`jc-salon-gateway` 使用 `80`。端口由各自 Nacos Data ID 声明,修改后必须发布 Dev 配置并重启对应服务才会生效。 + 业务数据库的 `BUSINESS_JDBC_URL`、`BUSINESS_DB_USERNAME` 和 `BUSINESS_DB_PASSWORD` 已提供 Dev Salon 默认值,运行环境可以按需覆盖。 本次调整的版本化文件: -- 2.54.0 From 449d57916dacef2135665f6ae0b4cc928631f931 Mon Sep 17 00:00:00 2001 From: xiaowang <2161656029@qq.com> Date: Wed, 26 Aug 2026 18:28:32 +0800 Subject: [PATCH 03/19] =?UTF-8?q?=E5=AE=9E=E7=8E=B0Dev=E5=92=8CSIT?= =?UTF-8?q?=E9=85=8D=E7=BD=AE=E6=8E=A8=E9=80=81=E8=87=AA=E5=8A=A8=E5=8F=91?= =?UTF-8?q?=E5=B8=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitea/workflows/publish-nacos.yml | 6 +++++- ...026-08-26-nacos-dev-sit-auto-publish-design.md | 15 +++++++++++++++ docs/运维配置与集成说明.md | 4 ++-- 3 files changed, 22 insertions(+), 3 deletions(-) create mode 100644 docs/superpowers/specs/2026-08-26-nacos-dev-sit-auto-publish-design.md diff --git a/.gitea/workflows/publish-nacos.yml b/.gitea/workflows/publish-nacos.yml index c5886a07..10b7c5a5 100644 --- a/.gitea/workflows/publish-nacos.yml +++ b/.gitea/workflows/publish-nacos.yml @@ -1,6 +1,10 @@ name: 发布 Nacos 配置 on: + push: + branches: + - dev + - sit workflow_dispatch: inputs: environment: @@ -28,7 +32,7 @@ jobs: node-version: 20 - name: 发布并校验配置 env: - NACOS_ENVIRONMENT: ${{ inputs.environment }} + NACOS_ENVIRONMENT: ${{ inputs.environment || github.ref_name }} NACOS_PROD_URLS: ${{ secrets.NACOS_PROD_URLS }} NACOS_PROD_USERNAME: ${{ secrets.NACOS_PROD_USERNAME }} NACOS_PROD_PASSWORD: ${{ secrets.NACOS_PROD_PASSWORD }} diff --git a/docs/superpowers/specs/2026-08-26-nacos-dev-sit-auto-publish-design.md b/docs/superpowers/specs/2026-08-26-nacos-dev-sit-auto-publish-design.md new file mode 100644 index 00000000..68f3f810 --- /dev/null +++ b/docs/superpowers/specs/2026-08-26-nacos-dev-sit-auto-publish-design.md @@ -0,0 +1,15 @@ +# Dev 与 SIT Nacos 自动发布设计 + +## 目标 + +推送到 `dev` 或 `sit` 分支后自动发布对应环境的 Nacos 配置;生产发布继续保持手工控制,避免普通开发提交影响生产环境。 + +## 方案 + +在现有 `.gitea/workflows/publish-nacos.yml` 中增加 `push` 触发器,仅监听 `dev`、`sit` 两个分支。发布步骤通过事件输入或当前分支名确定 `NACOS_ENVIRONMENT`:手工触发优先使用 `workflow_dispatch` 的环境输入,推送触发使用 `github.ref_name`。 + +现有发布脚本、Nacos Secrets、配置目录扫描、发布后回读校验均保持不变。`workflow_dispatch` 继续提供 `dev`、`sit`、`prod-center1`、`prod-center2`、`prod-both` 选项,因此生产只能手工发布。 + +## 验证 + +检查工作流 YAML 结构和触发分支,确认环境表达式在两类事件下均有值;检查文档与工作流行为一致;提交前运行 GitNexus `detect_changes()` 确认仅影响发布工作流及运维说明。 diff --git a/docs/运维配置与集成说明.md b/docs/运维配置与集成说明.md index 7938db8d..5f9cbc01 100644 --- a/docs/运维配置与集成说明.md +++ b/docs/运维配置与集成说明.md @@ -11,7 +11,7 @@ 服务注册名为 `jc-artlist-core`、`jc-artlist-gateway`、`jc-salon-core`、`jc-salon-gateway`。设计师 Web/小程序不再包含管理入口;店务 Web 仅保留管理工作流。 -Nacos 配置源位于 `nacos/namespaces/dev/`、`nacos/namespaces/sit/` 与 `nacos/namespaces/prod/`,发布流程为 `.gitea/workflows/publish-nacos.yml`。工作流必须手工选择环境,配置与凭据不跨环境复用。生产 Nacos 元数据库使用 `192.168.10.200:3306/nacos`,生产业务数据库使用 `192.168.10.200:6033` 对应业务库;SIT 业务数据库使用 `192.168.10.102:3306`;Dev 中间件统一使用 `192.168.5.15`。Redis、RabbitMQ 和对象存储的连接信息通过环境变量或 Gitea Secrets 注入,不在仓库提交敏感值。详细规则见 `docs/scripts/生产与测试环境Nacos配置说明_20260826.md` 和 `docs/scripts/开发环境Nacos配置发布说明_20260826.md`。 +Nacos 配置源位于 `nacos/namespaces/dev/`、`nacos/namespaces/sit/` 与 `nacos/namespaces/prod/`,发布流程为 `.gitea/workflows/publish-nacos.yml`。推送到 `dev` 或 `sit` 分支会自动发布对应环境;生产环境仍须通过工作流手工选择发布目标。配置与凭据不跨环境复用。生产 Nacos 元数据库使用 `192.168.10.200:3306/nacos`,生产业务数据库使用 `192.168.10.200:6033` 对应业务库;SIT 业务数据库使用 `192.168.10.102:3306`;Dev 中间件统一使用 `192.168.5.15`。Redis、RabbitMQ 和对象存储的连接信息通过环境变量或 Gitea Secrets 注入,不在仓库提交敏感值。详细规则见 `docs/scripts/生产与测试环境Nacos配置说明_20260826.md` 和 `docs/scripts/开发环境Nacos配置发布说明_20260826.md`。 生产对象存储默认使用中心1 MinIO `http://192.168.10.105:9000`,中心2 `http://192.168.20.15:9000` 仅在灾备接管时切换。七牛云 Kodo 使用私有空间 `jayucloud`、`z2` 和 `https://img.yunail.art`;阿里云 OSS 使用私有桶 `jayucloud`、`cn-chengdu` 和 `https://oss-cn-chengdu.aliyuncs.com`。详细发布与验证要求见 `docs/scripts/生产对象存储与中间件配置调整说明_20260825.md`。 @@ -87,7 +87,7 @@ Nacos 配置源位于 `nacos/namespaces/dev/`、`nacos/namespaces/sit/` 与 `nac | `NACOS_PROD_URLS`、`NACOS_PROD_USERNAME`、`NACOS_PROD_PASSWORD` | 发布生产中心一,至少两个节点回读 | | `NACOS_DR_URLS`、`NACOS_DR_USERNAME`、`NACOS_DR_PASSWORD` | 发布生产灾备中心,单节点回读 | -工作流输入 `NACOS_ENVIRONMENT` 可选 `dev`、`sit`、`prod-center1`、`prod-center2`、`prod-both`。发布脚本只读取所选环境目录,日志不输出配置正文和敏感值。 +推送 `dev`/`sit` 分支时,工作流自动将 `NACOS_ENVIRONMENT` 设置为分支名;手工触发时输入 `NACOS_ENVIRONMENT` 可选 `dev`、`sit`、`prod-center1`、`prod-center2`、`prod-both`。发布脚本只读取所选环境目录,日志不输出配置正文和敏感值。 ### Web 前端构建变量 -- 2.54.0 From 2ad41221ff71b2cbfb8643b1083d3c22bb6b3610 Mon Sep 17 00:00:00 2001 From: xiaowang <2161656029@qq.com> Date: Wed, 26 Aug 2026 19:09:56 +0800 Subject: [PATCH 04/19] =?UTF-8?q?=E6=95=B4=E7=90=86=E5=8F=8C=E7=AB=AF?= =?UTF-8?q?=E5=88=9D=E5=A7=8B=E5=8C=96SQL=E8=84=9A=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/README.md | 4 +- docs/architecture/backend-design.md | 4 +- docs/handoff/CURRENT-STATE.md | 4 +- docs/handoff/PROJECT-MAP.md | 8 +- docs/handoff/RISK-REGISTER.md | 4 +- docs/handoff/TASK-PLAYBOOKS.md | 4 +- docs/handoff/vnext-operations-sql-design.md | 2 +- .../handoff/上线初始化SQL基线说明_20260624.md | 4 +- .../0.0.1版本基线与后续迭代规则_20260628.md | 11 +- .../deploy-fingertip-designer-production.ps1 | 4 +- .../deploy-jayucloud-salon-production.ps1 | 4 +- docs/scripts/package-release.ps1 | 14 +- docs/scripts/sql/init/FingertipDesigner.sql | 2313 ----------------- .../jayucloud-artlist.sql} | 14 +- .../jayucloud-salon.sql} | 14 +- docs/scripts/sql/migrations/.gitkeep | 0 .../店务端职责裁剪_20260825.sql | 14 - .../设计师端职责裁剪_20260825.sql | 13 - .../员工排班规则和例外_20260626.sql | 92 - docs/scripts/双端独立部署配置说明20260825.md | 6 +- ...回MinIO三副本对象存储配置说明_20260624.md | 2 +- ...名为FingertipDesigner配置说明_20260617.md | 4 +- .../指尖管理师上线检查清单_20260622.md | 4 +- .../指尖管理师上线部署审计报告_20260622.md | 12 +- docs/运维配置与集成说明.md | 4 +- docs/项目功能概览.md | 3 +- docs/项目变更记录.md | 2 +- 27 files changed, 77 insertions(+), 2487 deletions(-) delete mode 100644 docs/scripts/sql/init/FingertipDesigner.sql rename docs/scripts/sql/{migrations/20260825-双端独立数据库/设计师独立数据库_20260825.sql => init/jayucloud-artlist.sql} (97%) rename docs/scripts/sql/{migrations/20260825-双端独立数据库/店务独立数据库_20260825.sql => init/jayucloud-salon.sql} (97%) delete mode 100644 docs/scripts/sql/migrations/.gitkeep delete mode 100644 docs/scripts/sql/migrations/20260825-双端职责裁剪/店务端职责裁剪_20260825.sql delete mode 100644 docs/scripts/sql/migrations/20260825-双端职责裁剪/设计师端职责裁剪_20260825.sql delete mode 100644 docs/scripts/sql/migrations/员工排班规则和例外_20260626.sql diff --git a/docs/README.md b/docs/README.md index d7c0c80b..c68f7a50 100644 --- a/docs/README.md +++ b/docs/README.md @@ -11,8 +11,8 @@ ## 关键规则 -- `docs/scripts/sql/init/FingertipDesigner.sql` 是 `0.0.1` 空库初始化基线,后续不得回写。 -- 新增表、字段、索引、权限种子或数据修复时,必须在 `docs/scripts/sql/migrations/` 新增带功能和日期的中文版本 SQL。 +- `docs/scripts/sql/init/jayucloud-salon.sql` 与 `docs/scripts/sql/init/jayucloud-artlist.sql` 分别是店务端和设计师端的空库初始化入口。 +- 两份初始化脚本包含各端当前运行所需的完整结构和种子数据;后续数据库变更必须以版本化 SQL 管理。 - 配置或部署流程变更必须在 `docs/scripts/` 增加说明文档,并同步更新相关运维记录。 - 生产 SQL、Nacos 发布和实际部署执行前,必须先核对目标环境、备份状态和凭据注入方式。 diff --git a/docs/architecture/backend-design.md b/docs/architecture/backend-design.md index d6670770..90d918eb 100644 --- a/docs/architecture/backend-design.md +++ b/docs/architecture/backend-design.md @@ -68,6 +68,6 @@ vNext 经营能力在数据库层补齐独立运行时表,并与订单、权 ## 数据库脚本 -初始化 SQL 只放在 `docs/scripts/sql/init/FingertipDesigner.sql`,这是当前唯一的数据库初始化入口。 +初始化 SQL 只放在 `docs/scripts/sql/init/`:店务端使用 `jayucloud-salon.sql`,设计师端使用 `jayucloud-artlist.sql`。 -vNext 经营表结构、索引、权限种子和雪花 ID 主键口径已经并入唯一初始化 SQL。空库初始化只执行 `docs/scripts/sql/init/FingertipDesigner.sql`。 +经营表结构、索引、权限种子和雪花 ID 主键口径已经并入对应端侧初始化 SQL。空库初始化只执行目标端对应脚本。 diff --git a/docs/handoff/CURRENT-STATE.md b/docs/handoff/CURRENT-STATE.md index 93701182..82428b34 100644 --- a/docs/handoff/CURRENT-STATE.md +++ b/docs/handoff/CURRENT-STATE.md @@ -13,11 +13,11 @@ ## SQL 基线 -- `0.0.1` 空库初始化 SQL 基线:`docs/scripts/sql/init/FingertipDesigner.sql` +- 空库初始化 SQL 基线:`docs/scripts/sql/init/jayucloud-salon.sql` 与 `docs/scripts/sql/init/jayucloud-artlist.sql` - 开发、测试、上线空库初始化只执行该文件。 - 旧项目命名、MinIO 三副本对象存储、预约手动项目展示控制等变更已经合并进初始化 SQL。 - 该初始化 SQL 只保留一名平台管理员 `xiaowang`、完整权限、管理员授权、协议、系统参数、MessageHub 和 VIP 基础配置,不写入门店、商品、订单、客户等业务样例数据。 -- 从 `0.0.1` 起不再修改初始化 SQL;后续 SQL 变更必须新增 `docs/scripts/sql/migrations/` 下的版本变更 SQL。 +- 不修改端侧初始化 SQL;后续 SQL 变更必须新增独立版本变更 SQL。 - 生产已部署库的历史数据升级不在初始化 SQL 范围内,如需升级已有库必须单独制定迁移方案。 - 脚本、配置、SQL 的后续迭代规则见 `docs/scripts/0.0.1版本基线与后续迭代规则_20260628.md`。 diff --git a/docs/handoff/PROJECT-MAP.md b/docs/handoff/PROJECT-MAP.md index 1fbc4bb8..6f3167f7 100644 --- a/docs/handoff/PROJECT-MAP.md +++ b/docs/handoff/PROJECT-MAP.md @@ -18,7 +18,7 @@ - 新业务优先放入现有 `modules.`。 - Gateway 不承载业务写逻辑。 -- 数据库空库基线以 `docs/scripts/sql/init/FingertipDesigner.sql` 的 `0.0.1` 冻结版本为准,后续数据库变更走 `docs/scripts/sql/migrations/`。 +- 数据库空库基线以 `docs/scripts/sql/init/jayucloud-salon.sql` 和 `docs/scripts/sql/init/jayucloud-artlist.sql` 为准,后续数据库变更使用独立版本化 SQL。 ## JC-ArtList-Gateway @@ -76,15 +76,15 @@ 关键入口: -- `docs/scripts/sql/init/FingertipDesigner.sql` -- `docs/scripts/sql/migrations/` +- `docs/scripts/sql/init/jayucloud-salon.sql` +- `docs/scripts/sql/init/jayucloud-artlist.sql` - `docs/scripts/0.0.1版本基线与后续迭代规则_20260628.md` - `docs/scripts/deploy-fingertip-designer-production.ps1` - `docs/scripts/package-release.ps1` 边界: -- `docs/scripts/sql/init/FingertipDesigner.sql` 是 `0.0.1` 空库初始化 SQL 基线,后续不再修改。 +- 两份端侧初始化 SQL 是空库初始化基线,后续不再修改。 - `docs/scripts/sql/migrations` 是 `0.0.1` 后的数据库版本变更 SQL 目录。 - 生产已部署库升级不直接复用初始化 SQL,必须单独制定迁移方案。 diff --git a/docs/handoff/RISK-REGISTER.md b/docs/handoff/RISK-REGISTER.md index f1828bed..f85a8bdf 100644 --- a/docs/handoff/RISK-REGISTER.md +++ b/docs/handoff/RISK-REGISTER.md @@ -29,10 +29,10 @@ 检查点: -- 当前 `0.0.1` 空库初始化 SQL 基线是 `docs/scripts/sql/init/FingertipDesigner.sql`。 +- 当前空库初始化 SQL 基线是 `docs/scripts/sql/init/jayucloud-salon.sql` 与 `docs/scripts/sql/init/jayucloud-artlist.sql`。 - 开发、测试、上线空库只执行该文件。 - `0.0.1` 之后不得继续修改初始化 SQL。 -- 新增表、字段、索引、权限种子、系统参数、运行必需种子数据或数据修复时,必须新增 `docs/scripts/sql/migrations/` 下的版本变更 SQL。 +- 新增表、字段、索引、权限种子、系统参数、运行必需种子数据或数据修复时,必须新增独立版本变更 SQL。 - 版本变更 SQL 文件名必须使用中文,体现功能和日期,内容必须完整可执行。 - 生产已部署库升级不直接复用初始化 SQL,必须单独制定迁移方案。 - 真实 DDL 优先用 MySQL 执行验证;不能执行时要记录阻塞原因。 diff --git a/docs/handoff/TASK-PLAYBOOKS.md b/docs/handoff/TASK-PLAYBOOKS.md index e9c7174d..ae1cf15a 100644 --- a/docs/handoff/TASK-PLAYBOOKS.md +++ b/docs/handoff/TASK-PLAYBOOKS.md @@ -68,8 +68,8 @@ 步骤: -1. 不修改 `docs/scripts/sql/init/FingertipDesigner.sql`。 -2. 在 `docs/scripts/sql/migrations/` 新增中文命名的版本变更 SQL,体现功能和日期。 +1. 不修改 `docs/scripts/sql/init/jayucloud-salon.sql` 和 `docs/scripts/sql/init/jayucloud-artlist.sql`。 +2. 新增中文命名的独立版本变更 SQL,体现功能和日期。 3. SQL 内容必须完整可执行,并包含必要的幂等判断、过程清理和明确失败条件。 4. 对比 Java `@TableName` 实体表与本次版本变更 SQL,确认新增表、字段、索引和种子数据边界。 5. 用临时库或目标环境执行 SQL;不能执行时记录阻塞原因。 diff --git a/docs/handoff/vnext-operations-sql-design.md b/docs/handoff/vnext-operations-sql-design.md index f9890b75..1f976cf1 100644 --- a/docs/handoff/vnext-operations-sql-design.md +++ b/docs/handoff/vnext-operations-sql-design.md @@ -2,7 +2,7 @@ 更新时间:2026-05-24 -本文记录已经并入唯一初始化 SQL 的 vNext 经营能力。当前空库初始化只执行 `docs/scripts/sql/init/FingertipDesigner.sql`,不再额外执行历史增量脚本。 +本文记录已经并入端侧初始化 SQL 的 vNext 经营能力。店务端执行 `docs/scripts/sql/init/jayucloud-salon.sql`,设计师端执行 `docs/scripts/sql/init/jayucloud-artlist.sql`,不再额外执行历史增量脚本。 ## 覆盖范围 diff --git a/docs/handoff/上线初始化SQL基线说明_20260624.md b/docs/handoff/上线初始化SQL基线说明_20260624.md index 5433dea1..f2b7fa79 100644 --- a/docs/handoff/上线初始化SQL基线说明_20260624.md +++ b/docs/handoff/上线初始化SQL基线说明_20260624.md @@ -4,11 +4,11 @@ ## 唯一入口 -`docs/scripts/sql/init/FingertipDesigner.sql` 是 `0.0.1` 空库初始化 SQL 基线。 +当前空库初始化入口为 `docs/scripts/sql/init/jayucloud-salon.sql`(店务端)和 `docs/scripts/sql/init/jayucloud-artlist.sql`(设计师端)。 开发、测试、上线空库初始化都只执行该文件。本轮已把旧项目命名、MinIO 三副本对象存储、预约手动项目展示控制等变更合并回 `0.0.1` 初始化基线。 -从 `0.0.1` 起,该初始化 SQL 冻结为仅空库首次初始化使用。后续涉及表结构、补列、索引、权限种子、系统参数、运行必需种子数据或数据修复时,必须在 `docs/scripts/sql/migrations/` 下新增版本变更 SQL,不得继续修改初始化 SQL。 +两份初始化 SQL 仅用于各自端侧的空库首次初始化;后续数据库变更必须使用独立版本化 SQL,不得回写初始化脚本。 ## 初始化内容 diff --git a/docs/scripts/0.0.1版本基线与后续迭代规则_20260628.md b/docs/scripts/0.0.1版本基线与后续迭代规则_20260628.md index f1462558..a54c1c05 100644 --- a/docs/scripts/0.0.1版本基线与后续迭代规则_20260628.md +++ b/docs/scripts/0.0.1版本基线与后续迭代规则_20260628.md @@ -13,19 +13,18 @@ - `JC-ArtList-Frontend`:`package.json` 和 `package-lock.json` 版本为 `0.0.1`。 - `JC-ArtList-WeChat`:以当前微信小程序项目配置、页面和脚本作为 `0.0.1` 用户端小程序基线。 - `JC-Salon-WeChat`:以当前微信小程序项目配置、页面和脚本作为 `0.0.1` 管理师小程序基线。 -- `docs/scripts/sql/init/FingertipDesigner.sql`:作为 `0.0.1` 空库初始化 SQL 基线。 -- `docs/scripts/sql/migrations/`:作为 `0.0.1` 后续数据库版本变更脚本目录。 +- `docs/scripts/sql/init/jayucloud-salon.sql`:作为店务端空库初始化 SQL 基线。 +- `docs/scripts/sql/init/jayucloud-artlist.sql`:作为设计师端空库初始化 SQL 基线。 ## 初始化 SQL 冻结规则 -从 `0.0.1` 起,`docs/scripts/sql/init/FingertipDesigner.sql` 只作为空库首次初始化基线,不再在后续需求、修复或配置变更中修改。 +从当前双端基线起,`docs/scripts/sql/init/jayucloud-salon.sql` 与 `docs/scripts/sql/init/jayucloud-artlist.sql` 只作为各自空库首次初始化入口。 后续涉及表结构、补列、索引、权限种子、系统参数、运行必需种子数据或数据修复时,必须新增版本变更 SQL,不得回写初始化 SQL。 ## 后续迭代文件规则 -- SQL 变更脚本放在 `docs/scripts/sql/migrations/`。 -- SQL 文件名必须使用中文,体现功能和日期,例如 `员工排班规则和例外_20260626.sql`。 +- 后续 SQL 变更必须创建独立的版本化脚本,文件名使用中文并体现功能和日期,例如 `员工排班规则和例外_20260626.sql`。 - SQL 内容必须是完整可执行脚本,包含必要的幂等判断、过程清理和明确失败条件。 - 配置变更必须新增说明文档,放在 `docs/scripts/` 目录。 - 配置说明文档文件名必须使用中文,体现功能和日期。 @@ -35,4 +34,4 @@ - 问题:旧记忆和交接文档仍记录“新增表字段后同步更新初始化 SQL”。 - 原因:`0.0.1` 前的上线基线阶段曾把历史 SQL 合并回唯一初始化脚本。 -- 处理:本次将规则改为 `0.0.1` 初始化 SQL 冻结,后续变更全部通过 `docs/scripts/sql/migrations/` 和 `docs/scripts/` 中的版本化说明文件迭代。 +- 处理:初始化入口按端侧拆分;后续变更通过版本化 SQL 与 `docs/scripts/` 中的说明文件迭代。 diff --git a/docs/scripts/deploy-fingertip-designer-production.ps1 b/docs/scripts/deploy-fingertip-designer-production.ps1 index a45b54e0..06d541cf 100644 --- a/docs/scripts/deploy-fingertip-designer-production.ps1 +++ b/docs/scripts/deploy-fingertip-designer-production.ps1 @@ -41,7 +41,7 @@ $backendDir = Join-Path $releaseDir "backend" $frontendDir = Join-Path $releaseDir "frontend" $sqlDir = Join-Path $releaseDir "sql" $manifestPath = Join-Path $releaseDir "manifest.json" -$defaultInitSqlPath = Join-Path $resolvedRepoRoot "docs\scripts\sql\init\FingertipDesigner.sql" +$defaultInitSqlPath = Join-Path $resolvedRepoRoot "docs\scripts\sql\init\jayucloud-artlist.sql" if (-not $InitSqlPath) { $InitSqlPath = $defaultInitSqlPath } @@ -509,7 +509,7 @@ function Build-ReleasePackage { $coreArtifact = Join-Path $backendDir "JC-ArtList-Core.jar" $gatewayArtifact = Join-Path $backendDir "JC-ArtList-Gateway.jar" $frontendArtifact = Join-Path $frontendDir "jc-artlist-frontend-dist.tar.gz" - $sqlArtifact = Join-Path $sqlDir "FingertipDesigner.sql" + $sqlArtifact = Join-Path $sqlDir "jayucloud-artlist.sql" Copy-Item -LiteralPath $coreJar -Destination $coreArtifact -Force Copy-Item -LiteralPath $gatewayJar -Destination $gatewayArtifact -Force Copy-Item -LiteralPath $InitSqlPath -Destination $sqlArtifact -Force diff --git a/docs/scripts/deploy-jayucloud-salon-production.ps1 b/docs/scripts/deploy-jayucloud-salon-production.ps1 index 102a3152..0df3e944 100644 --- a/docs/scripts/deploy-jayucloud-salon-production.ps1 +++ b/docs/scripts/deploy-jayucloud-salon-production.ps1 @@ -41,7 +41,7 @@ $backendDir = Join-Path $releaseDir "backend" $frontendDir = Join-Path $releaseDir "frontend" $sqlDir = Join-Path $releaseDir "sql" $manifestPath = Join-Path $releaseDir "manifest.json" -$defaultInitSqlPath = Join-Path $resolvedRepoRoot "docs\scripts\sql\migrations\20260825-双端独立数据库\店务独立数据库_20260825.sql" +$defaultInitSqlPath = Join-Path $resolvedRepoRoot "docs\scripts\sql\init\jayucloud-salon.sql" if (-not $InitSqlPath) { $InitSqlPath = $defaultInitSqlPath } @@ -509,7 +509,7 @@ function Build-ReleasePackage { $coreArtifact = Join-Path $backendDir "JC-Salon-Core.jar" $gatewayArtifact = Join-Path $backendDir "JC-Salon-Gateway.jar" $frontendArtifact = Join-Path $frontendDir "jc-salon-frontend-dist.tar.gz" - $sqlArtifact = Join-Path $sqlDir "店务独立数据库_20260825.sql" + $sqlArtifact = Join-Path $sqlDir "jayucloud-salon.sql" Copy-Item -LiteralPath $coreJar -Destination $coreArtifact -Force Copy-Item -LiteralPath $gatewayJar -Destination $gatewayArtifact -Force Copy-Item -LiteralPath $InitSqlPath -Destination $sqlArtifact -Force diff --git a/docs/scripts/package-release.ps1 b/docs/scripts/package-release.ps1 index f4533886..67ca000a 100644 --- a/docs/scripts/package-release.ps1 +++ b/docs/scripts/package-release.ps1 @@ -12,7 +12,8 @@ $releaseDir = Join-Path $releaseRoot $timestamp $backendDir = Join-Path $releaseDir "backend" $frontendDir = Join-Path $releaseDir "frontend" $miniProgramDir = Join-Path $releaseDir "miniprograms" -$sqlPath = Join-Path $repoRoot "docs\scripts\sql\init\FingertipDesigner.sql" +$artlistSqlPath = Join-Path $repoRoot "docs\scripts\sql\init\jayucloud-artlist.sql" +$salonSqlPath = Join-Path $repoRoot "docs\scripts\sql\init\jayucloud-salon.sql" function Resolve-Maven { param([string]$PreferredPath) @@ -119,7 +120,8 @@ Copy-RequiredFile $gatewayJar (Join-Path $backendDir "JC-ArtList-Gateway.jar") Copy-Directory $frontendDist (Join-Path $frontendDir "dist") Copy-Directory (Join-Path $repoRoot "JC-ArtList-WeChat") (Join-Path $miniProgramDir "JC-ArtList-WeChat") Copy-Directory (Join-Path $repoRoot "JC-Salon-WeChat") (Join-Path $miniProgramDir "JC-Salon-WeChat") -Copy-RequiredFile $sqlPath (Join-Path $releaseDir "FingertipDesigner.sql") +Copy-RequiredFile $artlistSqlPath (Join-Path $releaseDir "jayucloud-artlist.sql") +Copy-RequiredFile $salonSqlPath (Join-Path $releaseDir "jayucloud-salon.sql") $manifest = @( "# FingertipDesigner Release $timestamp", @@ -129,11 +131,11 @@ $manifest = @( "- frontend/dist", "- miniprograms/JC-ArtList-WeChat", "- miniprograms/JC-Salon-WeChat", - "- FingertipDesigner.sql", + "- jayucloud-artlist.sql", + "- jayucloud-salon.sql", "", - "Nacos namespace: FingertipDesigner", - "Database initialized by: docs/scripts/sql/init/FingertipDesigner.sql", - "Database name: FingertipDesigner", + "Database initialization: docs/scripts/sql/init/jayucloud-artlist.sql and docs/scripts/sql/init/jayucloud-salon.sql", + "Database names: jayucloud_artlist and jayucloud_salon", "Manager mini program API: https://yunail.art/api/admin" ) $manifest | Set-Content -Encoding UTF8 (Join-Path $releaseDir "README.md") diff --git a/docs/scripts/sql/init/FingertipDesigner.sql b/docs/scripts/sql/init/FingertipDesigner.sql deleted file mode 100644 index af8b30fb..00000000 --- a/docs/scripts/sql/init/FingertipDesigner.sql +++ /dev/null @@ -1,2313 +0,0 @@ --- FingertipDesigner 唯一初始化 SQL --- 本文件用于开发、测试、上线空库初始化,后续环境基线均以本文件为准。 --- 执行范围:建库、建表、索引、约束、平台管理员、基础权限、系统参数、协议、MessageHub 与 VIP 基础配置。 --- 种子数据原则:只保留运行必需配置;不写入门店、商品、订单、客户、库存流水、测试消息等业务样例数据。 --- 默认平台管理员账号:xiaowang,默认密码沿用当前 bcrypt 值。 --- Linux MySQL 环境库名大小写敏感,数据源必须指向 FingertipDesigner。 -CREATE DATABASE IF NOT EXISTS FingertipDesigner DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; -use FingertipDesigner; - --- auto-generated definition -create table t_balance -( - id bigint unsigned auto_increment comment '余额记录唯一主键ID(雪花ID)' - primary key comment '余额表主键索引', - user_id bigint unsigned not null comment '关联用户表主键', - amount decimal(10, 2) default 0.00 not null comment '当前余额', - total_recharge_amount decimal(10, 2) default 0.00 not null comment '累计充值金额', - last_recharge_time datetime null comment '最近一次充值时间', - create_time datetime default CURRENT_TIMESTAMP not null comment '余额账户创建时间', - last_update_time datetime default CURRENT_TIMESTAMP not null on update CURRENT_TIMESTAMP comment '最近一次更新时间', - update_time datetime default CURRENT_TIMESTAMP not null on update CURRENT_TIMESTAMP comment '更新时间', - constraint uk_user_id - unique (user_id) comment '用户余额唯一索引(一个用户对应一条余额记录)' -) - comment '用户余额信息表'; - - --- auto-generated definition -create table t_balance_change_detail -( - id bigint unsigned auto_increment comment '变动记录唯一主键ID(雪花ID)' - primary key comment '余额变动明细主键索引', - user_id bigint unsigned not null comment '关联用户表主键', - amount decimal(10, 2) not null comment '本次变动金额(正数为增加,负数为减少)', - type varchar(20) not null comment '变动类型(如充值、消费、退款)', - current_balance decimal(10, 2) not null comment '变动后的当前余额', - before_balance decimal(10, 2) null comment '变动前余额', - after_balance decimal(10, 2) null comment '变动后余额', - change_scene varchar(32) null comment '余额变动场景', - related_order_id bigint unsigned null comment '关联系统订单ID', - related_order_no varchar(64) null comment '关联系统订单号', - external_order_no varchar(64) null comment '手工录入的外部订单号', - operator_id bigint unsigned null comment '操作人ID', - remark varchar(255) null comment '备注', - change_time datetime default CURRENT_TIMESTAMP not null comment '变动时间' -) - comment '用户余额变动明细表'; - -create index idx_change_time - on t_balance_change_detail (change_time) - comment '按时间查询余额变动的索引'; - -create index idx_user_id - on t_balance_change_detail (user_id) - comment '按用户查询余额变动的索引'; - --- auto-generated definition -create table t_cart -( - id bigint unsigned auto_increment comment '购物车主键索引' - primary key, - user_id bigint unsigned not null comment '关联用户表主键', - product_id bigint unsigned not null comment '关联商品表主键', - quantity int unsigned default 1 not null comment '商品数量', - create_time datetime default CURRENT_TIMESTAMP not null comment '创建时间', - update_time datetime default CURRENT_TIMESTAMP not null on update CURRENT_TIMESTAMP comment '更新时间', - is_delete tinyint unsigned default 0 null comment '逻辑删除:0-未删,1-已删', - constraint uk_user_product - unique (user_id, product_id) comment '用户-商品唯一索引' -) - comment '购物车表'; - -create index idx_user_id - on t_cart (user_id) - comment '按用户查询购物车的索引'; - --- auto-generated definition -create table t_comment -( - id bigint unsigned auto_increment comment '评论唯一主键ID(雪花ID)' - primary key comment '评论主键索引', - user_id bigint unsigned not null comment '评论用户ID,关联用户表主键', - shop_id bigint unsigned default 0 null comment '关联店铺表主键(0表示非店铺评论)', - product_id bigint unsigned default 0 null comment '关联商品表主键(0表示非商品评论)', - comment_content text not null comment '评论内容', - parent_comment_id bigint unsigned default 0 null comment '父级评论ID(0表示为根评论)', - rating_score tinyint unsigned default 5 null comment '评论评分:1-5星', - image_file_ids text null comment '评论图片文件ID集合,多个ID以逗号分隔', - like_count int unsigned default 0 null comment '评论点赞数', - create_time datetime default CURRENT_TIMESTAMP not null comment '评论创建时间', - update_time datetime default CURRENT_TIMESTAMP not null on update CURRENT_TIMESTAMP comment '评论更新时间', - is_delete tinyint unsigned default 0 null comment '逻辑删除标识:0-未删除,1-已删除' -) - comment '用户评论信息表'; - -create index idx_parent_comment_id - on t_comment (parent_comment_id) - comment '按父级评论查询回复的索引'; - -create index idx_product_id - on t_comment (product_id) - comment '按商品查询评论的索引'; - -create index idx_shop_id - on t_comment (shop_id) - comment '按店铺查询评论的索引'; - -create index idx_user_id - on t_comment (user_id) - comment '按用户查询评论的索引';s - --- auto-generated definition -create table t_coupon -( - id bigint unsigned auto_increment comment '优惠券主键索引' - primary key, - coupon_code varchar(50) not null comment '优惠券编码', - coupon_name varchar(100) not null comment '优惠券名称', - coupon_type tinyint not null comment '优惠券类型:1-折扣券,2-满减券', - discount_value decimal(10, 2) default 0.00 null comment '折扣值(如9.5表示95折)', - min_amount decimal(10, 2) default 0.00 null comment '满减券最低消费金额', - reduce_amount decimal(10, 2) default 0.00 null comment '满减券减免金额', - total_count int unsigned default 100 not null comment '优惠券总数量', - used_count int unsigned default 0 not null comment '已使用数量', - start_time datetime not null comment '开始时间', - end_time datetime not null comment '结束时间', - status tinyint unsigned default 1 not null comment '状态:1-可用,2-已过期,3-已用完', - create_time datetime default CURRENT_TIMESTAMP not null comment '创建时间', - update_time datetime default CURRENT_TIMESTAMP not null on update CURRENT_TIMESTAMP comment '更新时间', - is_delete tinyint unsigned default 0 null comment '逻辑删除:0-未删,1-已删', - shop_id bigint null comment '所属店铺ID', - coupon_scene varchar(32) default 'NORMAL' not null comment '优惠券场景', - required_vip_level varchar(20) null comment '要求的VIP等级', - auto_match tinyint unsigned default 0 not null comment '是否自动匹配', - constraint uk_coupon_code - unique (coupon_code) comment '优惠券编码唯一索引' -) - comment '优惠券信息表'; - -create index idx_status - on t_coupon (status) - comment '按状态查询优惠券的索引'; - --- auto-generated definition -create table t_coupon_tag -( - id bigint unsigned auto_increment comment '优惠券标签关联主键索引' - primary key, - coupon_id bigint unsigned not null comment '关联优惠券表主键', - tag_id bigint unsigned not null comment '关联标签表主键', - is_available tinyint unsigned default 1 not null comment '是否可用:1-可用,0-不可用', - create_time datetime default CURRENT_TIMESTAMP not null comment '创建时间', - update_time datetime default CURRENT_TIMESTAMP not null on update CURRENT_TIMESTAMP comment '更新时间', - is_delete tinyint unsigned default 0 null comment '逻辑删除:0-未删,1-已删', - constraint uk_coupon_tag - unique (coupon_id, tag_id) comment '优惠券-标签唯一索引' -) - comment '优惠券标签关联表'; - -create index idx_coupon_id - on t_coupon_tag (coupon_id) - comment '按优惠券查询标签的索引'; - -create index idx_tag_id - on t_coupon_tag (tag_id) - comment '按标签查询优惠券的索引'; - --- auto-generated definition -create table t_effect_diagram -( - id bigint unsigned auto_increment comment '效果图唯一主键ID(雪花id)' - primary key comment '效果图主键索引', - product_id bigint unsigned not null comment '所属商品ID,关联商品表主键', - category varchar(50) default '' null comment '效果图类别', - image_file_ids text null comment '图片文件ID集合,多ID以逗号分隔', - description text null comment '效果图描述', - price decimal(10, 2) default 0.00 null comment '效果图对应服务价格', - duration varchar(50) default '' null comment '效果图对应服务耗时', - tag varchar(50) default '' null comment '效果图标签', - like_count int unsigned default 0 null comment '效果图点赞数', - create_time datetime default CURRENT_TIMESTAMP not null comment '创建时间', - update_time datetime default CURRENT_TIMESTAMP not null on update CURRENT_TIMESTAMP comment '更新时间', - is_delete tinyint unsigned default 0 null comment '逻辑删除:0-未删,1-已删' -) - comment '商品效果图信息表'; - -create index idx_product_id - on t_effect_diagram (product_id) - comment '按商品查询效果图的索引'; - --- auto-generated definition -create table t_login_identity -( - id bigint unsigned auto_increment comment '登录标识唯一主键ID(雪花id)' - primary key comment '登录标识主键索引', - user_id bigint unsigned not null comment '关联用户表主键', - login_method varchar(50) not null comment '登录方式(0-手机号、1-账号、2-邮箱)', - input_value varchar(100) not null comment '前端输入的具体值(如手机号、账号、邮箱)', - input_time datetime not null comment '输入时间', - create_time datetime default CURRENT_TIMESTAMP not null comment '创建时间', - update_time datetime default CURRENT_TIMESTAMP not null on update CURRENT_TIMESTAMP comment '更新时间', - status tinyint unsigned default 1 null comment '状态:1-有效,0-无效' -) - comment '用户登录标识信息表'; - -create index idx_login_method - on t_login_identity (login_method) - comment '按登录方式查询的索引'; - -create index idx_user_id - on t_login_identity (user_id) - comment '按用户查询登录标识的索引'; - --- auto-generated definition -create table t_wechat_mini_binding -( - id bigint unsigned auto_increment comment '微信小程序绑定主键ID(雪花ID)' - primary key, - user_id bigint unsigned not null comment '关联用户ID', - app_id varchar(64) not null comment '微信小程序appId', - openid varchar(100) not null comment '微信小程序openid', - unionid varchar(100) null comment '微信开放平台unionid', - status tinyint unsigned default 1 null comment '状态:1-有效,0-失效', - create_time datetime default CURRENT_TIMESTAMP not null comment '创建时间', - update_time datetime default CURRENT_TIMESTAMP not null on update CURRENT_TIMESTAMP comment '更新时间', - constraint uk_wechat_mini_app_openid - unique (app_id, openid), - constraint uk_wechat_mini_app_user - unique (app_id, user_id) -) - comment '微信小程序账号绑定表'; - -create index idx_wechat_mini_unionid - on t_wechat_mini_binding (unionid) - comment '按unionid查询的索引'; - --- auto-generated definition -create table t_nail_artist_info -( - id bigint unsigned auto_increment comment '美甲师信息主键索引' - primary key, - user_id bigint unsigned not null comment '关联用户表主键(美甲师用户)', - identity varchar(50) default '' null comment '身份', - experience int unsigned default 0 null comment '从业年限', - skills text null comment '技能标签ID集合,多个ID以逗号分隔', - rating decimal(3, 1) default 4.5 null comment '评分', - status tinyint unsigned default 1 null comment '状态:1-营业中,0-休息中', - participate_production tinyint unsigned default 1 not null comment '是否参与美甲制作:1-参与,0-不参与', - work_start_time time null comment '工作开始时间', - work_end_time time null comment '工作结束时间', - portfolio text null comment '作品集商品ID集合,多个ID以逗号分隔', - create_time datetime default CURRENT_TIMESTAMP not null comment '创建时间', - update_time datetime default CURRENT_TIMESTAMP not null on update CURRENT_TIMESTAMP comment '更新时间', - is_delete tinyint unsigned default 0 null comment '逻辑删除:0-未删,1-已删', - constraint uk_user_id - unique (user_id) comment '用户ID唯一索引(一个美甲师对应一条信息记录)' -) - comment '美甲师信息表'; - -create index idx_status - on t_nail_artist_info (status) - comment '按状态查询美甲师的索引'; - -create index idx_user_id - on t_nail_artist_info (user_id) - comment '按用户查询美甲师信息的索引'; - -create index idx_t_nail_artist_info_participate - on t_nail_artist_info (participate_production, status); - --- auto-generated definition -create table t_object_storage_file -( - id bigint unsigned auto_increment comment '????ID' - primary key comment '????????', - file_name varchar(100) not null comment '????', - file_url text not null comment '??????', - object_name varchar(512) null comment '????Key', - primary_provider varchar(64) null comment '??????', - primary_url text null comment '???????', - backup_provider varchar(64) null comment '???????', - backup_url text null comment '????????', - content_type varchar(128) null comment '??Content-Type', - file_size bigint unsigned null comment '?????????', - primary_upload_status tinyint unsigned default 0 not null comment '????????0????1???2??', - backup_upload_status tinyint unsigned default 0 not null comment '?????????0????1???2??', - backup_retry_count int unsigned default 0 not null comment '??????', - backup_last_error varchar(500) null comment '??????????', - backup_uploaded_at datetime null comment '??????', - backup_last_retry_time datetime null comment '??????????', - create_time datetime default CURRENT_TIMESTAMP not null comment '??????', - update_time datetime default CURRENT_TIMESTAMP not null on update CURRENT_TIMESTAMP comment '??????', - status tinyint unsigned default 1 null comment '?????1???0????2???', - delete_time datetime null comment '??????', - recycle_time datetime null comment '?????????' -) - comment '?????????'; - -create index idx_status - on t_object_storage_file (status) - comment '??????'; - -create index idx_object_storage_file_backup_retry - on t_object_storage_file (backup_upload_status, primary_upload_status, status) - comment '????????'; - --- auto-generated definition -CREATE TABLE IF NOT EXISTS `t_object_storage_file_replica` -( - `id` bigint unsigned NOT NULL COMMENT '副本ID', - `file_id` bigint unsigned NOT NULL COMMENT '文件ID', - `provider` varchar(64) NOT NULL COMMENT '对象存储提供方', - `object_name` varchar(512) NOT NULL COMMENT '对象Key', - `object_url` text NULL COMMENT '对象访问地址', - `upload_status` tinyint unsigned NOT NULL DEFAULT 0 COMMENT '上传状态:0-待上传,1-成功,2-失败', - `retry_count` int unsigned NOT NULL DEFAULT 0 COMMENT '重试次数', - `last_error` varchar(500) NULL COMMENT '最近一次错误', - `uploaded_at` datetime NULL COMMENT '上传成功时间', - `last_retry_time` datetime NULL COMMENT '最近一次重试时间', - `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', - `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', - PRIMARY KEY (`id`), - UNIQUE KEY `uk_object_storage_file_replica_file_provider` (`file_id`, `provider`), - KEY `idx_object_storage_file_replica_retry` (`upload_status`, `provider`, `file_id`), - KEY `idx_object_storage_file_replica_file_status` (`file_id`, `upload_status`) -) ENGINE = InnoDB - DEFAULT CHARSET = utf8mb4 - COLLATE = utf8mb4_unicode_ci - COMMENT = '对象存储文件副本表'; - --- auto-generated definition -create table t_order -( - id bigint unsigned auto_increment comment '订单主键索引' - primary key, - order_no varchar(50) not null comment '订单编号', - user_id bigint unsigned not null comment '关联用户表主键', - shop_id bigint unsigned null comment '所属店铺ID', - total_amount decimal(10, 2) not null comment '订单总金额', - actual_amount decimal(10, 2) not null comment '实际支付金额', - coupon_id bigint unsigned default 0 null comment '使用的优惠券ID', - user_coupon_id bigint unsigned null comment '用户券ID', - coupon_source_type varchar(32) null comment '优惠来源类型', - status tinyint unsigned default 1 not null comment '订单状态:1-待使用,2-已完成,3-已取消', - create_time datetime default CURRENT_TIMESTAMP not null comment '创建时间', - update_time datetime default CURRENT_TIMESTAMP not null on update CURRENT_TIMESTAMP comment '更新时间', - is_delete tinyint unsigned default 0 null comment '逻辑删除:0-未删,1-已删', - constraint uk_order_no - unique (order_no) comment '订单编号唯一索引' -) - comment '订单表'; - -create index idx_status - on t_order (status) - comment '按状态查询订单的索引'; - -create index idx_user_id - on t_order (user_id) - comment '按用户查询订单的索引'; - --- auto-generated definition -create table t_order_item -( - id bigint unsigned auto_increment comment '订单商品主键索引' - primary key, - order_id bigint unsigned not null comment '关联订单表主键', - product_id bigint unsigned not null comment '关联商品表主键', - quantity int unsigned not null comment '商品数量', - price decimal(10, 2) not null comment '商品单价', - artist_id bigint unsigned null comment '关联美甲师ID', - appointment_time datetime null comment '预约开始时间', - create_time datetime default CURRENT_TIMESTAMP not null comment '创建时间', - update_time datetime default CURRENT_TIMESTAMP not null on update CURRENT_TIMESTAMP comment '更新时间', - is_delete tinyint unsigned default 0 null comment '逻辑删除:0-未删,1-已删' -) - comment '订单商品表'; - -create index idx_order_id - on t_order_item (order_id) - comment '按订单查询商品的索引'; - -CREATE TABLE IF NOT EXISTS t_order_artist_review -( - id bigint unsigned auto_increment comment '评价任务ID' - primary key, - order_id bigint unsigned not null comment '订单ID', - order_item_id bigint unsigned not null comment '订单项ID', - customer_id bigint unsigned not null comment '下单客户ID', - shop_id bigint unsigned null comment '店铺ID', - artist_id bigint unsigned not null comment '被评价美甲师ID', - product_id bigint unsigned null comment '商品ID', - rating_score decimal(2, 1) null comment '评分,提交后必填0.5-5', - content varchar(1000) null comment '评价文字', - image_file_ids text null comment '评价图片文件ID集合', - status tinyint unsigned default 0 not null comment '状态:0-待评价,1-已评价', - reminder_message_id bigint unsigned null comment '提醒消息ID', - submitted_at datetime null comment '提交时间', - create_time datetime default CURRENT_TIMESTAMP not null comment '创建时间', - update_time datetime default CURRENT_TIMESTAMP not null on update CURRENT_TIMESTAMP comment '更新时间', - is_delete tinyint unsigned default 0 null comment '逻辑删除:0-未删,1-已删' -) - comment '订单美甲师评价任务表'; - -create unique index uk_order_artist_review_item - on t_order_artist_review (order_item_id, is_delete); - -create index idx_order_artist_review_customer - on t_order_artist_review (customer_id, status, create_time); - -create index idx_order_artist_review_artist - on t_order_artist_review (artist_id, status); - -CREATE TABLE IF NOT EXISTS t_order_artist_change_request -( - id bigint unsigned auto_increment comment '改派申请ID' - primary key, - order_id bigint unsigned not null comment '订单ID', - order_item_id bigint unsigned not null comment '订单项ID', - customer_id bigint unsigned not null comment '下单客户ID', - shop_id bigint unsigned null comment '店铺ID', - product_id bigint unsigned null comment '商品ID', - from_artist_id bigint unsigned not null comment '原美甲师ID', - to_artist_id bigint unsigned not null comment '新美甲师ID', - requester_id bigint unsigned not null comment '申请人ID', - status varchar(20) default 'PENDING' not null comment '状态:PENDING/APPROVED/REJECTED', - reason varchar(500) null comment '申请原因', - reject_reason varchar(500) null comment '拒绝原因', - message_id bigint unsigned null comment '提醒消息ID', - pending_key varchar(80) null comment '待处理唯一键,PENDING时为订单项维度', - approved_time datetime null comment '同意时间', - rejected_time datetime null comment '拒绝时间', - expire_time datetime null comment '过期时间', - create_time datetime default CURRENT_TIMESTAMP not null comment '创建时间', - update_time datetime default CURRENT_TIMESTAMP not null on update CURRENT_TIMESTAMP comment '更新时间', - is_delete tinyint unsigned default 0 null comment '逻辑删除:0-未删,1-已删' -) - comment '订单美甲师改派申请表'; - -create index idx_order_artist_change_customer - on t_order_artist_change_request (customer_id, status, create_time); - -create index idx_order_artist_change_artist - on t_order_artist_change_request (from_artist_id, to_artist_id, status); - -create index idx_order_artist_change_shop - on t_order_artist_change_request (shop_id, status, create_time); - -create unique index uk_order_artist_change_pending_key - on t_order_artist_change_request (pending_key); - --- auto-generated definition -create table t_permission -( - id bigint unsigned auto_increment comment '权限唯一主键ID' - primary key, - permission_code varchar(100) not null comment '权限编码(唯一标识)', - permission_name varchar(100) not null comment '权限名称', - permission_group varchar(50) not null comment '权限分组(商品管理、用户管理等)', - description varchar(255) null comment '权限描述', - create_time datetime default CURRENT_TIMESTAMP not null comment '创建时间', - update_time datetime default CURRENT_TIMESTAMP not null on update CURRENT_TIMESTAMP comment '更新时间', - is_delete tinyint unsigned default 0 null comment '逻辑删除:0-未删,1-已删', - constraint uk_permission_code - unique (permission_code) comment '权限编码唯一索引' -) - comment '系统权限表'; - --- auto-generated definition -create table t_product -( - id bigint unsigned auto_increment comment '商品唯一主键ID(雪花id)' - primary key comment '商品主键索引', - shop_id bigint unsigned not null comment '所属店铺ID,关联店铺表主键', - title varchar(100) not null comment '商品标题', - description text null comment '商品描述', - target_audience text null comment '适合人群说明', - precautions text null comment '注意事项说明', - image_file_ids text null comment '图片文件ID集合,多个ID以逗号分隔', - price decimal(10, 2) not null comment '商品价格,保留2位小数', - tags varchar(512) default '' null comment '标签集合,多个标签以逗号分隔,最多5个', - like_count int unsigned default 0 null comment '商品点赞数', - collect_count int unsigned default 0 null comment '商品收藏数', - approximate_duration varchar(50) default '' null comment '商品对应的服务大约耗时(如“30分钟”)', - bookable_artists varchar(200) default '' null comment '可预约的美甲师ID集合,多个ID以逗号分隔', - available_coupons text null comment '可用的优惠券ID集合,多个ID以逗号分隔', - front_visible tinyint unsigned default 1 not null comment '前台是否展示:0-隐藏,1-展示', - source_type varchar(64) default 'BACKEND' not null comment '来源类型:BACKEND-后台维护,MANAGER_APPOINTMENT-管理师端手动预约', - create_time datetime default CURRENT_TIMESTAMP not null comment '商品创建时间', - update_time datetime default CURRENT_TIMESTAMP not null on update CURRENT_TIMESTAMP comment '商品信息最后更新时间', - is_delete tinyint unsigned default 0 null comment '逻辑删除标识:0-未删除,1-已删除' -) - comment '商品信息表'; - -create index idx_price - on t_product (price) - comment '按价格筛选商品的索引'; - -create index idx_shop_id - on t_product (shop_id) - comment '按所属店铺查询商品的索引'; - -create index idx_tags - on t_product (tags) - comment '按标签筛选商品的索引'; - -create index idx_title - on t_product (title) - comment '商品标题搜索的索引'; - -create index idx_t_product_front_visible - on t_product (shop_id, front_visible, source_type) - comment '按门店、前台展示和来源筛选商品'; - --- auto-generated definition -create table t_product_like -( - id bigint unsigned auto_increment comment '商品点赞主键索引' - primary key, - user_id bigint unsigned not null comment '关联用户表主键', - product_id bigint unsigned not null comment '关联商品表主键', - create_time datetime default CURRENT_TIMESTAMP not null comment '创建时间', - update_time datetime default CURRENT_TIMESTAMP not null on update CURRENT_TIMESTAMP comment '更新时间', - is_delete tinyint unsigned default 0 null comment '逻辑删除:0-未删除,1-已删除', - constraint uk_user_product_like - unique (user_id, product_id) comment '用户-商品唯一索引' -) - comment '商品点赞记录表'; - -create index idx_product_id_like - on t_product_like (product_id) - comment '按商品查询点赞的索引'; - -create index idx_user_id_like - on t_product_like (user_id) - comment '按用户查询点赞的索引'; - --- auto-generated definition -create table t_shop -( - id bigint unsigned auto_increment comment '店铺唯一主键ID' - primary key comment '店铺主键索引', - shop_name varchar(100) not null comment '店铺名称', - description text null comment '店铺描述', - address varchar(200) not null comment '店铺地址', - map_provider varchar(20) default 'TENCENT' not null comment '地图服务商:TENCENT/AMAP', - longitude decimal(12, 8) null comment '店铺经度', - latitude decimal(12, 8) null comment '店铺纬度', - business_hours varchar(100) default '' null comment '店铺营业时间', - cover_image_file_id varchar(50) default '' null comment '店铺封面图文件ID', - theme_primary_color varchar(20) null comment '前台主题主色', - theme_secondary_color varchar(20) null comment '前台主题辅色', - theme_accent_color varchar(20) null comment '前台主题强调色', - theme_page_bg_color varchar(20) null comment '前台主题页面背景色', - theme_card_bg_color varchar(20) null comment '前台主题卡片背景色', - theme_background_image_file_id varchar(50) null comment '前台主题背景图文件ID', - status tinyint unsigned default 1 not null comment '店铺状态:1-启用,0-停用', - authorization_start_date date null comment '店铺授权起始日', - authorization_days int null comment '店铺授权有效天数', - authorization_expire_time datetime null comment '店铺授权到期时间', - create_time datetime default CURRENT_TIMESTAMP not null comment '创建时间', - update_time datetime default CURRENT_TIMESTAMP not null on update CURRENT_TIMESTAMP comment '更新时间', - is_delete tinyint unsigned default 0 null comment '逻辑删除:0-未删,1-已删', - image_file_ids text null comment '图片文件ID集合,多个ID以逗号分隔' -) - comment '店铺信息表'; - -create index idx_shop_name - on t_shop (shop_name) - comment '按店铺名称查询的索引'; - --- auto-generated definition -create table t_tag -( - id bigint unsigned auto_increment comment '标签唯一主键ID' - primary key comment '标签主键索引', - tag_name varchar(50) not null comment '标签名称', - text_color varchar(20) default '#333333' null comment '标签文字颜色(16进制)', - bg_color varchar(20) default '#FFFFFF' null comment '标签背景颜色(16进制)', - border_color varchar(20) default '#E5E5E5' null comment '标签边框颜色(16进制)', - scene_group varchar(50) null comment '前台场景筛选分组', - display_name varchar(80) null comment '前台展示名称', - sort_order int default 100 null comment '前台筛选排序', - front_visible tinyint unsigned default 1 null comment '前台筛选是否可见:1-可见,0-隐藏', - create_time datetime default CURRENT_TIMESTAMP not null comment '创建时间', - update_time datetime default CURRENT_TIMESTAMP not null on update CURRENT_TIMESTAMP comment '更新时间', - is_delete tinyint unsigned default 0 null comment '逻辑删除:0-未删,1-已删', - shop_id bigint null comment '店铺ID', - constraint uk_tag_shop_name - unique (shop_id, tag_name) comment '店铺内标签名称唯一索引' -) - comment '系统标签信息表'; - --- auto-generated definition -create table t_user -( - id bigint unsigned auto_increment comment '用户唯一主键ID(雪花ID)' - primary key comment '用户主键索引', - shop_id bigint unsigned default 0 null comment '所属店铺ID,关联店铺表主键(0表示无所属店铺)', - nickname varchar(50) not null comment '用户昵称', - account varchar(50) not null comment '用户账号(登录用)', - phone varchar(50) null comment '手机号', - contact_phone varchar(50) null comment '联系电话', - birthday date null comment '生日', - wechat_id varchar(100) null comment '微信号', - wechat_qr_code varchar(512) null comment '微信二维码', - email varchar(100) null comment '邮箱', - phone_verified tinyint unsigned default 0 null comment '手机号是否已验证:0-未验证,1-已验证', - email_verified tinyint unsigned default 0 null comment '邮箱是否已验证:0-未验证,1-已验证', - password varchar(100) not null comment '用户密码(加密存储)', - signature varchar(200) default '' null comment '用户签名', - level varchar(20) default '普通' null comment '用户等级', - type tinyint not null comment '用户类型,(0-用户,2-店长,3-美甲师,4-管理员)', - vip_id bigint unsigned default 0 null comment '关联VIP信息表主键(0表示非VIP)', - create_time datetime default CURRENT_TIMESTAMP not null comment '创建时间', - update_time datetime default CURRENT_TIMESTAMP not null on update CURRENT_TIMESTAMP comment '更新时间', - is_delete tinyint unsigned default 0 null comment '逻辑删除:0-未删,1-已删', - status tinyint unsigned default 1 null comment '用户状态:1-正常,0-禁用', - avatar varchar(512) null comment '头像链接', - constraint uk_account - unique (account) comment '用户账号唯一索引' -) - comment '系统用户信息表'; - -create index idx_email - on t_user (email) - comment '按邮箱查询的索引'; - -create index idx_phone - on t_user (phone) - comment '按手机号查询的索引'; - -create index idx_shop_id - on t_user (shop_id) - comment '按店铺查询用户的索引'; - -create index idx_type - on t_user (type) - comment '按用户类型查询的索引'; - --- auto-generated definition -create table t_user_coupon -( - id bigint unsigned auto_increment comment '用户优惠券关联主键索引' - primary key, - user_id bigint unsigned not null comment '关联用户表主键', - coupon_id bigint unsigned not null comment '关联优惠券表主键', - status tinyint unsigned default 1 not null comment '状态:1-未使用,2-已使用,3-已过期', - obtain_time datetime default CURRENT_TIMESTAMP not null comment '获取时间', - use_time datetime null comment '使用时间', - create_time datetime default CURRENT_TIMESTAMP not null comment '创建时间', - update_time datetime default CURRENT_TIMESTAMP not null on update CURRENT_TIMESTAMP comment '更新时间', - is_delete tinyint unsigned default 0 null comment '逻辑删除:0-未删,1-已删', - constraint uk_user_coupon - unique (user_id, coupon_id) comment '用户-优惠券唯一索引' -) - comment '用户优惠券关联表'; - -create index idx_status - on t_user_coupon (status) - comment '按状态查询用户优惠券的索引'; - -create index idx_user_id - on t_user_coupon (user_id) - comment '按用户查询优惠券的索引'; - --- auto-generated definition -create table t_user_permission -( - id bigint unsigned auto_increment comment '关联ID' - primary key, - user_id bigint unsigned not null comment '用户ID', - permission_id bigint unsigned not null comment '权限ID', - create_time datetime default CURRENT_TIMESTAMP not null comment '创建时间', - update_time datetime default CURRENT_TIMESTAMP not null on update CURRENT_TIMESTAMP comment '更新时间', - create_by bigint unsigned null comment '创建人ID', - update_by bigint unsigned null comment '更新人ID', - is_delete tinyint unsigned default 0 null comment '逻辑删除:0-未删,1-已删', - constraint uk_user_permission - unique (user_id, permission_id) comment '用户-权限唯一索引' -) - comment '用户权限关联表'; - -create index idx_permission_id - on t_user_permission (permission_id) - comment '权限ID索引'; - -create index idx_user_id - on t_user_permission (user_id) - comment '用户ID索引'; - -create table if not exists t_system_message -( - id bigint unsigned auto_increment comment '站内消息主键' - primary key, - title varchar(100) not null comment '消息标题', - content text not null comment '消息内容', - image_file_id bigint unsigned null comment '消息图片文件ID', - publisher_id bigint unsigned not null comment '发布人ID', - publisher_name varchar(100) default '' null comment '发布人名称', - publisher_type tinyint not null comment '发布人类型:2-店长,4-管理员', - target_type varchar(30) not null comment '目标范围:PLATFORM_ALL/CURRENT_SHOP_ALL/SHOP_ALL/SELECTED_SHOPS/SELECTED_USERS', - target_ids text null comment '目标ID集合,多个ID以逗号分隔', - business_type varchar(64) null comment '业务类型', - business_id bigint unsigned null comment '业务ID', - action_path varchar(255) null comment '业务跳转路径', - idempotency_key varchar(160) null comment '业务消息幂等键', - popup_enabled tinyint unsigned default 1 not null comment '是否弹窗:1-弹窗,0-不弹窗', - status tinyint unsigned default 1 not null comment '状态:1-已发布,0-已撤回', - publish_time datetime default CURRENT_TIMESTAMP not null comment '发布时间', - create_time datetime default CURRENT_TIMESTAMP not null comment '创建时间', - update_time datetime default CURRENT_TIMESTAMP not null on update CURRENT_TIMESTAMP comment '更新时间', - is_delete tinyint unsigned default 0 null comment '逻辑删除:0-未删,1-已删' -) - comment '站内消息表'; - -create index idx_t_system_message_publish_time - on t_system_message (publish_time); - -create index idx_t_system_message_target - on t_system_message (target_type, status); - -create unique index uk_t_system_message_idempotency - on t_system_message (idempotency_key); - -create table if not exists t_system_message_user_state -( - id bigint unsigned auto_increment comment '用户消息状态主键' - primary key, - message_id bigint unsigned not null comment '消息ID', - user_id bigint unsigned not null comment '用户ID', - popup_shown tinyint unsigned default 0 not null comment '是否已弹窗:1-是,0-否', - read_status tinyint unsigned default 0 not null comment '是否已读:1-是,0-否', - popup_time datetime null comment '首次弹窗时间', - read_time datetime null comment '阅读时间', - create_time datetime default CURRENT_TIMESTAMP not null comment '创建时间', - update_time datetime default CURRENT_TIMESTAMP not null on update CURRENT_TIMESTAMP comment '更新时间', - is_delete tinyint unsigned default 0 null comment '逻辑删除:0-未删,1-已删', - constraint uk_t_system_message_user - unique (message_id, user_id) -) - comment '用户站内消息状态表'; - -create index idx_t_system_message_user_state_user - on t_system_message_user_state (user_id, read_status, popup_shown); - -create table if not exists t_announcement -( - id bigint unsigned auto_increment comment '公告主键' - primary key, - title varchar(100) not null comment '公告标题', - content text not null comment '公告内容', - publisher_id bigint unsigned not null comment '发布人ID', - publisher_name varchar(100) default '' null comment '发布人名称', - publisher_type tinyint not null comment '发布人类型:2-店长,4-管理员', - target_type varchar(30) not null comment '目标范围', - target_ids text null comment '目标ID集合,多个ID以逗号分隔', - status tinyint unsigned default 1 not null comment '状态:1-已发布,0-已撤回', - sort_order int default 0 not null comment '排序值', - publish_time datetime default CURRENT_TIMESTAMP not null comment '发布时间', - create_time datetime default CURRENT_TIMESTAMP not null comment '创建时间', - update_time datetime default CURRENT_TIMESTAMP not null on update CURRENT_TIMESTAMP comment '更新时间', - is_delete tinyint unsigned default 0 null comment '逻辑删除:0-未删,1-已删' -) - comment '首页滚动公告表'; - -create index idx_t_announcement_target - on t_announcement (target_type, status); - -create index idx_t_announcement_sort_time - on t_announcement (sort_order, publish_time); - -create table if not exists t_vip_recharge_plan -( - id bigint unsigned auto_increment comment 'VIP充值档位主键' - primary key, - shop_id bigint unsigned not null comment '所属店铺ID', - title varchar(100) not null comment '档位标题', - recharge_amount decimal(10, 2) not null comment '充值金额', - gift_amount decimal(10, 2) default 0.00 not null comment '赠送金额', - vip_level varchar(20) not null comment '对应VIP等级', - description varchar(255) null comment '展示说明', - sort_order int default 0 not null comment '排序值', - status tinyint unsigned default 1 not null comment '状态:1-启用,0-停用', - create_time datetime default CURRENT_TIMESTAMP not null comment '创建时间', - update_time datetime default CURRENT_TIMESTAMP not null on update CURRENT_TIMESTAMP comment '更新时间', - is_delete tinyint unsigned default 0 null comment '逻辑删除:0-未删,1-已删' -) - comment 'VIP充值展示档位表'; - -create index idx_t_vip_recharge_plan_shop_status - on t_vip_recharge_plan (shop_id, status, sort_order); - --- auto-generated definition -create table t_vip_benefit -( - id bigint unsigned auto_increment comment 'VIP权益唯一主键ID(雪花ID)' - primary key comment 'VIP权益主键索引', - benefit_info text not null comment '权益详情(如折扣、专属服务)', - required_vip_level varchar(20) not null comment '所需VIP等级', - level_rank int default 0 not null comment '等级序号', - recharge_threshold decimal(10, 2) default 0.00 not null comment '累计充值门槛', - status tinyint unsigned default 1 not null comment '状态', - create_time datetime default CURRENT_TIMESTAMP not null comment '创建时间', - update_time datetime default CURRENT_TIMESTAMP not null on update CURRENT_TIMESTAMP comment '更新时间' -) - comment 'VIP权益信息表'; - -create index idx_required_vip_level - on t_vip_benefit (required_vip_level) - comment '按VIP等级查询权益的索引'; - --- auto-generated definition -create table t_vip_info -( - id bigint unsigned auto_increment comment 'VIP信息唯一主键ID(雪花ID)' - primary key comment 'VIP信息主键索引', - user_id bigint unsigned null comment '所属用户ID', - vip_level varchar(20) not null comment 'VIP等级(如青铜、白银)', - start_time datetime not null comment 'VIP开通时间', - expire_time datetime null comment 'VIP到期时间', - activation_method varchar(50) not null comment 'VIP开通方式(如购买、赠送)', - benefit_id bigint unsigned null comment '关联VIP权益信息表主键', - manual_override tinyint unsigned default 0 not null comment '是否手工覆盖VIP等级', - create_time datetime default CURRENT_TIMESTAMP not null comment '创建时间', - update_time datetime default CURRENT_TIMESTAMP not null on update CURRENT_TIMESTAMP comment '更新时间' -) - comment '用户VIP信息表'; - -create index idx_vip_level - on t_vip_info (vip_level) - comment '按VIP等级查询的索引'; - --- auto-generated definition -create table t_wishlist_group -( - id bigint unsigned auto_increment comment '收藏分组主键' - primary key, - user_id bigint unsigned not null comment '关联用户表主键', - name varchar(50) not null comment '分组名称,默认预设:最近想做、婚礼款、夏天款', - sort_order int default 100 not null comment '分组排序', - create_time datetime default CURRENT_TIMESTAMP not null comment '创建时间', - update_time datetime default CURRENT_TIMESTAMP not null on update CURRENT_TIMESTAMP comment '更新时间', - is_delete tinyint unsigned default 0 null comment '逻辑删除:0-未删除,1-已删除' -) - comment '商品收藏分组表'; - -create index idx_t_wishlist_group_sort - on t_wishlist_group (user_id, sort_order, create_time) - comment '按用户和排序查询收藏分组的索引'; - -create index idx_t_wishlist_group_user - on t_wishlist_group (user_id) - comment '按用户查询收藏分组的索引'; - --- auto-generated definition -create table t_wishlist -( - id bigint unsigned auto_increment comment '商品收藏主键索引' - primary key, - user_id bigint unsigned not null comment '关联用户表主键', - product_id bigint unsigned not null comment '关联商品表主键', - group_id bigint unsigned null comment '收藏分组ID', - note varchar(500) null comment '收藏灵感备注', - sort_order int default 100 not null comment '分组内排序', - create_time datetime default CURRENT_TIMESTAMP not null comment '创建时间', - update_time datetime default CURRENT_TIMESTAMP not null on update CURRENT_TIMESTAMP comment '更新时间', - is_delete tinyint unsigned default 0 null comment '逻辑删除:0-未删除,1-已删除', - constraint uk_user_product - unique (user_id, product_id) comment '用户-商品唯一索引' -) - comment '商品收藏表'; - -create index idx_product_id - on t_wishlist (product_id) - comment '按商品查询收藏的索引'; - -create index idx_user_id - on t_wishlist (user_id) - comment '按用户查询收藏的索引'; - -create index idx_t_wishlist_user_group_sort - on t_wishlist (user_id, group_id, sort_order, create_time) - comment '按用户分组查询收藏灵感的索引'; - --- ======================================== --- 首次部署整合区:用户资产 / VIP / 优惠券补丁 --- 来源:2026-03-20_user_asset_vip_coupon_permission_patch.sql --- ======================================== - -SET NAMES utf8mb4; - -DROP PROCEDURE IF EXISTS sp_add_column_if_not_exists; -DROP PROCEDURE IF EXISTS sp_add_index_if_not_exists; -DROP PROCEDURE IF EXISTS sp_add_unique_index_if_not_exists; - -DELIMITER $$ - -CREATE PROCEDURE sp_add_column_if_not_exists( - IN p_table_name VARCHAR(64), - IN p_column_name VARCHAR(64), - IN p_definition TEXT -) -BEGIN - IF NOT EXISTS ( - SELECT 1 - FROM information_schema.COLUMNS - WHERE TABLE_SCHEMA = DATABASE() - AND TABLE_NAME = p_table_name - AND COLUMN_NAME = p_column_name - ) THEN - SET @sql = CONCAT( - 'ALTER TABLE `', p_table_name, '` ADD COLUMN `', p_column_name, '` ', - p_definition - ); - PREPARE stmt FROM @sql; - EXECUTE stmt; - DEALLOCATE PREPARE stmt; - END IF; -END$$ - -CREATE PROCEDURE sp_add_index_if_not_exists( - IN p_table_name VARCHAR(64), - IN p_index_name VARCHAR(64), - IN p_columns TEXT -) -BEGIN - IF NOT EXISTS ( - SELECT 1 - FROM information_schema.STATISTICS - WHERE TABLE_SCHEMA = DATABASE() - AND TABLE_NAME = p_table_name - AND INDEX_NAME = p_index_name - ) THEN - SET @sql = CONCAT( - 'ALTER TABLE `', p_table_name, '` ADD INDEX `', p_index_name, '` ', - p_columns - ); - PREPARE stmt FROM @sql; - EXECUTE stmt; - DEALLOCATE PREPARE stmt; - END IF; -END$$ - -CREATE PROCEDURE sp_add_unique_index_if_not_exists( - IN p_table_name VARCHAR(64), - IN p_index_name VARCHAR(64), - IN p_columns TEXT -) -BEGIN - IF NOT EXISTS ( - SELECT 1 - FROM information_schema.STATISTICS - WHERE TABLE_SCHEMA = DATABASE() - AND TABLE_NAME = p_table_name - AND INDEX_NAME = p_index_name - ) THEN - SET @sql = CONCAT( - 'ALTER TABLE `', p_table_name, '` ADD UNIQUE INDEX `', p_index_name, '` ', - p_columns - ); - PREPARE stmt FROM @sql; - EXECUTE stmt; - DEALLOCATE PREPARE stmt; - END IF; -END$$ - -DELIMITER ; - -CALL sp_add_column_if_not_exists('t_balance', 'total_recharge_amount', 'decimal(10,2) NOT NULL DEFAULT 0.00 COMMENT ''累计充值金额'''); -CALL sp_add_column_if_not_exists('t_balance', 'last_recharge_time', 'datetime NULL COMMENT ''最近一次充值时间'''); -CALL sp_add_column_if_not_exists('t_balance', 'update_time', 'datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT ''更新时间'''); - -CALL sp_add_column_if_not_exists('t_object_storage_file', 'object_name', 'varchar(512) NULL COMMENT ''????Key'''); -CALL sp_add_column_if_not_exists('t_object_storage_file', 'primary_provider', 'varchar(64) NULL COMMENT ''??????'''); -CALL sp_add_column_if_not_exists('t_object_storage_file', 'primary_url', 'text NULL COMMENT ''???????'''); -CALL sp_add_column_if_not_exists('t_object_storage_file', 'backup_provider', 'varchar(64) NULL COMMENT ''???????'''); -CALL sp_add_column_if_not_exists('t_object_storage_file', 'backup_url', 'text NULL COMMENT ''????????'''); -CALL sp_add_column_if_not_exists('t_object_storage_file', 'content_type', 'varchar(128) NULL COMMENT ''??Content-Type'''); -CALL sp_add_column_if_not_exists('t_object_storage_file', 'file_size', 'bigint unsigned NULL COMMENT ''?????????'''); -CALL sp_add_column_if_not_exists('t_object_storage_file', 'primary_upload_status', 'tinyint unsigned NOT NULL DEFAULT 0 COMMENT ''????????0????1???2??'''); -CALL sp_add_column_if_not_exists('t_object_storage_file', 'backup_upload_status', 'tinyint unsigned NOT NULL DEFAULT 0 COMMENT ''?????????0????1???2??'''); -CALL sp_add_column_if_not_exists('t_object_storage_file', 'backup_retry_count', 'int unsigned NOT NULL DEFAULT 0 COMMENT ''??????'''); -CALL sp_add_column_if_not_exists('t_object_storage_file', 'backup_last_error', 'varchar(500) NULL COMMENT ''??????????'''); -CALL sp_add_column_if_not_exists('t_object_storage_file', 'backup_uploaded_at', 'datetime NULL COMMENT ''??????'''); -CALL sp_add_column_if_not_exists('t_object_storage_file', 'backup_last_retry_time', 'datetime NULL COMMENT ''??????????'''); -UPDATE t_object_storage_file -SET primary_provider = COALESCE(primary_provider, 'QINIU_KODO'), - primary_url = COALESCE(primary_url, file_url), - backup_provider = COALESCE(backup_provider, 'ALIYUN_OSS'), - primary_upload_status = CASE WHEN primary_upload_status IS NULL OR primary_upload_status = 0 THEN 1 ELSE primary_upload_status END, - backup_upload_status = COALESCE(backup_upload_status, 0), - backup_retry_count = COALESCE(backup_retry_count, 0) -WHERE status = 1; -CALL sp_add_index_if_not_exists('t_object_storage_file', 'idx_object_storage_file_backup_retry', '(`backup_upload_status`, `primary_upload_status`, `status`)'); -UPDATE t_balance -SET total_recharge_amount = COALESCE(total_recharge_amount, 0.00) -WHERE total_recharge_amount IS NULL; - -CALL sp_add_column_if_not_exists('t_balance_change_detail', 'before_balance', 'decimal(10,2) NULL COMMENT ''变动前余额'''); -CALL sp_add_column_if_not_exists('t_balance_change_detail', 'after_balance', 'decimal(10,2) NULL COMMENT ''变动后余额'''); -CALL sp_add_column_if_not_exists('t_balance_change_detail', 'change_scene', 'varchar(32) NULL COMMENT ''余额变动场景'''); -CALL sp_add_column_if_not_exists('t_balance_change_detail', 'related_order_id', 'bigint unsigned NULL COMMENT ''关联系统订单ID'''); -CALL sp_add_column_if_not_exists('t_balance_change_detail', 'related_order_no', 'varchar(64) NULL COMMENT ''关联系统订单号'''); -CALL sp_add_column_if_not_exists('t_balance_change_detail', 'external_order_no', 'varchar(64) NULL COMMENT ''手工录入的外部订单号'''); -CALL sp_add_column_if_not_exists('t_balance_change_detail', 'operator_id', 'bigint unsigned NULL COMMENT ''操作人ID'''); -CALL sp_add_column_if_not_exists('t_balance_change_detail', 'remark', 'varchar(255) NULL COMMENT ''备注'''); -CALL sp_add_column_if_not_exists('t_login_identity', 'create_time', 'datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT ''创建时间'''); - -CALL sp_add_column_if_not_exists('t_user', 'contact_phone', 'varchar(50) NULL COMMENT ''联系电话'''); -CALL sp_add_column_if_not_exists('t_user', 'birthday', 'date NULL COMMENT ''生日'''); -CALL sp_add_column_if_not_exists('t_user', 'wechat_id', 'varchar(100) NULL COMMENT ''微信号'''); -CALL sp_add_column_if_not_exists('t_user', 'wechat_qr_code', 'varchar(512) NULL COMMENT ''微信二维码'''); - -UPDATE t_balance_change_detail -SET before_balance = COALESCE(before_balance, current_balance - amount), - after_balance = COALESCE(after_balance, current_balance), - change_scene = COALESCE(NULLIF(change_scene, ''), type) -WHERE before_balance IS NULL - OR after_balance IS NULL - OR change_scene IS NULL - OR change_scene = ''; - -CALL sp_add_index_if_not_exists('t_balance_change_detail', 'idx_balance_detail_related_order_id', '(`related_order_id`)'); -CALL sp_add_index_if_not_exists('t_balance_change_detail', 'idx_balance_detail_operator_id', '(`operator_id`)'); - -CALL sp_add_column_if_not_exists('t_order', 'shop_id', 'bigint unsigned NULL COMMENT ''所属店铺ID'''); -CALL sp_add_column_if_not_exists('t_order', 'user_coupon_id', 'bigint unsigned NULL COMMENT ''用户券ID'''); - -CALL sp_add_column_if_not_exists('t_order_item', 'appointment_time', 'datetime NULL COMMENT ''预约开始时间'''); -CALL sp_add_index_if_not_exists('t_order_item', 'idx_t_order_item_artist_appointment_time', '(`artist_id`, `appointment_time`)'); - -SET @drop_old_tag_unique_sql = ( - SELECT IF( - EXISTS( - SELECT 1 - FROM information_schema.STATISTICS - WHERE TABLE_SCHEMA = DATABASE() - AND TABLE_NAME = 't_tag' - AND INDEX_NAME = 'uk_tag_name' - ), - 'ALTER TABLE `t_tag` DROP INDEX `uk_tag_name`', - 'SELECT 1' - ) -); -PREPARE stmt FROM @drop_old_tag_unique_sql; -EXECUTE stmt; -DEALLOCATE PREPARE stmt; - -CALL sp_add_unique_index_if_not_exists('t_tag', 'uk_tag_shop_name', '(`shop_id`, `tag_name`)'); -CALL sp_add_column_if_not_exists('t_tag', 'scene_group', 'varchar(50) NULL COMMENT ''前台场景筛选分组'''); -CALL sp_add_column_if_not_exists('t_tag', 'display_name', 'varchar(80) NULL COMMENT ''前台展示名称'''); -CALL sp_add_column_if_not_exists('t_tag', 'sort_order', 'int NULL DEFAULT 100 COMMENT ''前台筛选排序'''); -CALL sp_add_column_if_not_exists('t_tag', 'front_visible', 'tinyint unsigned NOT NULL DEFAULT 1 COMMENT ''前台筛选是否可见:1-可见,0-隐藏'''); -UPDATE t_tag -SET front_visible = 1 -WHERE front_visible IS NULL; -CALL sp_add_index_if_not_exists('t_tag', 'idx_t_tag_front_filter', '(`shop_id`, `front_visible`, `scene_group`, `sort_order`, `is_delete`)'); - -CALL sp_add_column_if_not_exists('t_coupon', 'coupon_scene', 'varchar(32) NOT NULL DEFAULT ''NORMAL'' COMMENT ''优惠券场景'''); -CALL sp_add_column_if_not_exists('t_coupon', 'required_vip_level', 'varchar(20) NULL COMMENT ''要求的VIP等级'''); -CALL sp_add_column_if_not_exists('t_coupon', 'auto_match', 'tinyint unsigned NOT NULL DEFAULT 0 COMMENT ''是否自动匹配'''); - -UPDATE t_coupon -SET coupon_scene = COALESCE(NULLIF(coupon_scene, ''), 'NORMAL'), - auto_match = COALESCE(auto_match, 0) -WHERE coupon_scene IS NULL - OR coupon_scene = '' - OR auto_match IS NULL; - -CALL sp_add_index_if_not_exists('t_coupon', 'idx_t_coupon_scene_auto_match', '(`coupon_scene`, `auto_match`)'); -CALL sp_add_index_if_not_exists('t_coupon', 'idx_t_coupon_required_vip_level', '(`required_vip_level`)'); - -CALL sp_add_column_if_not_exists('t_vip_benefit', 'level_rank', 'int NOT NULL DEFAULT 0 COMMENT ''等级序号'''); -CALL sp_add_column_if_not_exists('t_vip_benefit', 'recharge_threshold', 'decimal(10,2) NOT NULL DEFAULT 0.00 COMMENT ''累计充值门槛'''); -CALL sp_add_column_if_not_exists('t_vip_benefit', 'status', 'tinyint unsigned NOT NULL DEFAULT 1 COMMENT ''状态'''); - -UPDATE t_vip_benefit -SET level_rank = CASE required_vip_level - WHEN '普通' THEN 0 - WHEN '青铜' THEN 1 - WHEN '白银' THEN 2 - WHEN '黄金' THEN 3 - ELSE level_rank - END, - recharge_threshold = CASE required_vip_level - WHEN '普通' THEN 0.00 - WHEN '青铜' THEN 500.00 - WHEN '白银' THEN 1000.00 - WHEN '黄金' THEN 2000.00 - ELSE recharge_threshold - END, - status = COALESCE(status, 1) -WHERE required_vip_level IN ('普通', '青铜', '白银', '黄金'); - -CALL sp_add_index_if_not_exists('t_vip_benefit', 'idx_t_vip_benefit_status_rank', '(`status`, `level_rank`)'); - -CALL sp_add_column_if_not_exists('t_vip_info', 'user_id', 'bigint unsigned NULL COMMENT ''所属用户ID'''); -CALL sp_add_column_if_not_exists('t_vip_info', 'manual_override', 'tinyint unsigned NOT NULL DEFAULT 0 COMMENT ''是否手工覆盖VIP等级'''); - -ALTER TABLE t_vip_info - MODIFY COLUMN expire_time datetime NULL COMMENT 'VIP到期时间', - MODIFY COLUMN benefit_id bigint unsigned NULL COMMENT '关联VIP权益信息表主键'; - -UPDATE t_vip_info vi -INNER JOIN t_user u ON u.vip_id = vi.id -SET vi.user_id = u.id -WHERE (vi.user_id IS NULL OR vi.user_id = 0) - AND u.vip_id IS NOT NULL - AND u.vip_id <> 0; - -UPDATE t_vip_info -SET start_time = COALESCE(start_time, create_time, NOW()), - activation_method = COALESCE(NULLIF(activation_method, ''), 'INIT'), - manual_override = COALESCE(manual_override, 0); - -CALL sp_add_unique_index_if_not_exists('t_vip_info', 'uk_t_vip_info_user_id', '(`user_id`)'); -CALL sp_add_index_if_not_exists('t_vip_info', 'idx_t_vip_info_manual_override', '(`manual_override`)'); - -UPDATE t_user u -LEFT JOIN t_vip_info vi ON vi.id = u.vip_id -SET u.level = CASE - WHEN u.type = 0 AND u.vip_id IS NOT NULL AND u.vip_id <> 0 AND vi.vip_level IS NOT NULL THEN vi.vip_level - WHEN u.type = 0 THEN '普通' - ELSE u.level - END, - u.vip_id = CASE - WHEN u.type = 0 AND u.vip_id IS NULL THEN 0 - ELSE u.vip_id - END, - u.update_time = NOW() -WHERE u.is_delete = 0 - AND u.type = 0 - AND (u.level IS NULL OR u.level = '' OR u.vip_id IS NULL); - -UPDATE t_vip_benefit -SET benefit_info = '普通用户,无额外VIP折扣', - level_rank = 0, - recharge_threshold = 0.00, - status = 1, - update_time = NOW() -WHERE required_vip_level = '普通'; - -INSERT INTO t_vip_benefit (benefit_info, required_vip_level, level_rank, recharge_threshold, status, create_time, update_time) -SELECT '普通用户,无额外VIP折扣', '普通', 0, 0.00, 1, NOW(), NOW() -WHERE NOT EXISTS ( - SELECT 1 - FROM t_vip_benefit - WHERE required_vip_level = '普通' -); - -UPDATE t_vip_benefit -SET benefit_info = '青铜VIP,系统自动匹配9.5折券', - level_rank = 1, - recharge_threshold = 500.00, - status = 1, - update_time = NOW() -WHERE required_vip_level = '青铜'; - -INSERT INTO t_vip_benefit (benefit_info, required_vip_level, level_rank, recharge_threshold, status, create_time, update_time) -SELECT '青铜VIP,系统自动匹配9.5折券', '青铜', 1, 500.00, 1, NOW(), NOW() -WHERE NOT EXISTS ( - SELECT 1 - FROM t_vip_benefit - WHERE required_vip_level = '青铜' -); - -UPDATE t_vip_benefit -SET benefit_info = '白银VIP,系统自动匹配9.2折券', - level_rank = 2, - recharge_threshold = 1000.00, - status = 1, - update_time = NOW() -WHERE required_vip_level = '白银'; - -INSERT INTO t_vip_benefit (benefit_info, required_vip_level, level_rank, recharge_threshold, status, create_time, update_time) -SELECT '白银VIP,系统自动匹配9.2折券', '白银', 2, 1000.00, 1, NOW(), NOW() -WHERE NOT EXISTS ( - SELECT 1 - FROM t_vip_benefit - WHERE required_vip_level = '白银' -); - -UPDATE t_vip_benefit -SET benefit_info = '黄金VIP,系统自动匹配9.0折券', - level_rank = 3, - recharge_threshold = 2000.00, - status = 1, - update_time = NOW() -WHERE required_vip_level = '黄金'; - -INSERT INTO t_vip_benefit (benefit_info, required_vip_level, level_rank, recharge_threshold, status, create_time, update_time) -SELECT '黄金VIP,系统自动匹配9.0折券', '黄金', 3, 2000.00, 1, NOW(), NOW() -WHERE NOT EXISTS ( - SELECT 1 - FROM t_vip_benefit - WHERE required_vip_level = '黄金' -); - -DROP PROCEDURE IF EXISTS sp_add_column_if_not_exists; -DROP PROCEDURE IF EXISTS sp_add_index_if_not_exists; -DROP PROCEDURE IF EXISTS sp_add_unique_index_if_not_exists; - --- ======================================== --- 首次部署整合区:多店铺登录 / 店铺状态 / 用户店铺绑定补丁 --- 来源:2026-03-25_user_shop_binding_and_shop_status_patch.sql --- ======================================== - -SET NAMES utf8mb4; - -DROP PROCEDURE IF EXISTS sp_add_column_if_not_exists; -DROP PROCEDURE IF EXISTS sp_add_index_if_not_exists; -DROP PROCEDURE IF EXISTS sp_add_unique_index_if_not_exists; - -DELIMITER $$ - -CREATE PROCEDURE sp_add_column_if_not_exists( - IN p_table_name VARCHAR(64), - IN p_column_name VARCHAR(64), - IN p_definition TEXT -) -BEGIN - IF NOT EXISTS ( - SELECT 1 - FROM information_schema.COLUMNS - WHERE TABLE_SCHEMA = DATABASE() - AND TABLE_NAME = p_table_name - AND COLUMN_NAME = p_column_name - ) THEN - SET @sql = CONCAT( - 'ALTER TABLE `', p_table_name, '` ADD COLUMN `', p_column_name, '` ', - p_definition - ); - PREPARE stmt FROM @sql; - EXECUTE stmt; - DEALLOCATE PREPARE stmt; - END IF; -END$$ - -CREATE PROCEDURE sp_add_index_if_not_exists( - IN p_table_name VARCHAR(64), - IN p_index_name VARCHAR(64), - IN p_columns TEXT -) -BEGIN - IF NOT EXISTS ( - SELECT 1 - FROM information_schema.STATISTICS - WHERE TABLE_SCHEMA = DATABASE() - AND TABLE_NAME = p_table_name - AND INDEX_NAME = p_index_name - ) THEN - SET @sql = CONCAT( - 'ALTER TABLE `', p_table_name, '` ADD INDEX `', p_index_name, '` ', - p_columns - ); - PREPARE stmt FROM @sql; - EXECUTE stmt; - DEALLOCATE PREPARE stmt; - END IF; -END$$ - -CREATE PROCEDURE sp_add_unique_index_if_not_exists( - IN p_table_name VARCHAR(64), - IN p_index_name VARCHAR(64), - IN p_columns TEXT -) -BEGIN - IF NOT EXISTS ( - SELECT 1 - FROM information_schema.STATISTICS - WHERE TABLE_SCHEMA = DATABASE() - AND TABLE_NAME = p_table_name - AND INDEX_NAME = p_index_name - ) THEN - SET @sql = CONCAT( - 'ALTER TABLE `', p_table_name, '` ADD UNIQUE INDEX `', p_index_name, '` ', - p_columns - ); - PREPARE stmt FROM @sql; - EXECUTE stmt; - DEALLOCATE PREPARE stmt; - END IF; -END$$ - -DELIMITER ; - -CALL sp_add_column_if_not_exists('t_shop', 'status', 'tinyint unsigned NOT NULL DEFAULT 1 COMMENT ''店铺状态:1-启用,0-停用'''); -CALL sp_add_column_if_not_exists('t_shop', 'authorization_start_date', 'date NULL COMMENT ''店铺授权起始日'''); -CALL sp_add_column_if_not_exists('t_shop', 'authorization_days', 'int NULL COMMENT ''店铺授权有效天数'''); -CALL sp_add_column_if_not_exists('t_shop', 'authorization_expire_time', 'datetime NULL COMMENT ''店铺授权有效期,空表示长期有效'''); -CALL sp_add_column_if_not_exists('t_shop', 'map_provider', 'varchar(20) NOT NULL DEFAULT ''TENCENT'' COMMENT ''地图服务商:TENCENT/AMAP'''); -CALL sp_add_column_if_not_exists('t_shop', 'longitude', 'decimal(12,8) NULL COMMENT ''店铺经度'''); -CALL sp_add_column_if_not_exists('t_shop', 'latitude', 'decimal(12,8) NULL COMMENT ''店铺纬度'''); -CALL sp_add_column_if_not_exists('t_shop', 'theme_primary_color', 'varchar(20) NULL COMMENT ''前台主题主色'''); -CALL sp_add_column_if_not_exists('t_shop', 'theme_secondary_color', 'varchar(20) NULL COMMENT ''前台主题辅色'''); -CALL sp_add_column_if_not_exists('t_shop', 'theme_accent_color', 'varchar(20) NULL COMMENT ''前台主题强调色'''); -CALL sp_add_column_if_not_exists('t_shop', 'theme_page_bg_color', 'varchar(20) NULL COMMENT ''前台主题页面背景色'''); -CALL sp_add_column_if_not_exists('t_shop', 'theme_card_bg_color', 'varchar(20) NULL COMMENT ''前台主题卡片背景色'''); -CALL sp_add_column_if_not_exists('t_shop', 'theme_background_image_file_id', 'varchar(50) NULL COMMENT ''前台主题背景图文件ID'''); - -UPDATE t_shop -SET status = 1 -WHERE status IS NULL; - -CALL sp_add_index_if_not_exists('t_shop', 'idx_t_shop_status', '(`status`)'); - -CREATE TABLE IF NOT EXISTS `t_user_shop_binding` ( - `id` bigint unsigned NOT NULL AUTO_INCREMENT COMMENT '用户店铺绑定主键ID', - `user_id` bigint unsigned NOT NULL COMMENT '用户ID', - `shop_id` bigint unsigned NOT NULL COMMENT '店铺ID', - `status` tinyint unsigned NOT NULL DEFAULT 1 COMMENT '绑定状态:1-正常,0-禁用', - `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', - `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', - `is_delete` tinyint unsigned DEFAULT 0 COMMENT '逻辑删除:0-未删,1-已删', - PRIMARY KEY (`id`) -) COMMENT='用户与店铺绑定关系表'; - -CALL sp_add_column_if_not_exists('t_user_shop_binding', 'status', 'tinyint unsigned NOT NULL DEFAULT 1 COMMENT ''绑定状态:1-正常,0-禁用'''); -CALL sp_add_column_if_not_exists('t_user_shop_binding', 'create_time', 'datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT ''创建时间'''); -CALL sp_add_column_if_not_exists('t_user_shop_binding', 'update_time', 'datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT ''更新时间'''); -CALL sp_add_column_if_not_exists('t_user_shop_binding', 'is_delete', 'tinyint unsigned DEFAULT 0 COMMENT ''逻辑删除:0-未删,1-已删'''); - -CALL sp_add_index_if_not_exists('t_user_shop_binding', 'idx_t_user_shop_binding_user_id', '(`user_id`)'); -CALL sp_add_index_if_not_exists('t_user_shop_binding', 'idx_t_user_shop_binding_shop_id', '(`shop_id`)'); -CALL sp_add_index_if_not_exists('t_user_shop_binding', 'idx_t_user_shop_binding_status', '(`status`)'); -CALL sp_add_unique_index_if_not_exists('t_user_shop_binding', 'uk_t_user_shop_binding_user_shop', '(`user_id`, `shop_id`)'); - -INSERT INTO t_user_shop_binding ( - user_id, - shop_id, - status, - create_time, - update_time, - is_delete -) -SELECT - u.id, - u.shop_id, - CASE - WHEN COALESCE(u.status, 1) = 1 THEN 1 - ELSE 0 - END AS binding_status, - COALESCE(u.create_time, NOW()), - COALESCE(u.update_time, NOW()), - 0 -FROM t_user u -INNER JOIN t_shop s ON s.id = u.shop_id AND COALESCE(s.is_delete, 0) = 0 -LEFT JOIN t_user_shop_binding b - ON b.user_id = u.id - AND b.shop_id = u.shop_id - AND COALESCE(b.is_delete, 0) = 0 -WHERE COALESCE(u.is_delete, 0) = 0 - AND u.shop_id IS NOT NULL - AND u.shop_id > 0 - AND b.id IS NULL; - -UPDATE t_user_shop_binding b -INNER JOIN t_user u ON u.id = b.user_id -SET b.status = CASE - WHEN b.status IS NULL THEN CASE WHEN COALESCE(u.status, 1) = 1 THEN 1 ELSE 0 END - ELSE b.status - END, - b.is_delete = COALESCE(b.is_delete, 0), - b.update_time = COALESCE(b.update_time, NOW()) -WHERE b.status IS NULL - OR b.is_delete IS NULL - OR b.update_time IS NULL; - -CALL sp_add_column_if_not_exists('t_nail_artist_info', 'participate_production', 'tinyint unsigned NOT NULL DEFAULT 1 COMMENT ''是否参与美甲制作:1-参与,0-不参与'''); -CALL sp_add_column_if_not_exists('t_nail_artist_info', 'work_start_time', 'time NULL COMMENT ''工作开始时间'''); -CALL sp_add_column_if_not_exists('t_nail_artist_info', 'work_end_time', 'time NULL COMMENT ''工作结束时间'''); -CALL sp_add_index_if_not_exists('t_nail_artist_info', 'idx_t_nail_artist_info_participate', '(`participate_production`, `status`)'); -CALL sp_add_column_if_not_exists('t_system_message', 'image_file_id', 'bigint unsigned NULL COMMENT ''消息图片文件ID'''); - -CALL sp_add_column_if_not_exists('t_system_message', 'business_type', 'varchar(64) NULL COMMENT ''业务类型'''); -CALL sp_add_column_if_not_exists('t_system_message', 'business_id', 'bigint unsigned NULL COMMENT ''业务ID'''); -CALL sp_add_column_if_not_exists('t_system_message', 'action_path', 'varchar(255) NULL COMMENT ''业务跳转路径'''); -CALL sp_add_column_if_not_exists('t_system_message', 'idempotency_key', 'varchar(160) NULL COMMENT ''业务消息幂等键'''); - -CREATE TABLE IF NOT EXISTS t_order_artist_review -( - id bigint unsigned auto_increment comment '评价任务ID' - primary key, - order_id bigint unsigned not null comment '订单ID', - order_item_id bigint unsigned not null comment '订单项ID', - customer_id bigint unsigned not null comment '下单客户ID', - shop_id bigint unsigned null comment '店铺ID', - artist_id bigint unsigned not null comment '被评价美甲师ID', - product_id bigint unsigned null comment '商品ID', - rating_score decimal(2, 1) null comment '评分,提交后必填0.5-5', - content varchar(1000) null comment '评价文字', - image_file_ids text null comment '评价图片文件ID集合', - status tinyint unsigned default 0 not null comment '状态:0-待评价,1-已评价', - reminder_message_id bigint unsigned null comment '提醒消息ID', - submitted_at datetime null comment '提交时间', - create_time datetime default CURRENT_TIMESTAMP not null comment '创建时间', - update_time datetime default CURRENT_TIMESTAMP not null on update CURRENT_TIMESTAMP comment '更新时间', - is_delete tinyint unsigned default 0 null comment '逻辑删除:0-未删,1-已删' -) - comment '订单美甲师评价任务表'; - -CREATE TABLE IF NOT EXISTS t_order_artist_change_request -( - id bigint unsigned auto_increment comment '改派申请ID' - primary key, - order_id bigint unsigned not null comment '订单ID', - order_item_id bigint unsigned not null comment '订单项ID', - customer_id bigint unsigned not null comment '下单客户ID', - shop_id bigint unsigned null comment '店铺ID', - product_id bigint unsigned null comment '商品ID', - from_artist_id bigint unsigned not null comment '原美甲师ID', - to_artist_id bigint unsigned not null comment '新美甲师ID', - requester_id bigint unsigned not null comment '申请人ID', - status varchar(20) default 'PENDING' not null comment '状态:PENDING/APPROVED/REJECTED', - reason varchar(500) null comment '申请原因', - reject_reason varchar(500) null comment '拒绝原因', - message_id bigint unsigned null comment '提醒消息ID', - pending_key varchar(80) null comment '待处理唯一键,PENDING时为订单项维度', - approved_time datetime null comment '同意时间', - rejected_time datetime null comment '拒绝时间', - expire_time datetime null comment '过期时间', - create_time datetime default CURRENT_TIMESTAMP not null comment '创建时间', - update_time datetime default CURRENT_TIMESTAMP not null on update CURRENT_TIMESTAMP comment '更新时间', - is_delete tinyint unsigned default 0 null comment '逻辑删除:0-未删,1-已删' -) - comment '订单美甲师改派申请表'; - -CALL sp_add_unique_index_if_not_exists('t_order_artist_review', 'uk_order_artist_review_item', '(`order_item_id`, `is_delete`)'); -CALL sp_add_index_if_not_exists('t_order_artist_review', 'idx_order_artist_review_customer', '(`customer_id`, `status`, `create_time`)'); -CALL sp_add_index_if_not_exists('t_order_artist_review', 'idx_order_artist_review_artist', '(`artist_id`, `status`)'); -CALL sp_add_index_if_not_exists('t_order_artist_review', 'idx_order_artist_review_order', '(`order_id`)'); -CALL sp_add_unique_index_if_not_exists('t_system_message', 'uk_t_system_message_idempotency', '(`idempotency_key`)'); -CALL sp_add_column_if_not_exists('t_order_artist_change_request', 'pending_key', 'varchar(80) NULL COMMENT ''待处理唯一键,PENDING时为订单项维度'''); -CALL sp_add_unique_index_if_not_exists('t_order_artist_change_request', 'uk_order_artist_change_pending_key', '(`pending_key`)'); -CALL sp_add_index_if_not_exists('t_order_artist_change_request', 'idx_order_artist_change_item_status', '(`order_item_id`, `status`, `is_delete`)'); -CALL sp_add_index_if_not_exists('t_order_artist_change_request', 'idx_order_artist_change_customer', '(`customer_id`, `status`, `create_time`)'); -CALL sp_add_index_if_not_exists('t_order_artist_change_request', 'idx_order_artist_change_artist', '(`from_artist_id`, `to_artist_id`, `status`)'); -CALL sp_add_index_if_not_exists('t_order_artist_change_request', 'idx_order_artist_change_shop', '(`shop_id`, `status`, `create_time`)'); -CALL sp_add_index_if_not_exists('t_order_artist_change_request', 'idx_order_artist_change_expire', '(`status`, `expire_time`, `is_delete`)'); - -CREATE TABLE IF NOT EXISTS t_business_event_outbox -( - id bigint unsigned auto_increment comment '事件ID' - primary key, - event_key varchar(160) not null comment '事件幂等键', - event_type varchar(64) not null comment '事件类型', - business_type varchar(64) not null comment '业务类型', - business_id bigint unsigned not null comment '业务ID', - payload_json text null comment '事件载荷', - status varchar(20) default 'PENDING' not null comment 'PENDING/PROCESSING/SUCCEEDED/FAILED', - retry_count int unsigned default 0 not null comment '重试次数', - next_retry_time datetime null comment '下次重试时间', - last_error varchar(500) null comment '最近错误', - claimed_at datetime null comment '认领时间', - processed_at datetime null comment '处理完成时间', - create_time datetime default CURRENT_TIMESTAMP not null comment '创建时间', - update_time datetime default CURRENT_TIMESTAMP not null on update CURRENT_TIMESTAMP comment '更新时间', - is_delete tinyint unsigned default 0 null comment '逻辑删除' -) - comment '业务事件Outbox表'; - -CALL sp_add_unique_index_if_not_exists('t_business_event_outbox', 'uk_business_event_outbox_event_key', '(`event_key`)'); -CALL sp_add_index_if_not_exists('t_business_event_outbox', 'idx_business_event_outbox_due', '(`status`, `next_retry_time`, `create_time`)'); - --- Artist change requests can be expired asynchronously; expired rows release pending_key for a new request. --- EXPIRED - --- ======================================== --- vNext operations schema: schedule / reservation / payment / after sale / inventory / campaign / growth --- ======================================== - -CALL sp_add_column_if_not_exists('t_order', 'payment_status', 'varchar(20) NOT NULL DEFAULT ''UNPAID'' COMMENT ''支付状态:UNPAID/PAYING/PAID/REFUNDED'''); -CALL sp_add_column_if_not_exists('t_order', 'pay_amount', 'decimal(10,2) NULL COMMENT ''应支付金额快照'''); -CALL sp_add_column_if_not_exists('t_order', 'paid_amount', 'decimal(10,2) NULL COMMENT ''实付金额快照'''); -CALL sp_add_column_if_not_exists('t_order', 'pay_time', 'datetime NULL COMMENT ''支付完成时间'''); -CALL sp_add_column_if_not_exists('t_order', 'payment_method', 'varchar(32) NULL COMMENT ''支付方式/渠道'''); -CALL sp_add_column_if_not_exists('t_order', 'payment_order_no', 'varchar(64) NULL COMMENT ''最近一次支付单号'''); -CALL sp_add_column_if_not_exists('t_order', 'refund_status', 'varchar(20) NOT NULL DEFAULT ''NONE'' COMMENT ''退款状态:NONE/REFUNDED'''); -CALL sp_add_index_if_not_exists('t_order', 'idx_t_order_payment_status', '(`payment_status`, `is_delete`)'); -CALL sp_add_index_if_not_exists('t_order', 'idx_t_order_payment_order_no', '(`payment_order_no`)'); -CALL sp_add_index_if_not_exists('t_order', 'idx_t_order_refund_status', '(`refund_status`, `is_delete`)'); - -CREATE TABLE IF NOT EXISTS t_artist_schedule -( - id bigint unsigned NOT NULL COMMENT '排班ID', - shop_id bigint unsigned NOT NULL COMMENT '店铺ID', - artist_id bigint unsigned NOT NULL COMMENT '美甲师用户ID', - work_date date NOT NULL COMMENT '工作日期', - start_time time NOT NULL COMMENT '班次开始时间', - end_time time NOT NULL COMMENT '班次结束时间', - slot_minutes int NOT NULL DEFAULT 30 COMMENT '预约粒度分钟数', - capacity int NOT NULL DEFAULT 1 COMMENT '同一时段可预约容量', - status tinyint NOT NULL DEFAULT 1 COMMENT '状态:1-可预约,0-停用', - remark varchar(255) NULL COMMENT '排班备注', - create_time datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', - update_time datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', - is_delete tinyint unsigned DEFAULT 0 NULL COMMENT '逻辑删除:0-未删,1-已删', - PRIMARY KEY (id) -) - COMMENT '美甲师排班表'; - -CREATE TABLE IF NOT EXISTS t_appointment_reservation -( - id bigint unsigned NOT NULL COMMENT '预约占用ID', - order_id bigint unsigned NOT NULL COMMENT '订单ID', - order_item_id bigint unsigned NOT NULL COMMENT '订单项ID', - shop_id bigint unsigned NOT NULL COMMENT '店铺ID', - artist_id bigint unsigned NOT NULL COMMENT '美甲师用户ID', - product_title varchar(200) NULL COMMENT '预约作品标题快照', - appointment_start_time datetime NOT NULL COMMENT '预约开始时间', - appointment_end_time datetime NOT NULL COMMENT '预约结束时间', - status varchar(20) NOT NULL DEFAULT 'LOCKED' COMMENT '状态:LOCKED/PENDING_QUOTE/CONFIRMED/RELEASED/CANCELLED/EXPIRED', - client_request_id varchar(80) NULL COMMENT '客户端幂等请求ID', - create_time datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', - update_time datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', - is_delete tinyint unsigned DEFAULT 0 NULL COMMENT '逻辑删除:0-未删,1-已删', - PRIMARY KEY (id) -) - COMMENT '订单预约时段占用表'; - -CREATE TABLE IF NOT EXISTS t_payment_order -( - id bigint unsigned NOT NULL COMMENT '支付单ID', - pay_no varchar(64) NOT NULL COMMENT '支付单号', - order_id bigint unsigned NOT NULL COMMENT '订单ID', - order_no varchar(64) NOT NULL COMMENT '订单号快照', - user_id bigint unsigned NOT NULL COMMENT '支付用户ID', - shop_id bigint unsigned NULL COMMENT '店铺ID', - channel varchar(32) NOT NULL DEFAULT 'MANUAL' COMMENT '支付渠道', - status varchar(20) NOT NULL DEFAULT 'PAYING' COMMENT '状态:PAYING/PAID/CLOSED', - pay_amount decimal(10, 2) NOT NULL DEFAULT 0.00 COMMENT '应支付金额', - paid_amount decimal(10, 2) NOT NULL DEFAULT 0.00 COMMENT '实付金额', - pay_time datetime NULL COMMENT '支付完成时间', - expire_time datetime NULL COMMENT '支付单过期时间', - operator_id bigint unsigned NULL COMMENT '手工确认操作人ID', - remark varchar(255) NULL COMMENT '支付备注', - idempotency_key varchar(160) NULL COMMENT '支付幂等键', - raw_payload text NULL COMMENT '支付渠道原始载荷', - create_time datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', - update_time datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', - is_delete tinyint unsigned DEFAULT 0 NULL COMMENT '逻辑删除:0-未删,1-已删', - PRIMARY KEY (id) -) - COMMENT '订单支付单表'; - -CREATE TABLE IF NOT EXISTS t_refund_order -( - id bigint unsigned NOT NULL COMMENT '退款单ID', - refund_no varchar(64) NOT NULL COMMENT '退款单号', - after_sale_id bigint unsigned NULL COMMENT '售后单ID', - payment_order_id bigint unsigned NOT NULL COMMENT '支付单ID', - order_id bigint unsigned NOT NULL COMMENT '订单ID', - status varchar(20) NOT NULL DEFAULT 'REFUNDED' COMMENT '状态:PROCESSING/REFUNDED/FAILED', - refund_amount decimal(10, 2) NOT NULL DEFAULT 0.00 COMMENT '退款金额', - refund_time datetime NULL COMMENT '退款完成时间', - channel varchar(32) NULL COMMENT '退款渠道', - external_refund_no varchar(64) NULL COMMENT '外部退款单号', - fail_reason varchar(255) NULL COMMENT '失败原因或备注', - idempotency_key varchar(160) NULL COMMENT '退款幂等键', - create_time datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', - update_time datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', - is_delete tinyint unsigned DEFAULT 0 NULL COMMENT '逻辑删除:0-未删,1-已删', - PRIMARY KEY (id) -) - COMMENT '订单退款单表'; - -CREATE TABLE IF NOT EXISTS t_after_sale -( - id bigint unsigned NOT NULL COMMENT '售后单ID', - after_sale_no varchar(64) NOT NULL COMMENT '售后单号', - order_id bigint unsigned NOT NULL COMMENT '订单ID', - order_item_id bigint unsigned NULL COMMENT '订单项ID', - user_id bigint unsigned NOT NULL COMMENT '申请用户ID', - shop_id bigint unsigned NULL COMMENT '店铺ID', - type varchar(32) NOT NULL COMMENT '售后类型', - reason varchar(1000) NULL COMMENT '申请原因', - refund_amount decimal(10, 2) NULL COMMENT '申请退款金额', - status varchar(20) NOT NULL DEFAULT 'PENDING' COMMENT '状态:PENDING/APPROVED/REJECTED', - audit_user_id bigint unsigned NULL COMMENT '审核人ID', - audit_reason varchar(500) NULL COMMENT '审核说明', - audit_time datetime NULL COMMENT '审核时间', - refund_order_id bigint unsigned NULL COMMENT '关联退款单ID', - create_time datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', - update_time datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', - is_delete tinyint unsigned DEFAULT 0 NULL COMMENT '逻辑删除:0-未删,1-已删', - PRIMARY KEY (id) -) - COMMENT '订单售后申请表'; - -CREATE TABLE IF NOT EXISTS t_after_sale_log -( - id bigint unsigned NOT NULL COMMENT '售后日志ID', - after_sale_id bigint unsigned NOT NULL COMMENT '售后单ID', - action varchar(32) NOT NULL COMMENT '动作:CREATE/APPROVE/REJECT', - from_status varchar(20) NULL COMMENT '变更前状态', - to_status varchar(20) NULL COMMENT '变更后状态', - operator_id bigint unsigned NULL COMMENT '操作人ID', - operator_type varchar(20) NULL COMMENT '操作人类型:USER/ADMIN', - remark varchar(500) NULL COMMENT '备注', - create_time datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', - update_time datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', - PRIMARY KEY (id) -) - COMMENT '订单售后流转日志表'; - -CREATE TABLE IF NOT EXISTS t_inventory_item -( - id bigint unsigned NOT NULL COMMENT '库存物料ID', - shop_id bigint unsigned NOT NULL COMMENT '店铺ID', - category varchar(50) NULL COMMENT '物料分类', - item_name varchar(100) NOT NULL COMMENT '物料名称', - unit varchar(20) NOT NULL DEFAULT '件' COMMENT '计量单位', - stock_quantity decimal(12, 3) NOT NULL DEFAULT 0.000 COMMENT '当前库存数量', - warning_threshold decimal(12, 3) NOT NULL DEFAULT 0.000 COMMENT '库存预警阈值', - status tinyint NOT NULL DEFAULT 1 COMMENT '状态:1-启用,0-停用', - create_time datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', - update_time datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', - is_delete tinyint unsigned DEFAULT 0 NULL COMMENT '逻辑删除:0-未删,1-已删', - PRIMARY KEY (id) -) - COMMENT '门店库存物料表'; - -CREATE TABLE IF NOT EXISTS t_inventory_record -( - id bigint unsigned NOT NULL COMMENT '库存流水ID', - inventory_item_id bigint unsigned NOT NULL COMMENT '库存物料ID', - shop_id bigint unsigned NOT NULL COMMENT '店铺ID', - change_type varchar(32) NOT NULL COMMENT '变动类型:IN/OUT/ADJUST', - change_quantity decimal(12, 3) NOT NULL COMMENT '变动数量', - before_quantity decimal(12, 3) NOT NULL COMMENT '变动前数量', - after_quantity decimal(12, 3) NOT NULL COMMENT '变动后数量', - operator_id bigint unsigned NULL COMMENT '操作人ID', - remark varchar(255) NULL COMMENT '备注', - create_time datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', - update_time datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', - PRIMARY KEY (id) -) - COMMENT '门店库存变动流水表'; - -CREATE TABLE IF NOT EXISTS t_campaign -( - id bigint unsigned NOT NULL COMMENT '营销活动ID', - shop_id bigint unsigned NULL COMMENT '店铺ID,空表示平台活动', - title varchar(120) NOT NULL COMMENT '活动标题', - description varchar(1000) NULL COMMENT '活动说明', - scene varchar(32) NOT NULL DEFAULT 'HOME' COMMENT '活动场景', - product_ids text NULL COMMENT '关联作品ID集合', - coupon_ids text NULL COMMENT '关联优惠券ID集合', - status tinyint NOT NULL DEFAULT 0 COMMENT '状态:0-草稿,1-启用,2-停用', - start_time datetime NULL COMMENT '开始时间', - end_time datetime NULL COMMENT '结束时间', - sort_order int NOT NULL DEFAULT 100 COMMENT '排序', - create_time datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', - update_time datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', - is_delete tinyint unsigned DEFAULT 0 NULL COMMENT '逻辑删除:0-未删,1-已删', - PRIMARY KEY (id) -) - COMMENT '营销活动配置表'; - -CREATE TABLE IF NOT EXISTS t_user_growth_record -( - id bigint unsigned NOT NULL COMMENT '成长值记录ID', - user_id bigint unsigned NOT NULL COMMENT '用户ID', - source_type varchar(32) NOT NULL COMMENT '成长来源:REVIEW/REBOOK/ORDER', - source_id bigint unsigned NULL COMMENT '来源业务ID', - growth_value int NOT NULL DEFAULT 0 COMMENT '成长值变化', - remark varchar(255) NULL COMMENT '备注', - create_time datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', - update_time datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', - PRIMARY KEY (id) -) - COMMENT '用户成长值流水表'; - -CALL sp_add_unique_index_if_not_exists('t_artist_schedule', 'uk_t_artist_schedule_slot', '(`shop_id`, `artist_id`, `work_date`, `start_time`, `is_delete`)'); -CALL sp_add_index_if_not_exists('t_artist_schedule', 'idx_t_artist_schedule_artist_date', '(`artist_id`, `work_date`, `status`, `is_delete`)'); -CALL sp_add_index_if_not_exists('t_artist_schedule', 'idx_t_artist_schedule_shop_date', '(`shop_id`, `work_date`, `status`, `is_delete`)'); -CALL sp_add_column_if_not_exists('t_appointment_reservation', 'client_request_id', 'varchar(80) NULL COMMENT ''客户端幂等请求ID'''); -CALL sp_add_unique_index_if_not_exists('t_appointment_reservation', 'uk_t_appointment_reservation_item', '(`order_item_id`, `is_delete`)'); -CALL sp_add_unique_index_if_not_exists('t_appointment_reservation', 'uk_t_appointment_reservation_client_request', '(`shop_id`, `artist_id`, `client_request_id`, `is_delete`)'); -CALL sp_add_index_if_not_exists('t_appointment_reservation', 'idx_t_appointment_reservation_artist_time', '(`artist_id`, `status`, `appointment_start_time`, `appointment_end_time`, `is_delete`)'); -CALL sp_add_index_if_not_exists('t_appointment_reservation', 'idx_t_appointment_reservation_order', '(`order_id`, `status`, `is_delete`)'); -CALL sp_add_index_if_not_exists('t_appointment_reservation', 'idx_t_appointment_reservation_shop_time', '(`shop_id`, `appointment_start_time`, `status`, `is_delete`)'); -CALL sp_add_unique_index_if_not_exists('t_payment_order', 'uk_t_payment_order_pay_no', '(`pay_no`)'); -CALL sp_add_unique_index_if_not_exists('t_payment_order', 'uk_t_payment_order_idempotency', '(`idempotency_key`)'); -CALL sp_add_index_if_not_exists('t_payment_order', 'idx_t_payment_order_order_latest', '(`order_id`, `is_delete`, `create_time`)'); -CALL sp_add_index_if_not_exists('t_payment_order', 'idx_t_payment_order_user_status', '(`user_id`, `status`, `create_time`)'); -CALL sp_add_index_if_not_exists('t_payment_order', 'idx_t_payment_order_shop_status', '(`shop_id`, `status`, `create_time`)'); -CALL sp_add_index_if_not_exists('t_payment_order', 'idx_t_payment_order_expire', '(`status`, `expire_time`, `is_delete`)'); -CALL sp_add_unique_index_if_not_exists('t_refund_order', 'uk_t_refund_order_refund_no', '(`refund_no`)'); -CALL sp_add_unique_index_if_not_exists('t_refund_order', 'uk_t_refund_order_idempotency', '(`idempotency_key`)'); -CALL sp_add_index_if_not_exists('t_refund_order', 'idx_t_refund_order_after_sale', '(`after_sale_id`)'); -CALL sp_add_index_if_not_exists('t_refund_order', 'idx_t_refund_order_order_status', '(`order_id`, `status`, `create_time`)'); -CALL sp_add_unique_index_if_not_exists('t_after_sale', 'uk_t_after_sale_no', '(`after_sale_no`)'); -CALL sp_add_index_if_not_exists('t_after_sale', 'idx_t_after_sale_user_status', '(`user_id`, `status`, `create_time`)'); -CALL sp_add_index_if_not_exists('t_after_sale', 'idx_t_after_sale_shop_status', '(`shop_id`, `status`, `create_time`)'); -CALL sp_add_index_if_not_exists('t_after_sale', 'idx_t_after_sale_order', '(`order_id`, `order_item_id`)'); -CALL sp_add_index_if_not_exists('t_after_sale_log', 'idx_t_after_sale_log_after_sale', '(`after_sale_id`, `create_time`)'); -CALL sp_add_index_if_not_exists('t_after_sale_log', 'idx_t_after_sale_log_operator', '(`operator_id`, `create_time`)'); -CALL sp_add_unique_index_if_not_exists('t_inventory_item', 'uk_t_inventory_item_shop_name', '(`shop_id`, `item_name`, `is_delete`)'); -CALL sp_add_index_if_not_exists('t_inventory_item', 'idx_t_inventory_item_shop_status', '(`shop_id`, `status`, `is_delete`)'); -CALL sp_add_index_if_not_exists('t_inventory_item', 'idx_t_inventory_item_warning', '(`shop_id`, `stock_quantity`, `warning_threshold`)'); -CALL sp_add_index_if_not_exists('t_inventory_record', 'idx_t_inventory_record_item_time', '(`inventory_item_id`, `create_time`)'); -CALL sp_add_index_if_not_exists('t_inventory_record', 'idx_t_inventory_record_shop_time', '(`shop_id`, `create_time`)'); -CALL sp_add_index_if_not_exists('t_campaign', 'idx_t_campaign_shop_status', '(`shop_id`, `status`, `is_delete`, `sort_order`)'); -CALL sp_add_index_if_not_exists('t_campaign', 'idx_t_campaign_scene_time', '(`scene`, `status`, `start_time`, `end_time`)'); -CALL sp_add_index_if_not_exists('t_user_growth_record', 'idx_t_user_growth_user_time', '(`user_id`, `create_time`)'); -CALL sp_add_index_if_not_exists('t_user_growth_record', 'idx_t_user_growth_source', '(`source_type`, `source_id`)'); -CALL sp_add_unique_index_if_not_exists('t_user_growth_record', 'uk_t_user_growth_source_once', '(`user_id`, `source_type`, `source_id`)'); - -INSERT INTO t_permission (id, permission_code, permission_name, permission_group, description, create_time, update_time, is_delete) -VALUES - (313931273555136610, 'schedule:view', '查看排班', '排班管理', '查看美甲师排班和可约时段', NOW(), NOW(), 0), - (313931273555136611, 'schedule:edit', '编辑排班', '排班管理', '维护美甲师班次、休息日和预约容量', NOW(), NOW(), 0), - (313931273555136612, 'payment:view', '查看支付', '支付退款', '查看订单支付状态和支付单', NOW(), NOW(), 0), - (313931273555136613, 'payment:manage', '确认支付', '支付退款', '手工确认支付或处理支付异常', NOW(), NOW(), 0), - (313931273555136614, 'refund:view', '查看退款', '支付退款', '查看退款申请和退款单', NOW(), NOW(), 0), - (313931273555136615, 'refund:manage', '处理退款', '支付退款', '手工确认退款或处理退款异常', NOW(), NOW(), 0), - (313931273555136616, 'after_sale:view', '查看售后', '售后管理', '查看订单售后和客户反馈', NOW(), NOW(), 0), - (313931273555136617, 'after_sale:audit', '处理售后', '售后管理', '审批或驳回售后申请', NOW(), NOW(), 0), - (313931273555136618, 'inventory:view', '查看库存', '库存管理', '查看门店耗材库存和预警', NOW(), NOW(), 0), - (313931273555136619, 'inventory:manage', '调整库存', '库存管理', '维护耗材、入库和库存调整', NOW(), NOW(), 0), - (313931273555136620, 'campaign:view', '查看活动', '活动管理', '查看营销活动和推荐位', NOW(), NOW(), 0), - (313931273555136621, 'campaign:manage', '管理活动', '活动管理', '创建、编辑和发布营销活动', NOW(), NOW(), 0), - (313931273555136622, 'growth:view', '查看成长', '用户成长', '查看用户成长值和会员权益进度', NOW(), NOW(), 0), - (313931273555136623, 'analytics:view', '查看经营分析', '经营分析', '查看订单漏斗和经营指标', NOW(), NOW(), 0), - (313931273555136624, 'performance:view', '查看绩效', '绩效统计', '查看门店和美甲师服务绩效', NOW(), NOW(), 0), - (313931273555136625, 'workbench:view', '查看工作台', '门店工作台', '查看今日订单、售后待办、排班和绩效摘要', NOW(), NOW(), 0) -ON DUPLICATE KEY UPDATE - permission_name = VALUES(permission_name), - permission_group = VALUES(permission_group), - description = VALUES(description), - is_delete = 0, - update_time = NOW(); - -CALL sp_add_column_if_not_exists('t_order', 'customer_remark', 'varchar(500) NULL COMMENT ''用户询价预约备注'''); -CALL sp_add_column_if_not_exists('t_order', 'quote_status', 'varchar(32) NULL COMMENT ''报价状态:CONFIRMING/CONFIRMED/EXPIRED'''); -CALL sp_add_column_if_not_exists('t_order', 'quote_user_confirmed', 'tinyint unsigned NOT NULL DEFAULT 0 COMMENT ''用户是否确认当前报价'''); -CALL sp_add_column_if_not_exists('t_order', 'quote_shop_confirmed', 'tinyint unsigned NOT NULL DEFAULT 0 COMMENT ''店长是否确认当前报价'''); -CALL sp_add_column_if_not_exists('t_order', 'quote_expire_time', 'datetime NULL COMMENT ''询价报价过期时间'''); -CALL sp_add_column_if_not_exists('t_order', 'quote_confirmed_time', 'datetime NULL COMMENT ''双方确认报价时间'''); -CALL sp_add_index_if_not_exists('t_order', 'idx_t_order_quote_status_expire', '(`quote_status`, `quote_expire_time`)'); - -CALL sp_add_column_if_not_exists('t_order_item', 'reference_price', 'decimal(10,2) NULL COMMENT ''作品参考价快照'''); -CALL sp_add_column_if_not_exists('t_order_item', 'quoted_price', 'decimal(10,2) NULL COMMENT ''当前报价'''); -CALL sp_add_column_if_not_exists('t_order_item', 'confirmed_price', 'decimal(10,2) NULL COMMENT ''最终确认价'''); - -CREATE TABLE IF NOT EXISTS t_order_quote_message -( - id bigint unsigned auto_increment comment '报价交互消息主键' - primary key, - order_id bigint unsigned not null comment '订单ID', - actor_id bigint unsigned null comment '操作人ID', - actor_type varchar(32) not null comment '操作人类型:USER/SHOP/SYSTEM', - action varchar(32) not null comment '动作:CREATE/SHOP_QUOTE/USER_REPLY/USER_CONFIRM/SHOP_CONFIRM/SYSTEM_CONFIRM/SYSTEM_EXPIRE', - remark varchar(500) null comment '备注', - items_snapshot text null comment '订单项报价快照JSON', - create_time datetime default CURRENT_TIMESTAMP not null comment '创建时间', - update_time datetime default CURRENT_TIMESTAMP not null on update CURRENT_TIMESTAMP comment '更新时间', - is_delete tinyint unsigned default 0 null comment '逻辑删除:0-未删,1-已删' -) - comment '订单询价报价交互消息表'; - -CALL sp_add_index_if_not_exists('t_order_quote_message', 'idx_order_quote_message_order_id', '(`order_id`, `is_delete`, `create_time`)'); - -CREATE TABLE IF NOT EXISTS `t_messagehub_push_config` ( - `id` bigint unsigned NOT NULL COMMENT '主键ID', - `scene_code` varchar(80) NOT NULL COMMENT '业务场景编码', - `scene_name` varchar(100) NOT NULL COMMENT '业务场景名称', - `platform` varchar(20) NOT NULL DEFAULT 'SMS' COMMENT 'MessageHub 平台类型:SMS/EMAIL/QQ', - `msg_type` varchar(30) NOT NULL DEFAULT 'VERIFICATION' COMMENT 'MessageHub 消息类型', - `queue_name` varchar(100) NOT NULL DEFAULT 'smsQueue' COMMENT '投递到 MessageHub 的队列名', - `source_system` varchar(80) NOT NULL DEFAULT 'fingertipdesigner' COMMENT 'MessageHub 来源系统编码', - `template_code` varchar(100) NOT NULL COMMENT 'MessageHub 模板编码', - `channel_id` bigint unsigned NULL COMMENT 'MessageHub 通道ID,不填则由 MessageHub 自动选择', - `send_method` varchar(30) NULL COMMENT '兼容旧短信 DTO 的发送方式,如 SPUG/OTHER', - `enabled` tinyint unsigned NOT NULL DEFAULT 1 COMMENT '是否启用:1-启用,0-停用', - `remark` varchar(255) NULL COMMENT '备注', - `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', - `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', - `is_delete` tinyint unsigned NOT NULL DEFAULT 0 COMMENT '逻辑删除:0-未删除,1-已删除', - PRIMARY KEY (`id`), - UNIQUE KEY `uk_messagehub_push_config_scene` (`scene_code`), - KEY `idx_messagehub_push_config_enabled` (`enabled`, `is_delete`) -) COMMENT='Fingertip Designer按业务场景投递MessageHub的配置'; - -DROP PROCEDURE IF EXISTS sp_add_column_if_not_exists; -DROP PROCEDURE IF EXISTS sp_add_index_if_not_exists; -DROP PROCEDURE IF EXISTS sp_add_unique_index_if_not_exists; - --- ======================================== --- 首次部署整合区:权限种子 / xiaowang 初始化 / 默认权限分配 --- 来源:2026-03-20_init_admin_permission_template.sql --- ======================================== - -SET NAMES utf8mb4; - -INSERT INTO t_permission (permission_code, permission_name, permission_group, description, create_time, update_time, is_delete) -VALUES - ('home:view', '查看首页', '首页', '查看系统首页入口与概览', NOW(), NOW(), 0), - ('dashboard:view', '查看仪表盘', '仪表盘', '查看后台仪表盘统计', NOW(), NOW(), 0), - ('user:view', '查看用户', '用户管理', '查看用户列表与详情', NOW(), NOW(), 0), - ('user:create', '新增用户', '用户管理', '创建用户账号', NOW(), NOW(), 0), - ('user:edit', '编辑用户', '用户管理', '修改用户基础信息', NOW(), NOW(), 0), - ('user:disable', '启停用户', '用户管理', '启用或禁用用户账号', NOW(), NOW(), 0), - ('user:unbind', '解绑用户', '用户管理', '解绑用户与当前店铺的关系', NOW(), NOW(), 0), - ('user:reset_password', '重置密码', '用户管理', '重置用户密码', NOW(), NOW(), 0), - ('user:delete', '删除用户', '用户管理', '删除用户账号', NOW(), NOW(), 0), - ('user:balance:view', '查看余额资产', '用户资产', '查看用户余额、累计充值与流水', NOW(), NOW(), 0), - ('user:balance:manage', '调整余额', '用户资产', '充值、手工加减余额与关联订单', NOW(), NOW(), 0), - ('user:vip:manage', '管理VIP', '用户资产', '手工设置VIP等级或恢复自动判级', NOW(), NOW(), 0), - ('product:view', '查看商品', '商品管理', '查看商品列表与详情', NOW(), NOW(), 0), - ('product:create', '新增商品', '商品管理', '创建商品', NOW(), NOW(), 0), - ('product:edit', '编辑商品', '商品管理', '编辑商品信息', NOW(), NOW(), 0), - ('product:delete', '删除商品', '商品管理', '删除商品', NOW(), NOW(), 0), - ('product:category:manage', '管理商品分类', '商品管理', '维护商品分类与归类信息', NOW(), NOW(), 0), - ('shop:view', '查看店铺', '店铺管理', '查看店铺列表与详情', NOW(), NOW(), 0), - ('shop:create', '新增店铺', '店铺管理', '创建店铺', NOW(), NOW(), 0), - ('shop:edit', '编辑店铺', '店铺管理', '编辑店铺信息', NOW(), NOW(), 0), - ('shop:delete', '删除店铺', '店铺管理', '删除店铺', NOW(), NOW(), 0), - ('shop:staff:manage', '管理员工', '店铺管理', '管理店铺员工与归属', NOW(), NOW(), 0), - ('permission:view', '查看权限', '权限管理', '查看权限清单', NOW(), NOW(), 0), - ('permission:create', '新增权限', '权限管理', '新增系统权限定义', NOW(), NOW(), 0), - ('permission:edit', '编辑权限', '权限管理', '编辑系统权限定义', NOW(), NOW(), 0), - ('permission:delete', '删除权限', '权限管理', '删除系统权限定义', NOW(), NOW(), 0), - ('permission:assign', '分配权限', '权限管理', '给用户分配后台权限', NOW(), NOW(), 0), - ('tag:view', '查看标签', '标签管理', '查看标签列表与详情', NOW(), NOW(), 0), - ('tag:create', '新增标签', '标签管理', '创建标签', NOW(), NOW(), 0), - ('tag:edit', '编辑标签', '标签管理', '编辑标签', NOW(), NOW(), 0), - ('tag:delete', '删除标签', '标签管理', '删除标签', NOW(), NOW(), 0), - ('tag:assign', '分配标签', '标签管理', '给商品或优惠券分配标签', NOW(), NOW(), 0), - ('coupon:view', '查看优惠券', '优惠券管理', '查看优惠券与发放情况', NOW(), NOW(), 0), - ('coupon:create', '新增优惠券', '优惠券管理', '创建优惠券模板', NOW(), NOW(), 0), - ('coupon:edit', '编辑优惠券', '优惠券管理', '编辑优惠券模板', NOW(), NOW(), 0), - ('coupon:delete', '删除优惠券', '优惠券管理', '删除优惠券模板', NOW(), NOW(), 0), - ('coupon:assign', '发放优惠券', '优惠券管理', '向用户发放普通优惠券', NOW(), NOW(), 0), - ('comment:view', '查看评论', '评论管理', '查看作品评论与回复', NOW(), NOW(), 0), - ('comment:delete', '删除评论', '评论管理', '删除不合规作品评论', NOW(), NOW(), 0), - ('order:view', '查看订单', '订单管理', '查看订单列表与详情', NOW(), NOW(), 0), - ('order:process', '处理订单', '订单管理', '处理订单状态或由美甲师完结订单', NOW(), NOW(), 0), - ('order:edit', '编辑订单', '订单管理', '编辑订单信息的预留权限', NOW(), NOW(), 0), - ('order:delete', '删除订单', '订单管理', '删除订单的预留权限', NOW(), NOW(), 0), - ('nail_artist:view', '查看美甲师', '美甲师管理', '查看美甲师信息与排班入口', NOW(), NOW(), 0), - ('nail_artist:edit', '编辑美甲师', '美甲师管理', '编辑美甲师信息', NOW(), NOW(), 0), - ('message:view', '查看消息', '消息管理', '查看站内消息发布与通知', NOW(), NOW(), 0), - ('message:create', '发布消息', '消息管理', '发布站内消息', NOW(), NOW(), 0), - ('message:delete', '撤回消息', '消息管理', '撤回已发布站内消息', NOW(), NOW(), 0) - , - ('announcement:view', '查看公告', '公告管理', '查看公告列表与详情', NOW(), NOW(), 0), - ('announcement:create', '发布公告', '公告管理', '发布公告', NOW(), NOW(), 0), - ('announcement:delete', '撤回公告', '公告管理', '撤回已发布公告', NOW(), NOW(), 0) -ON DUPLICATE KEY UPDATE - permission_name = VALUES(permission_name), - permission_group = VALUES(permission_group), - description = VALUES(description), - update_time = NOW(), - is_delete = 0; - -INSERT INTO t_permission (id, permission_code, permission_name, permission_group, description, create_time, update_time, is_delete) -VALUES - (910000000008001, 'message:view', '查看消息', '消息管理', '查看站内消息发布与通知', NOW(), NOW(), 0), - (910000000008002, 'message:create', '发布消息', '消息管理', '发布站内消息', NOW(), NOW(), 0), - (910000000008003, 'message:delete', '撤回消息', '消息管理', '撤回已发布站内消息', NOW(), NOW(), 0) -ON DUPLICATE KEY UPDATE - permission_name = VALUES(permission_name), - permission_group = VALUES(permission_group), - description = VALUES(description), - update_time = NOW(), - is_delete = 0; - -INSERT INTO t_permission (id, permission_code, permission_name, permission_group, description, create_time, update_time, is_delete) -VALUES - (910000000008011, 'announcement:view', '查看公告', '公告管理', '查看公告列表与详情', NOW(), NOW(), 0), - (910000000008012, 'announcement:create', '发布公告', '公告管理', '发布公告', NOW(), NOW(), 0), - (910000000008013, 'announcement:delete', '撤回公告', '公告管理', '撤回已发布公告', NOW(), NOW(), 0) -ON DUPLICATE KEY UPDATE - permission_name = VALUES(permission_name), - permission_group = VALUES(permission_group), - description = VALUES(description), - update_time = NOW(), - is_delete = 0; - -INSERT INTO t_permission (permission_code, permission_name, permission_group, description, create_time, update_time, is_delete) -VALUES ('order:artist-change', '处理改派申请', '订单管理', '处理订单美甲师改派申请', NOW(), NOW(), 0) -ON DUPLICATE KEY UPDATE - permission_name = VALUES(permission_name), - permission_group = VALUES(permission_group), - description = VALUES(description), - update_time = NOW(), - is_delete = 0; - -INSERT INTO t_user ( - shop_id, - nickname, - account, - phone_verified, - email_verified, - password, - signature, - level, - type, - vip_id, - create_time, - update_time, - is_delete, - status -) -SELECT - 0, - '系统管理员', - 'xiaowang', - 0, - 0, - '$2a$10$I3mV64NhISqMmm7soSki1.Y36ve.TOINGOrVt0U0kxjO7GtxavE16', - '', - '管理员', - 4, - 0, - NOW(), - NOW(), - 0, - 1 -WHERE NOT EXISTS ( - SELECT 1 - FROM t_user - WHERE account = 'xiaowang' -); - --- ======================================== --- 雪花 ID 口径收口区:去掉运行时主键表的 AUTO_INCREMENT --- 说明: --- 1. 前面的建表与基础配置种子继续沿用旧链路,保证空库初始化过程不受影响 --- 2. 本段将运行时已切到应用层雪花 ID 的主键表统一收口 --- 3. 后续基础配置插入均使用显式主键,与 2026-03-30_snowflake_id_alignment_patch.sql 保持同口径 --- ======================================== - -DROP PROCEDURE IF EXISTS sp_drop_auto_increment_on_id_if_exists; - -DELIMITER $$ - -CREATE PROCEDURE sp_drop_auto_increment_on_id_if_exists(IN p_table_name VARCHAR(64)) -BEGIN - DECLARE v_column_type VARCHAR(128) DEFAULT NULL; - DECLARE v_column_comment VARCHAR(255) DEFAULT NULL; - DECLARE v_extra VARCHAR(128) DEFAULT NULL; - - SELECT COLUMN_TYPE, COLUMN_COMMENT, EXTRA - INTO v_column_type, v_column_comment, v_extra - FROM information_schema.COLUMNS - WHERE TABLE_SCHEMA = DATABASE() - AND TABLE_NAME = p_table_name - AND COLUMN_NAME = 'id' - LIMIT 1; - - IF v_column_type IS NOT NULL AND v_extra LIKE '%auto_increment%' THEN - SET @alter_sql = CONCAT( - 'ALTER TABLE `', p_table_name, '` MODIFY COLUMN `id` ', - v_column_type, - ' NOT NULL' - ); - - IF v_column_comment IS NOT NULL AND v_column_comment <> '' THEN - SET @alter_sql = CONCAT(@alter_sql, ' COMMENT ', QUOTE(v_column_comment)); - END IF; - - PREPARE stmt FROM @alter_sql; - EXECUTE stmt; - DEALLOCATE PREPARE stmt; - END IF; -END$$ - -DELIMITER ; - -CALL sp_drop_auto_increment_on_id_if_exists('t_balance'); -CALL sp_drop_auto_increment_on_id_if_exists('t_balance_change_detail'); -CALL sp_drop_auto_increment_on_id_if_exists('t_cart'); -CALL sp_drop_auto_increment_on_id_if_exists('t_comment'); -CALL sp_drop_auto_increment_on_id_if_exists('t_coupon'); -CALL sp_drop_auto_increment_on_id_if_exists('t_coupon_tag'); -CALL sp_drop_auto_increment_on_id_if_exists('t_effect_diagram'); -CALL sp_drop_auto_increment_on_id_if_exists('t_login_identity'); -CALL sp_drop_auto_increment_on_id_if_exists('t_wechat_mini_binding'); -CALL sp_drop_auto_increment_on_id_if_exists('t_nail_artist_info'); -CALL sp_drop_auto_increment_on_id_if_exists('t_object_storage_file'); -CALL sp_drop_auto_increment_on_id_if_exists('t_order'); -CALL sp_drop_auto_increment_on_id_if_exists('t_order_item'); -CALL sp_drop_auto_increment_on_id_if_exists('t_permission'); -CALL sp_drop_auto_increment_on_id_if_exists('t_product'); -CALL sp_drop_auto_increment_on_id_if_exists('t_product_like'); -CALL sp_drop_auto_increment_on_id_if_exists('t_shop'); -CALL sp_drop_auto_increment_on_id_if_exists('t_tag'); -CALL sp_drop_auto_increment_on_id_if_exists('t_user'); -CALL sp_drop_auto_increment_on_id_if_exists('t_user_coupon'); -CALL sp_drop_auto_increment_on_id_if_exists('t_user_permission'); -CALL sp_drop_auto_increment_on_id_if_exists('t_vip_benefit'); -CALL sp_drop_auto_increment_on_id_if_exists('t_vip_info'); -CALL sp_drop_auto_increment_on_id_if_exists('t_wishlist_group'); -CALL sp_drop_auto_increment_on_id_if_exists('t_wishlist'); -CALL sp_drop_auto_increment_on_id_if_exists('t_user_shop_binding'); -CALL sp_drop_auto_increment_on_id_if_exists('t_system_message'); -CALL sp_drop_auto_increment_on_id_if_exists('t_system_message_user_state'); -CALL sp_drop_auto_increment_on_id_if_exists('t_announcement'); -CALL sp_drop_auto_increment_on_id_if_exists('t_vip_recharge_plan'); -CALL sp_drop_auto_increment_on_id_if_exists('t_artist_schedule'); -CALL sp_drop_auto_increment_on_id_if_exists('t_appointment_reservation'); -CALL sp_drop_auto_increment_on_id_if_exists('t_payment_order'); -CALL sp_drop_auto_increment_on_id_if_exists('t_refund_order'); -CALL sp_drop_auto_increment_on_id_if_exists('t_after_sale'); -CALL sp_drop_auto_increment_on_id_if_exists('t_after_sale_log'); -CALL sp_drop_auto_increment_on_id_if_exists('t_inventory_item'); -CALL sp_drop_auto_increment_on_id_if_exists('t_inventory_record'); -CALL sp_drop_auto_increment_on_id_if_exists('t_campaign'); -CALL sp_drop_auto_increment_on_id_if_exists('t_user_growth_record'); - -DROP PROCEDURE IF EXISTS sp_drop_auto_increment_on_id_if_exists; - -CREATE TABLE IF NOT EXISTS t_shop_role ( - id BIGINT UNSIGNED NOT NULL COMMENT '店铺角色ID' PRIMARY KEY, - shop_id BIGINT UNSIGNED NOT NULL COMMENT '店铺ID', - role_name VARCHAR(100) NOT NULL COMMENT '角色名称', - creator_id BIGINT UNSIGNED NULL COMMENT '创建人', - status TINYINT UNSIGNED NOT NULL DEFAULT 1 COMMENT '状态', - remark VARCHAR(255) NULL COMMENT '备注', - sort_order INT NOT NULL DEFAULT 0 COMMENT '排序', - create_time DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, - update_time DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL ON UPDATE CURRENT_TIMESTAMP, - is_delete TINYINT UNSIGNED DEFAULT 0 COMMENT '逻辑删除' -) COMMENT='店铺自定义角色表'; - -CREATE TABLE IF NOT EXISTS t_shop_role_permission ( - id BIGINT UNSIGNED NOT NULL COMMENT '主键' PRIMARY KEY, - role_id BIGINT UNSIGNED NOT NULL COMMENT '角色ID', - permission_id BIGINT UNSIGNED NOT NULL COMMENT '权限ID', - create_time DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, - update_time DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL ON UPDATE CURRENT_TIMESTAMP, - is_delete TINYINT UNSIGNED DEFAULT 0 -) COMMENT='店铺角色权限关联表'; - -CREATE TABLE IF NOT EXISTS t_user_shop_role ( - id BIGINT UNSIGNED NOT NULL COMMENT '主键' PRIMARY KEY, - user_id BIGINT UNSIGNED NOT NULL COMMENT '用户ID', - shop_id BIGINT UNSIGNED NOT NULL COMMENT '店铺ID', - role_id BIGINT UNSIGNED NOT NULL COMMENT '角色ID', - status TINYINT UNSIGNED NOT NULL DEFAULT 1 COMMENT '状态', - create_time DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, - update_time DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL ON UPDATE CURRENT_TIMESTAMP, - is_delete TINYINT UNSIGNED DEFAULT 0 -) COMMENT='用户店铺角色绑定表'; - -CREATE TABLE IF NOT EXISTS t_user_relation ( - id BIGINT UNSIGNED NOT NULL COMMENT '主键' PRIMARY KEY, - user_id BIGINT UNSIGNED NOT NULL COMMENT '用户ID', - shop_id BIGINT UNSIGNED NULL COMMENT '店铺ID', - parent_user_id BIGINT UNSIGNED NULL COMMENT '直属上级用户ID', - parent_role_type INT NULL COMMENT '上级身份类型', - source_type VARCHAR(32) NULL COMMENT '来源类型', - creator_id BIGINT UNSIGNED NULL COMMENT '创建人', - create_time DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, - update_time DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL ON UPDATE CURRENT_TIMESTAMP, - is_delete TINYINT UNSIGNED DEFAULT 0 -) COMMENT='用户归属关系表'; - -CREATE TABLE IF NOT EXISTS t_user_invite_code ( - id BIGINT UNSIGNED NOT NULL COMMENT '主键' PRIMARY KEY, - invite_code VARCHAR(64) NOT NULL COMMENT '邀请码', - owner_user_id BIGINT UNSIGNED NOT NULL COMMENT '所属人', - shop_id BIGINT UNSIGNED NOT NULL COMMENT '店铺ID', - status TINYINT UNSIGNED NOT NULL DEFAULT 1 COMMENT '状态', - use_count INT NOT NULL DEFAULT 0 COMMENT '使用次数', - expire_time DATETIME NULL COMMENT '过期时间', - create_time DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, - update_time DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL ON UPDATE CURRENT_TIMESTAMP, - is_delete TINYINT UNSIGNED DEFAULT 0, - UNIQUE KEY uk_invite_code (invite_code) -) COMMENT='邀请码表'; - - -INSERT INTO t_permission (id, permission_code, permission_name, permission_group, description, create_time, update_time, is_delete) -VALUES - (313931273555136490, 'messagehub:config:manage', '管理消息参数', '参数管理', '管理地图 Key、短信 MessageHub 等平台参数', NOW(), NOW(), 0) -ON DUPLICATE KEY UPDATE - permission_name = VALUES(permission_name), - permission_group = VALUES(permission_group), - description = VALUES(description), - is_delete = 0, - update_time = NOW(); - -INSERT INTO t_messagehub_push_config ( - id, - scene_code, - scene_name, - platform, - msg_type, - queue_name, - source_system, - template_code, - channel_id, - send_method, - enabled, - remark, - create_time, - update_time, - is_delete -) -VALUES - (313931273555137001, 'USER_REGISTER_SMS_CODE', '用户注册验证码', 'SMS', 'VERIFICATION', 'smsQueue', 'fingertipdesigner', 'SPUG0001', NULL, 'SPUG', 1, '注册功能发送验证码时使用', NOW(), NOW(), 0), - (313931273555137002, 'USER_LOGIN_SMS_CODE', '手机号登录验证码', 'SMS', 'VERIFICATION', 'smsQueue', 'fingertipdesigner', 'SPUG0001', NULL, 'SPUG', 1, '手机号验证码登录时使用', NOW(), NOW(), 0), - (313931273555137003, 'USER_RESET_PASSWORD_SMS_CODE', '找回密码验证码', 'SMS', 'VERIFICATION', 'smsQueue', 'fingertipdesigner', 'SPUG0001', NULL, 'SPUG', 1, '找回密码时使用', NOW(), NOW(), 0), - (313931273555137004, 'USER_BIND_PHONE_SMS_CODE', '绑定手机号验证码', 'SMS', 'VERIFICATION', 'smsQueue', 'fingertipdesigner', 'SPUG0001', NULL, 'SPUG', 1, '绑定手机号时使用', NOW(), NOW(), 0), - (313931273555137005, 'USER_CHANGE_PHONE_SMS_CODE', '修改手机号验证码', 'SMS', 'VERIFICATION', 'smsQueue', 'fingertipdesigner', 'SPUG0001', NULL, 'SPUG', 1, '修改手机号时使用', NOW(), NOW(), 0), - (313931273555137006, 'USER_CHANGE_PASSWORD_SMS_CODE', '修改密码验证码', 'SMS', 'VERIFICATION', 'smsQueue', 'fingertipdesigner', 'SPUG0001', NULL, 'SPUG', 1, '修改密码时使用', NOW(), NOW(), 0) -ON DUPLICATE KEY UPDATE - scene_name = VALUES(scene_name), - platform = VALUES(platform), - msg_type = VALUES(msg_type), - queue_name = VALUES(queue_name), - source_system = VALUES(source_system), - template_code = VALUES(template_code), - channel_id = VALUES(channel_id), - send_method = VALUES(send_method), - enabled = VALUES(enabled), - remark = VALUES(remark), - is_delete = 0, - update_time = NOW(); - -INSERT INTO t_permission (id, permission_code, permission_name, permission_group, description, create_time, update_time, is_delete) -VALUES - (313931273555136501, 'role:view', '查看店铺角色', '角色管理', '查看店铺自定义角色', NOW(), NOW(), 0), - (313931273555136502, 'role:create', '新增店铺角色', '角色管理', '创建店铺自定义角色', NOW(), NOW(), 0), - (313931273555136503, 'role:edit', '编辑店铺角色', '角色管理', '编辑角色权限和绑定员工', NOW(), NOW(), 0), - (313931273555136504, 'role:delete', '删除店铺角色', '角色管理', '删除店铺自定义角色', NOW(), NOW(), 0), - (313931273555136505, 'user:relation:view', '查看用户所属', '用户管理', '查看用户归属关系', NOW(), NOW(), 0), - (313931273555136506, 'user:relation:edit', '编辑用户所属', '用户管理', '调整用户店铺和直属上级', NOW(), NOW(), 0) -ON DUPLICATE KEY UPDATE - id = VALUES(id), - permission_name = VALUES(permission_name), - permission_group = VALUES(permission_group), - description = VALUES(description), - is_delete = 0, - update_time = NOW(); - --- 2026-05-18 协议管理、用户协议同意记录与安全审计日志 -CREATE TABLE IF NOT EXISTS t_legal_agreement ( - id bigint NOT NULL COMMENT '协议ID', - agreement_type varchar(32) NOT NULL COMMENT '协议类型:USER_TERMS/PRIVACY_POLICY', - title varchar(100) NOT NULL COMMENT '协议标题', - version varchar(32) NOT NULL COMMENT '协议版本号', - content longtext NOT NULL COMMENT '协议正文', - status tinyint NOT NULL DEFAULT 0 COMMENT '状态:0草稿/停用,1已发布启用', - effective_time datetime NULL COMMENT '生效时间', - create_time datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', - update_time datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', - is_delete tinyint NOT NULL DEFAULT 0 COMMENT '逻辑删除:0否,1是', - PRIMARY KEY (id), - UNIQUE KEY uk_legal_agreement_type_version (agreement_type, version, is_delete), - KEY idx_legal_agreement_current (agreement_type, status, effective_time, is_delete) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='用户协议与隐私政策'; - -CREATE TABLE IF NOT EXISTS t_user_agreement_consent ( - id bigint NOT NULL COMMENT '同意记录ID', - user_id bigint NOT NULL COMMENT '用户ID', - agreement_type varchar(32) NOT NULL COMMENT '协议类型', - version varchar(32) NOT NULL COMMENT '同意版本号', - entry varchar(64) NULL COMMENT '同意入口:login/register/phone-login/wechat-mini', - client_type varchar(32) NULL COMMENT '客户端类型:WEB/WECHAT_MINI', - ip_address varchar(64) NULL COMMENT '同意IP', - device_id varchar(128) NULL COMMENT '设备ID', - consent_time datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '同意时间', - create_time datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', - update_time datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', - PRIMARY KEY (id), - UNIQUE KEY uk_user_agreement_consent (user_id, agreement_type, version), - KEY idx_user_agreement_user (user_id, agreement_type) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='用户协议同意记录'; - -CREATE TABLE IF NOT EXISTS t_security_audit_log ( - id bigint NOT NULL COMMENT '审计日志ID', - user_id bigint NULL COMMENT '操作用户ID', - account varchar(100) NULL COMMENT '操作账号', - action varchar(64) NOT NULL COMMENT '安全动作', - result varchar(32) NOT NULL COMMENT '结果:SUCCESS/FAIL', - reason varchar(255) NULL COMMENT '失败或补充原因', - ip_address varchar(64) NULL COMMENT '请求IP', - device_id varchar(128) NULL COMMENT '设备ID', - operate_time datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '操作时间', - create_time datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', - update_time datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', - PRIMARY KEY (id), - KEY idx_security_audit_action_time (action, operate_time), - KEY idx_security_audit_account_time (account, operate_time) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='安全审计日志'; - -CREATE TABLE IF NOT EXISTS t_system_parameter_config ( - id bigint NOT NULL COMMENT '配置ID', - config_group varchar(50) NOT NULL COMMENT '配置分组', - config_key varchar(100) NOT NULL COMMENT '配置键', - config_name varchar(100) NOT NULL COMMENT '配置名称', - config_value varchar(1000) NULL COMMENT '配置值', - enabled tinyint NOT NULL DEFAULT 1 COMMENT '是否启用:1启用,0停用', - remark varchar(255) NULL COMMENT '备注', - create_time datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', - update_time datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', - is_delete tinyint NOT NULL DEFAULT 0 COMMENT '逻辑删除:0否,1是', - PRIMARY KEY (id), - UNIQUE KEY uk_system_parameter_group_key (config_group, config_key, is_delete) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='系统参数配置'; - -SET @system_parameter_enabled_missing := ( - SELECT COUNT(1) = 0 - FROM information_schema.COLUMNS - WHERE TABLE_SCHEMA = DATABASE() - AND TABLE_NAME = 't_system_parameter_config' - AND COLUMN_NAME = 'enabled' -); -SET @system_parameter_enabled_sql := IF( - @system_parameter_enabled_missing, - 'ALTER TABLE t_system_parameter_config ADD COLUMN enabled tinyint NOT NULL DEFAULT 1 COMMENT ''是否启用:1启用,0停用'' AFTER config_value', - 'SELECT 1' -); -PREPARE stmt_system_parameter_enabled FROM @system_parameter_enabled_sql; -EXECUTE stmt_system_parameter_enabled; -DEALLOCATE PREPARE stmt_system_parameter_enabled; - -INSERT INTO t_legal_agreement (id, agreement_type, title, version, content, status, effective_time, create_time, update_time, is_delete) -VALUES - (313931273555138001, 'USER_TERMS', '用户协议', '2026.05.18', '欢迎使用 Fingertip Designer 指尖设计师。请在使用账号、预约、订单、会员、消息等功能前仔细阅读本协议。继续登录或注册即表示你已理解并同意平台基础服务规则、账号安全要求、订单预约规则和依法合规使用要求。', 1, NOW(), NOW(), NOW(), 0), - (313931273555138002, 'PRIVACY_POLICY', '隐私政策', '2026.05.18', 'Fingertip Designer 指尖设计师会在提供登录注册、预约下单、会员余额、消息通知和客户服务时处理必要的手机号、昵称、门店归属、订单与设备信息。我们仅在业务需要和法律允许范围内使用这些信息,并采取访问控制、脱敏展示和审计记录等措施保护数据安全。', 1, NOW(), NOW(), NOW(), 0) -ON DUPLICATE KEY UPDATE - title = VALUES(title), - content = VALUES(content), - status = VALUES(status), - effective_time = VALUES(effective_time), - is_delete = 0, - update_time = NOW(); - -INSERT INTO t_permission (id, permission_code, permission_name, permission_group, description, create_time, update_time, is_delete) -VALUES - (313931273555136601, 'legal_agreement:manage', '管理协议', '协议管理', '管理用户协议和隐私政策版本', NOW(), NOW(), 0) -ON DUPLICATE KEY UPDATE - permission_name = VALUES(permission_name), - permission_group = VALUES(permission_group), - description = VALUES(description), - is_delete = 0, - update_time = NOW(); - -INSERT INTO t_system_parameter_config ( - id, config_group, config_key, config_name, config_value, enabled, remark, create_time, update_time, is_delete -) -VALUES - (313931273555139000, 'MAP', 'MAP_PROVIDER', '当前地图渠道', 'TENCENT', 1, 'TENCENT 或 AMAP;决定后台店铺选点默认使用哪个地图渠道', NOW(), NOW(), 0), - (313931273555139001, 'MAP', 'TENCENT_MAP_KEY', '腾讯 Web Key', '', 0, '用于后台腾讯地图选点和 Web 展示;请在后台参数管理中填入真实 Key 后启用', NOW(), NOW(), 0), - (313931273555139002, 'MAP', 'AMAP_WEB_KEY', '高德 Web Key', '', 0, '用于后台高德地图选点和 Web 展示;Web 端 Key 与小程序 Key 分开维护', NOW(), NOW(), 0), - (313931273555139003, 'MAP', 'AMAP_MINI_KEY', '高德小程序 Key', '', 0, '用于后续小程序端高德 SDK/API 调用;不要与 Web Key 混用', NOW(), NOW(), 0), - (313931273555139004, 'USER', 'DEFAULT_PASSWORD', '后台新增用户默认密码', 'Fingertip@123', 1, '后台新增用户不填写密码时使用;需满足 8-32 位且至少包含数字、小写字母、大写字母、特殊符号中的 3 类', NOW(), NOW(), 0) -ON DUPLICATE KEY UPDATE - config_name = VALUES(config_name), - remark = VALUES(remark), - config_value = IF(t_system_parameter_config.config_key = 'MAP_PROVIDER' AND (t_system_parameter_config.config_value IS NULL OR t_system_parameter_config.config_value = ''), VALUES(config_value), t_system_parameter_config.config_value), - is_delete = 0, - update_time = NOW(); - --- 最小运行初始化:确保 xiaowang 拥有当前权限目录中的全部权限。 -INSERT INTO t_user_permission (id, user_id, permission_id, create_time, update_time, create_by, update_by, is_delete) -SELECT - 313931273556000000 + p.id, - u.id, - p.id, - NOW(), - NOW(), - u.id, - u.id, - 0 -FROM t_user u -INNER JOIN t_permission p - ON p.is_delete = 0 -WHERE u.account = 'xiaowang' - AND u.is_delete = 0 - AND u.type = 4 -ON DUPLICATE KEY UPDATE - is_delete = 0, - update_by = VALUES(update_by), - update_time = NOW(); - -INSERT INTO t_permission (id, permission_code, permission_name, permission_group, description, create_time, update_time, is_delete) -VALUES - (313931273555136602, 'security:audit:view', '查看安全审计', '安全审计', '查看高危操作和登录安全审计日志', NOW(), NOW(), 0) -ON DUPLICATE KEY UPDATE - permission_name = VALUES(permission_name), - permission_group = VALUES(permission_group), - description = VALUES(description), - is_delete = 0, - update_time = NOW(); - --- 最终权限兜底:确保平台管理员拥有当前权限目录中的全部基础权限。 -INSERT INTO t_user_permission (id, user_id, permission_id, create_time, update_time, create_by, update_by, is_delete) -SELECT - (CAST(u.id AS UNSIGNED) << 20) + (CAST(p.id AS UNSIGNED) & 1048575), - u.id, - p.id, - NOW(), - NOW(), - 0, - 0, - 0 -FROM t_user u -INNER JOIN t_permission p - ON p.is_delete = 0 -WHERE u.account = 'xiaowang' - AND u.is_delete = 0 - AND u.type = 4 -ON DUPLICATE KEY UPDATE - is_delete = 0, - update_by = VALUES(update_by), - update_time = NOW(); diff --git a/docs/scripts/sql/migrations/20260825-双端独立数据库/设计师独立数据库_20260825.sql b/docs/scripts/sql/init/jayucloud-artlist.sql similarity index 97% rename from docs/scripts/sql/migrations/20260825-双端独立数据库/设计师独立数据库_20260825.sql rename to docs/scripts/sql/init/jayucloud-artlist.sql index cb36ca2c..b788e543 100644 --- a/docs/scripts/sql/migrations/20260825-双端独立数据库/设计师独立数据库_20260825.sql +++ b/docs/scripts/sql/init/jayucloud-artlist.sql @@ -1732,6 +1732,7 @@ ON DUPLICATE KEY UPDATE is_delete = 0, update_time = NOW(); + CALL sp_add_column_if_not_exists('t_order', 'customer_remark', 'varchar(500) NULL COMMENT ''用户询价预约备注'''); CALL sp_add_column_if_not_exists('t_order', 'quote_status', 'varchar(32) NULL COMMENT ''报价状态:CONFIRMING/CONFIRMED/EXPIRED'''); CALL sp_add_column_if_not_exists('t_order', 'quote_user_confirmed', 'tinyint unsigned NOT NULL DEFAULT 0 COMMENT ''用户是否确认当前报价'''); @@ -1910,7 +1911,7 @@ SELECT 'xiaowang', 0, 0, - '$2a$10$I3mV64NhISqMmm7soSki1.Y36ve.TOINGOrVt0U0kxjO7GtxavE16', + '$2a$10$3ZC5HHVK6EYIfkjcU9IHZulGXwNZhy.6LU85HRJC9A.3LHm0IEdMO', '', '管理员', 4, @@ -2311,3 +2312,14 @@ ON DUPLICATE KEY UPDATE is_delete = 0, update_by = VALUES(update_by), update_time = NOW(); + +-- 排班规则与例外 +CREATE TABLE IF NOT EXISTS t_artist_schedule_rule ( + id bigint unsigned NOT NULL COMMENT '排班规则ID', shop_id bigint unsigned NOT NULL COMMENT '店铺ID', artist_id bigint unsigned NOT NULL COMMENT '美甲师用户ID', preset_type varchar(32) NOT NULL COMMENT '预设类型', work_days varchar(32) NOT NULL COMMENT '工作星期,1-7逗号分隔', start_time time NOT NULL COMMENT '常规开始时间', end_time time NOT NULL COMMENT '常规结束时间', slot_minutes int NOT NULL DEFAULT 60 COMMENT '预约间隔分钟', capacity int NOT NULL DEFAULT 1 COMMENT '同一时间段容量', status tinyint NOT NULL DEFAULT 1 COMMENT '状态:1启用,0停用', remark varchar(255) NULL COMMENT '备注', create_time datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', update_time datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', is_delete tinyint NOT NULL DEFAULT 0 COMMENT '逻辑删除', PRIMARY KEY (id), UNIQUE KEY uk_artist_schedule_rule_artist (shop_id, artist_id, is_delete), KEY idx_artist_schedule_rule_shop_status (shop_id, status, is_delete) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='美甲师常规排班规则表'; +CREATE TABLE IF NOT EXISTS t_artist_schedule_exception ( + id bigint unsigned NOT NULL COMMENT '排班例外ID', shop_id bigint unsigned NOT NULL COMMENT '店铺ID', artist_id bigint unsigned NOT NULL COMMENT '美甲师用户ID', work_date date NOT NULL COMMENT '例外日期', exception_type varchar(32) NOT NULL COMMENT '例外类型:REST/EXTRA_WORK/CHANGE_SHIFT', start_time time NULL COMMENT '例外开始时间', end_time time NULL COMMENT '例外结束时间', slot_minutes int NOT NULL DEFAULT 60 COMMENT '预约间隔分钟', capacity int NOT NULL DEFAULT 1 COMMENT '同一时间段容量', remark varchar(255) NULL COMMENT '备注', create_time datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', update_time datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', is_delete tinyint NOT NULL DEFAULT 0 COMMENT '逻辑删除', PRIMARY KEY (id), UNIQUE KEY uk_artist_schedule_exception_date (shop_id, artist_id, work_date, is_delete), KEY idx_artist_schedule_exception_artist_date (artist_id, work_date, is_delete) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='美甲师排班例外表'; +SET FOREIGN_KEY_CHECKS = 0; +DROP TABLE IF EXISTS t_inventory_record; DROP TABLE IF EXISTS t_inventory_item; DROP TABLE IF EXISTS t_campaign; DROP TABLE IF EXISTS t_security_audit_log; DROP TABLE IF EXISTS t_user_shop_role; DROP TABLE IF EXISTS t_shop_role_permission; DROP TABLE IF EXISTS t_shop_role; DROP TABLE IF EXISTS t_user_permission; DROP TABLE IF EXISTS t_permission; +SET FOREIGN_KEY_CHECKS = 1; diff --git a/docs/scripts/sql/migrations/20260825-双端独立数据库/店务独立数据库_20260825.sql b/docs/scripts/sql/init/jayucloud-salon.sql similarity index 97% rename from docs/scripts/sql/migrations/20260825-双端独立数据库/店务独立数据库_20260825.sql rename to docs/scripts/sql/init/jayucloud-salon.sql index e7511b16..3a8e946e 100644 --- a/docs/scripts/sql/migrations/20260825-双端独立数据库/店务独立数据库_20260825.sql +++ b/docs/scripts/sql/init/jayucloud-salon.sql @@ -1732,6 +1732,7 @@ ON DUPLICATE KEY UPDATE is_delete = 0, update_time = NOW(); + CALL sp_add_column_if_not_exists('t_order', 'customer_remark', 'varchar(500) NULL COMMENT ''用户询价预约备注'''); CALL sp_add_column_if_not_exists('t_order', 'quote_status', 'varchar(32) NULL COMMENT ''报价状态:CONFIRMING/CONFIRMED/EXPIRED'''); CALL sp_add_column_if_not_exists('t_order', 'quote_user_confirmed', 'tinyint unsigned NOT NULL DEFAULT 0 COMMENT ''用户是否确认当前报价'''); @@ -1910,7 +1911,7 @@ SELECT 'xiaowang', 0, 0, - '$2a$10$I3mV64NhISqMmm7soSki1.Y36ve.TOINGOrVt0U0kxjO7GtxavE16', + '$2a$10$3ZC5HHVK6EYIfkjcU9IHZulGXwNZhy.6LU85HRJC9A.3LHm0IEdMO', '', '管理员', 4, @@ -2311,3 +2312,14 @@ ON DUPLICATE KEY UPDATE is_delete = 0, update_by = VALUES(update_by), update_time = NOW(); + +-- 排班规则与例外 +CREATE TABLE IF NOT EXISTS t_artist_schedule_rule ( + id bigint unsigned NOT NULL COMMENT '排班规则ID', shop_id bigint unsigned NOT NULL COMMENT '店铺ID', artist_id bigint unsigned NOT NULL COMMENT '美甲师用户ID', preset_type varchar(32) NOT NULL COMMENT '预设类型', work_days varchar(32) NOT NULL COMMENT '工作星期,1-7逗号分隔', start_time time NOT NULL COMMENT '常规开始时间', end_time time NOT NULL COMMENT '常规结束时间', slot_minutes int NOT NULL DEFAULT 60 COMMENT '预约间隔分钟', capacity int NOT NULL DEFAULT 1 COMMENT '同一时间段容量', status tinyint NOT NULL DEFAULT 1 COMMENT '状态:1启用,0停用', remark varchar(255) NULL COMMENT '备注', create_time datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', update_time datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', is_delete tinyint NOT NULL DEFAULT 0 COMMENT '逻辑删除', PRIMARY KEY (id), UNIQUE KEY uk_artist_schedule_rule_artist (shop_id, artist_id, is_delete), KEY idx_artist_schedule_rule_shop_status (shop_id, status, is_delete) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='美甲师常规排班规则表'; +CREATE TABLE IF NOT EXISTS t_artist_schedule_exception ( + id bigint unsigned NOT NULL COMMENT '排班例外ID', shop_id bigint unsigned NOT NULL COMMENT '店铺ID', artist_id bigint unsigned NOT NULL COMMENT '美甲师用户ID', work_date date NOT NULL COMMENT '例外日期', exception_type varchar(32) NOT NULL COMMENT '例外类型:REST/EXTRA_WORK/CHANGE_SHIFT', start_time time NULL COMMENT '例外开始时间', end_time time NULL COMMENT '例外结束时间', slot_minutes int NOT NULL DEFAULT 60 COMMENT '预约间隔分钟', capacity int NOT NULL DEFAULT 1 COMMENT '同一时间段容量', remark varchar(255) NULL COMMENT '备注', create_time datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', update_time datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', is_delete tinyint NOT NULL DEFAULT 0 COMMENT '逻辑删除', PRIMARY KEY (id), UNIQUE KEY uk_artist_schedule_exception_date (shop_id, artist_id, work_date, is_delete), KEY idx_artist_schedule_exception_artist_date (artist_id, work_date, is_delete) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='美甲师排班例外表'; +SET FOREIGN_KEY_CHECKS = 0; +DROP TABLE IF EXISTS t_wishlist; DROP TABLE IF EXISTS t_wishlist_group; DROP TABLE IF EXISTS t_product_like; DROP TABLE IF EXISTS t_cart; DROP TABLE IF EXISTS t_vip_info; DROP TABLE IF EXISTS t_vip_benefit; DROP TABLE IF EXISTS t_user_growth_record; DROP TABLE IF EXISTS t_user_coupon; DROP TABLE IF EXISTS t_coupon_tag; DROP TABLE IF EXISTS t_coupon; +SET FOREIGN_KEY_CHECKS = 1; diff --git a/docs/scripts/sql/migrations/.gitkeep b/docs/scripts/sql/migrations/.gitkeep deleted file mode 100644 index e69de29b..00000000 diff --git a/docs/scripts/sql/migrations/20260825-双端职责裁剪/店务端职责裁剪_20260825.sql b/docs/scripts/sql/migrations/20260825-双端职责裁剪/店务端职责裁剪_20260825.sql deleted file mode 100644 index 9e6de7f3..00000000 --- a/docs/scripts/sql/migrations/20260825-双端职责裁剪/店务端职责裁剪_20260825.sql +++ /dev/null @@ -1,14 +0,0 @@ --- 店务端职责裁剪:移除设计师用户侧购物车、收藏、会员和商品互动结构。 --- 执行前必须完成 jayucloud_salon 数据库备份,并在维护窗口执行。 -SET FOREIGN_KEY_CHECKS = 0; -DROP TABLE IF EXISTS t_wishlist; -DROP TABLE IF EXISTS t_wishlist_group; -DROP TABLE IF EXISTS t_product_like; -DROP TABLE IF EXISTS t_cart; -DROP TABLE IF EXISTS t_vip_info; -DROP TABLE IF EXISTS t_vip_benefit; -DROP TABLE IF EXISTS t_user_growth_record; -DROP TABLE IF EXISTS t_user_coupon; -DROP TABLE IF EXISTS t_coupon_tag; -DROP TABLE IF EXISTS t_coupon; -SET FOREIGN_KEY_CHECKS = 1; diff --git a/docs/scripts/sql/migrations/20260825-双端职责裁剪/设计师端职责裁剪_20260825.sql b/docs/scripts/sql/migrations/20260825-双端职责裁剪/设计师端职责裁剪_20260825.sql deleted file mode 100644 index 200c4c4c..00000000 --- a/docs/scripts/sql/migrations/20260825-双端职责裁剪/设计师端职责裁剪_20260825.sql +++ /dev/null @@ -1,13 +0,0 @@ --- 设计师端职责裁剪:移除仅店务管理使用的库存、营销活动和权限审计结构。 --- 执行前必须完成 jayucloud_artlist 数据库备份,并在维护窗口执行。 -SET FOREIGN_KEY_CHECKS = 0; -DROP TABLE IF EXISTS t_inventory_record; -DROP TABLE IF EXISTS t_inventory_item; -DROP TABLE IF EXISTS t_campaign; -DROP TABLE IF EXISTS t_security_audit_log; -DROP TABLE IF EXISTS t_user_shop_role; -DROP TABLE IF EXISTS t_shop_role_permission; -DROP TABLE IF EXISTS t_shop_role; -DROP TABLE IF EXISTS t_user_permission; -DROP TABLE IF EXISTS t_permission; -SET FOREIGN_KEY_CHECKS = 1; diff --git a/docs/scripts/sql/migrations/员工排班规则和例外_20260626.sql b/docs/scripts/sql/migrations/员工排班规则和例外_20260626.sql deleted file mode 100644 index 14756f9d..00000000 --- a/docs/scripts/sql/migrations/员工排班规则和例外_20260626.sql +++ /dev/null @@ -1,92 +0,0 @@ --- 员工排班规则和例外,保留 t_artist_schedule 作为预约校验使用的具体日期排班表。 -use fingertipdesigner; -DROP PROCEDURE IF EXISTS sp_fd_add_index_if_not_exists; -DELIMITER $$ -CREATE PROCEDURE sp_fd_add_index_if_not_exists( - IN p_table_name varchar(128), - IN p_index_name varchar(128), - IN p_index_sql varchar(1000) -) -BEGIN - IF NOT EXISTS ( - SELECT 1 - FROM information_schema.statistics - WHERE table_schema = DATABASE() - AND table_name = p_table_name - AND index_name = p_index_name - ) THEN - SET @fd_sql = CONCAT('ALTER TABLE ', p_table_name, ' ADD INDEX ', p_index_name, ' ', p_index_sql); - PREPARE fd_stmt FROM @fd_sql; - EXECUTE fd_stmt; - DEALLOCATE PREPARE fd_stmt; - END IF; -END$$ -DELIMITER ; - -DROP PROCEDURE IF EXISTS sp_fd_add_unique_index_if_not_exists; -DELIMITER $$ -CREATE PROCEDURE sp_fd_add_unique_index_if_not_exists( - IN p_table_name varchar(128), - IN p_index_name varchar(128), - IN p_index_sql varchar(1000) -) -BEGIN - IF NOT EXISTS ( - SELECT 1 - FROM information_schema.statistics - WHERE table_schema = DATABASE() - AND table_name = p_table_name - AND index_name = p_index_name - ) THEN - SET @fd_sql = CONCAT('ALTER TABLE ', p_table_name, ' ADD UNIQUE INDEX ', p_index_name, ' ', p_index_sql); - PREPARE fd_stmt FROM @fd_sql; - EXECUTE fd_stmt; - DEALLOCATE PREPARE fd_stmt; - END IF; -END$$ -DELIMITER ; - -CREATE TABLE IF NOT EXISTS t_artist_schedule_rule -( - id bigint unsigned NOT NULL COMMENT '排班规则ID', - shop_id bigint unsigned NOT NULL COMMENT '店铺ID', - artist_id bigint unsigned NOT NULL COMMENT '美甲师用户ID', - preset_type varchar(32) NOT NULL COMMENT '预设类型', - work_days varchar(32) NOT NULL COMMENT '工作星期,1-7逗号分隔', - start_time time NOT NULL COMMENT '常规开始时间', - end_time time NOT NULL COMMENT '常规结束时间', - slot_minutes int NOT NULL DEFAULT 60 COMMENT '预约间隔分钟', - capacity int NOT NULL DEFAULT 1 COMMENT '同一时间段容量', - status tinyint NOT NULL DEFAULT 1 COMMENT '状态:1启用,0停用', - remark varchar(255) NULL COMMENT '备注', - create_time datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', - update_time datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', - is_delete tinyint NOT NULL DEFAULT 0 COMMENT '逻辑删除', - PRIMARY KEY (id) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='美甲师常规排班规则表'; - -CREATE TABLE IF NOT EXISTS t_artist_schedule_exception -( - id bigint unsigned NOT NULL COMMENT '排班例外ID', - shop_id bigint unsigned NOT NULL COMMENT '店铺ID', - artist_id bigint unsigned NOT NULL COMMENT '美甲师用户ID', - work_date date NOT NULL COMMENT '例外日期', - exception_type varchar(32) NOT NULL COMMENT '例外类型:REST/EXTRA_WORK/CHANGE_SHIFT', - start_time time NULL COMMENT '例外开始时间', - end_time time NULL COMMENT '例外结束时间', - slot_minutes int NOT NULL DEFAULT 60 COMMENT '预约间隔分钟', - capacity int NOT NULL DEFAULT 1 COMMENT '同一时间段容量', - remark varchar(255) NULL COMMENT '备注', - create_time datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', - update_time datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', - is_delete tinyint NOT NULL DEFAULT 0 COMMENT '逻辑删除', - PRIMARY KEY (id) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='美甲师排班例外表'; - -CALL sp_fd_add_unique_index_if_not_exists('t_artist_schedule_rule', 'uk_artist_schedule_rule_artist', '(`shop_id`, `artist_id`, `is_delete`)'); -CALL sp_fd_add_index_if_not_exists('t_artist_schedule_rule', 'idx_artist_schedule_rule_shop_status', '(`shop_id`, `status`, `is_delete`)'); -CALL sp_fd_add_unique_index_if_not_exists('t_artist_schedule_exception', 'uk_artist_schedule_exception_date', '(`shop_id`, `artist_id`, `work_date`, `is_delete`)'); -CALL sp_fd_add_index_if_not_exists('t_artist_schedule_exception', 'idx_artist_schedule_exception_artist_date', '(`artist_id`, `work_date`, `is_delete`)'); - -DROP PROCEDURE IF EXISTS sp_fd_add_index_if_not_exists; -DROP PROCEDURE IF EXISTS sp_fd_add_unique_index_if_not_exists; diff --git a/docs/scripts/双端独立部署配置说明20260825.md b/docs/scripts/双端独立部署配置说明20260825.md index 389237d8..0caabec9 100644 --- a/docs/scripts/双端独立部署配置说明20260825.md +++ b/docs/scripts/双端独立部署配置说明20260825.md @@ -30,10 +30,10 @@ ## 数据库脚本 -- `docs/scripts/sql/migrations/20260825-双端独立数据库/设计师独立数据库_20260825.sql` -- `docs/scripts/sql/migrations/20260825-双端独立数据库/店务独立数据库_20260825.sql` +- `docs/scripts/sql/init/jayucloud-artlist.sql` +- `docs/scripts/sql/init/jayucloud-salon.sql` -两份脚本均为完整可执行空库初始化脚本,不修改冻结的 `docs/scripts/sql/init/FingertipDesigner.sql`,本次不迁移既有生产数据。 +两份脚本均为完整可执行空库初始化脚本,分别包含端侧职责裁剪与排班规则;新建库仅执行目标端对应脚本。 ## 发布前验证 diff --git a/docs/scripts/接回MinIO三副本对象存储配置说明_20260624.md b/docs/scripts/接回MinIO三副本对象存储配置说明_20260624.md index d12152f4..df125e7a 100644 --- a/docs/scripts/接回MinIO三副本对象存储配置说明_20260624.md +++ b/docs/scripts/接回MinIO三副本对象存储配置说明_20260624.md @@ -126,7 +126,7 @@ aliyun: 必须执行版本变更 SQL: -MinIO 三副本对象存储所需表结构已经并入 `docs/scripts/sql/init/FingertipDesigner.sql`。开发、测试和上线空库只执行该初始化 SQL。 +MinIO 三副本对象存储所需表结构已经并入端侧初始化 SQL。店务端执行 `docs/scripts/sql/init/jayucloud-salon.sql`,设计师端执行 `docs/scripts/sql/init/jayucloud-artlist.sql`。 该脚本会新增 `t_object_storage_file_replica`,并为历史文件生成 `MINIO`、`QINIU_KODO`、`ALIYUN_OSS` 三类副本记录。已有成功副本不会被覆盖,缺失副本会进入待上传状态,由重试任务补齐。 diff --git a/docs/scripts/统一数据库名为FingertipDesigner配置说明_20260617.md b/docs/scripts/统一数据库名为FingertipDesigner配置说明_20260617.md index 0cb7119e..3f1e01f8 100644 --- a/docs/scripts/统一数据库名为FingertipDesigner配置说明_20260617.md +++ b/docs/scripts/统一数据库名为FingertipDesigner配置说明_20260617.md @@ -10,8 +10,8 @@ - Nacos 或本地 `spring.datasource.url` 必须指向 `jdbc:mysql://:/FingertipDesigner`。 - Core 与 Gateway 默认 Nacos 命名空间为 `FingertipDesigner`,如需连接其他环境必须显式设置 `NACOS_NAMESPACE`。 -- MySQL 中必须存在 `FingertipDesigner` 数据库;首次部署可执行 `docs/scripts/sql/init/FingertipDesigner.sql`。 -- 开发、测试和上线空库只执行 `docs/scripts/sql/init/FingertipDesigner.sql`;已部署生产库如需调整库名,需要单独制定生产迁移方案。 +- MySQL 中必须存在目标端数据库:店务端为 `jayucloud_salon`,设计师端为 `jayucloud_artlist`;首次部署执行对应端侧初始化 SQL。 +- 开发、测试和上线空库分别执行 `docs/scripts/sql/init/jayucloud-salon.sql` 或 `docs/scripts/sql/init/jayucloud-artlist.sql`;已部署生产库如需调整库名,需要单独制定生产迁移方案。 ## 注意事项 diff --git a/docs/testing/指尖管理师上线检查清单_20260622.md b/docs/testing/指尖管理师上线检查清单_20260622.md index 4e8524c0..2c238f55 100644 --- a/docs/testing/指尖管理师上线检查清单_20260622.md +++ b/docs/testing/指尖管理师上线检查清单_20260622.md @@ -9,7 +9,7 @@ ## 初始化 SQL -- [x] 唯一初始化脚本入口:`docs/scripts/sql/init/FingertipDesigner.sql` +- [x] 店务端初始化脚本入口:`docs/scripts/sql/init/jayucloud-salon.sql` - [x] 已明确开发、测试、上线空库只执行该 SQL - [x] 已删除旧迁移 SQL,历史变更已合并进初始化基线 - [x] 已保留一名平台管理员 `xiaowang` @@ -19,7 +19,7 @@ - [x] 已合并 `t_product.front_visible` - [x] 已合并 `t_product.source_type` - [x] 已确认 `t_messagehub_push_config.source_system` 使用 `fingertipdesigner` -- [ ] 需在可直连 MySQL 的环境创建临时库并全量执行 `FingertipDesigner.sql` +- [ ] 需在可直连 MySQL 的环境创建临时库并全量执行 `jayucloud-salon.sql` - [ ] 需记录 fresh install 执行耗时、warning、失败语句和最终表结构 - [ ] 需确认生产 MySQL `lower_case_table_names` 与库名大小写策略 diff --git a/docs/testing/指尖管理师上线部署审计报告_20260622.md b/docs/testing/指尖管理师上线部署审计报告_20260622.md index 2838682a..e615624f 100644 --- a/docs/testing/指尖管理师上线部署审计报告_20260622.md +++ b/docs/testing/指尖管理师上线部署审计报告_20260622.md @@ -8,14 +8,14 @@ ## 审计范围 -- 初始化脚本:`docs/scripts/sql/init/FingertipDesigner.sql` +- 当前初始化脚本:`docs/scripts/sql/init/jayucloud-salon.sql` - 后端服务:`FD-Core`、`FD-Gateway` - 指尖管理师小程序:`FM-Wechat-Fronted` - GitNexus:索引时间为 2026-06-16,仅用于辅助导航;结论以当前文件系统源码和本轮命令输出为准。 ## 2026-06-24 SQL 基线修订 -- `docs/scripts/sql/init/FingertipDesigner.sql` 已调整为唯一初始化 SQL,开发、测试、上线空库初始化均以该文件为准。 +- 当前店务端空库初始化以 `docs/scripts/sql/init/jayucloud-salon.sql` 为准;设计师端使用 `docs/scripts/sql/init/jayucloud-artlist.sql`。 - 旧项目命名、MinIO 三副本对象存储、预约手动项目展示控制等历史变更已合并进初始化基线。 - `docs/scripts/sql/migrations` 当前不再保留历史迁移 SQL;本轮开发环境测试不再要求额外执行迁移脚本。 - 已部署生产库不能直接执行初始化 SQL;如果需要升级已有库,必须单独制定迁移方案并人工确认。 @@ -26,7 +26,7 @@ | 类别 | 结论 | 证据 | | --- | --- | --- | | SQL 完整度 | 主体完整,但存在部署方式风险 | 当前 MySQL `fingertipdesigner` 有 54 张表、323 个索引、所有表有主键;静态解析 54 个 `@TableName` 实体与 54 张表无缺失 | -| SQL 合理性 | 可用于空库初始化,不适合直接重复执行 | `FingertipDesigner.sql` 固定 `CREATE DATABASE IF NOT EXISTS fingertipdesigner` 和 `use fingertipdesigner`,前置 `create table t_balance` 等不是全部 `IF NOT EXISTS` | +| SQL 合理性 | 可用于空库初始化,不适合直接重复执行 | `jayucloud-salon.sql` 固定创建并使用 `jayucloud_salon`,前置建表不是全部 `IF NOT EXISTS` | | SQL 兼容性 | 有大小写和排序规则风险 | 后端默认 datasource 写 `FingertipDesigner`,SQL/当前库为 `fingertipdesigner`;当前 4 张表为 `utf8mb4_general_ci`,其余为 `utf8mb4_unicode_ci` | | 后端构建 | 通过 | `FD-Core mvn test` 131 个测试通过;`FD-Gateway mvn test` 4 个测试通过;两者 `mvn package -DskipTests` 成功 | | 后端/数据库匹配 | 主体匹配 | SQL 表与实体表名覆盖一致;`FingertipDesignerSqlSchemaTest` 覆盖对象存储、运营表、权限、默认密码等关键脚本片段 | @@ -181,7 +181,7 @@ 证据: -- `FingertipDesigner.sql` 创建并使用 `fingertipdesigner`。 +- `jayucloud-salon.sql` 创建并使用 `jayucloud_salon`。 - `FD-Core/src/main/resources/application.yaml:3` 默认连接 `jdbc:mysql://localhost:3306/FingertipDesigner`。 - MySQL MCP 当前库名为 `fingertipdesigner`。 @@ -201,7 +201,7 @@ 证据: - `docs/scripts/sql/migrations` 当前仅有 `.gitkeep`。 -- `FingertipDesigner.sql` 注释仍提到历史增量脚本用于已有数据库升级。 +- 当前端侧初始化脚本不再依赖历史增量脚本。 - 项目规则要求后端涉及 SQL 时不要修改初始化 SQL,必须新增版本变更 SQL。 影响: @@ -289,7 +289,7 @@ 2. 明确并修复注册白名单策略。 3. 移除生产 mock/static 兜底,改为真实错误态。 4. 补齐或下线门店设置、导出、客户详情等未接入功能。 -5. 在可直连 MySQL 的环境全量执行 `FingertipDesigner.sql` 到临时库,并记录 warning。 +5. 在可直连 MySQL 的环境全量执行 `jayucloud-salon.sql` 到临时库,并记录 warning。 6. 验证唯一初始化 SQL 已包含全部上线所需表、字段、索引和运行必需种子数据。 7. 用干净的微信开发者工具会话重新打开 `FM-Wechat-Fronted` 并跑核心页面冒烟。 8. 以生产 Nacos/Redis/RabbitMQ/MySQL/对象存储配置启动 Core/Gateway 并跑接口冒烟。 diff --git a/docs/运维配置与集成说明.md b/docs/运维配置与集成说明.md index 5f9cbc01..5f0205fe 100644 --- a/docs/运维配置与集成说明.md +++ b/docs/运维配置与集成说明.md @@ -15,9 +15,7 @@ Nacos 配置源位于 `nacos/namespaces/dev/`、`nacos/namespaces/sit/` 与 `nac 生产对象存储默认使用中心1 MinIO `http://192.168.10.105:9000`,中心2 `http://192.168.20.15:9000` 仅在灾备接管时切换。七牛云 Kodo 使用私有空间 `jayucloud`、`z2` 和 `https://img.yunail.art`;阿里云 OSS 使用私有桶 `jayucloud`、`cn-chengdu` 和 `https://oss-cn-chengdu.aliyuncs.com`。详细发布与验证要求见 `docs/scripts/生产对象存储与中间件配置调整说明_20260825.md`。 -两套数据库空库脚本位于 `docs/scripts/sql/migrations/20260825-双端独立数据库/`。生产执行前须先核对目标库、账号和备份状态;本次改造不迁移既有生产数据。 - -职责裁剪迁移位于 `docs/scripts/sql/migrations/20260825-双端职责裁剪/`,必须在对应后端裁剪发布完成、数据库备份确认后执行。 +两套数据库空库脚本位于 `docs/scripts/sql/init/`:店务端执行 `jayucloud-salon.sql`,设计师端执行 `jayucloud-artlist.sql`。两个脚本已包含各自端侧职责边界和排班规则;生产执行前须先核对目标库、账号和备份状态。 ## 环境变量总表 diff --git a/docs/项目功能概览.md b/docs/项目功能概览.md index ac3fa697..6ae83d55 100644 --- a/docs/项目功能概览.md +++ b/docs/项目功能概览.md @@ -31,7 +31,6 @@ FingertipDesigner 指尖设计师是一个面向美甲门店经营的全链路 - `docs/testing/`:测试计划、测试报告和用例矩阵。 - `JC-ArtList-Core/src/main/java/com/xiaowang/fingertipdesigner/core/modules/`:后端 Core 业务模块目录。 - `JC-ArtList-Core/src/main/java/com/xiaowang/fingertipdesigner/core/common/`:后端 Core 公共 DTO、VO 和基类目录。 -- `docs/scripts/sql/init/`:`0.0.1` 空库初始化 SQL 基线,后续不再修改。 -- `docs/scripts/sql/migrations/`:`0.0.1` 后的数据库版本变更 SQL 目录。 +- `docs/scripts/sql/init/`:店务端 `jayucloud-salon.sql` 与设计师端 `jayucloud-artlist.sql` 的空库初始化脚本。 - `docs/scripts/0.0.1版本基线与后续迭代规则_20260628.md`:脚本、配置、SQL 后续版本迭代规则。 - `artifacts/maven/`:Maven 打包产物指定输出目录。 diff --git a/docs/项目变更记录.md b/docs/项目变更记录.md index 84a263e4..26b7a141 100644 --- a/docs/项目变更记录.md +++ b/docs/项目变更记录.md @@ -22,5 +22,5 @@ - 目录、Maven 产物、前端包名、小程序项目和部署入口统一为 `JC-ArtList-*` / `JC-Salon-*`。 - Nacos namespace 保持不变,服务注册名和 Gateway 路由改为 `jc-artlist-*` / `jc-salon-*`。 - 设计师 Web 与小程序移除管理端路由、页面、API、后台会话和管理入口;店务 Web 收敛为管理端路由。 -- 新增 `docs/scripts/sql/migrations/20260825-双端职责裁剪/` 两份职责裁剪迁移脚本。 +- 将双端职责裁剪结果合并到 `docs/scripts/sql/init/jayucloud-salon.sql` 与 `docs/scripts/sql/init/jayucloud-artlist.sql`。 - GitNexus impact/detect_changes 受本地 LadybugDB WAL 崩溃影响未能返回结果,已通过四后端打包和前端构建/测试进行替代验证。 -- 2.54.0 From 581136cb24b926f83984affc1a4991c53ab06b6f Mon Sep 17 00:00:00 2001 From: xiaowang <2161656029@qq.com> Date: Wed, 26 Aug 2026 20:18:47 +0800 Subject: [PATCH 05/19] =?UTF-8?q?=E9=85=8D=E7=BD=AE=E4=BF=AE=E6=94=B9?= =?UTF-8?q?=E4=BB=A5=E5=8F=8Abug=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../user/controller/front/UserController.java | 17 ----------------- .../user/service/impl/UserServiceImpl.java | 17 ----------------- .../JayuCloudSalonGatewayApplication.java | 2 +- JC-Salon-WeChat/project.config.json | 2 +- docs/scripts/sql/init/jayucloud-salon.sql | 2 +- .../jayucloud-salon/DEFAULT_GROUP/secret.yaml | 4 ++-- 6 files changed, 5 insertions(+), 39 deletions(-) diff --git a/JC-Salon-Core/src/main/java/com/xiaowang/jacyucloudsalon/core/modules/user/controller/front/UserController.java b/JC-Salon-Core/src/main/java/com/xiaowang/jacyucloudsalon/core/modules/user/controller/front/UserController.java index 5e718e0d..aeebcbfa 100644 --- a/JC-Salon-Core/src/main/java/com/xiaowang/jacyucloudsalon/core/modules/user/controller/front/UserController.java +++ b/JC-Salon-Core/src/main/java/com/xiaowang/jacyucloudsalon/core/modules/user/controller/front/UserController.java @@ -3,23 +3,6 @@ package com.xiaowang.jacyucloudsalon.core.modules.user.controller.front; import com.xiaowang.jacyucloudsalon.core.annotation.RequirePermission; import com.xiaowang.jacyucloudsalon.core.annotation.OperationGuard; import com.xiaowang.jacyucloudsalon.core.common.Result; -import com.xiaowang.fingertipdesigner.core.common.dto.*; -import com.xiaowang.fingertipdesigner.core.modules.artist.dto.*; -import com.xiaowang.fingertipdesigner.core.modules.auth.dto.*; -import com.xiaowang.fingertipdesigner.core.modules.content.dto.*; -import com.xiaowang.fingertipdesigner.core.modules.file.dto.*; -import com.xiaowang.fingertipdesigner.core.modules.integration.dto.*; -import com.xiaowang.fingertipdesigner.core.modules.inventory.dto.*; -import com.xiaowang.fingertipdesigner.core.modules.marketing.dto.*; -import com.xiaowang.fingertipdesigner.core.modules.message.dto.*; -import com.xiaowang.fingertipdesigner.core.modules.order.dto.*; -import com.xiaowang.fingertipdesigner.core.modules.payment.dto.*; -import com.xiaowang.fingertipdesigner.core.modules.planning.dto.*; -import com.xiaowang.fingertipdesigner.core.modules.product.dto.*; -import com.xiaowang.fingertipdesigner.core.modules.security.dto.*; -import com.xiaowang.fingertipdesigner.core.modules.shop.dto.*; -import com.xiaowang.fingertipdesigner.core.modules.system.dto.*; -import com.xiaowang.fingertipdesigner.core.modules.user.dto.*; import com.xiaowang.jacyucloudsalon.core.modules.user.entity.UserDO; import com.xiaowang.jacyucloudsalon.core.modules.user.mapper.UserMapper; import com.xiaowang.jacyucloudsalon.core.modules.file.service.ChunkUploadService; diff --git a/JC-Salon-Core/src/main/java/com/xiaowang/jacyucloudsalon/core/modules/user/service/impl/UserServiceImpl.java b/JC-Salon-Core/src/main/java/com/xiaowang/jacyucloudsalon/core/modules/user/service/impl/UserServiceImpl.java index 2edeacea..77e819e7 100644 --- a/JC-Salon-Core/src/main/java/com/xiaowang/jacyucloudsalon/core/modules/user/service/impl/UserServiceImpl.java +++ b/JC-Salon-Core/src/main/java/com/xiaowang/jacyucloudsalon/core/modules/user/service/impl/UserServiceImpl.java @@ -6,23 +6,6 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.xiaowang.jacyucloudsalon.core.config.BrandProperties; -import com.xiaowang.fingertipdesigner.core.common.dto.*; -import com.xiaowang.fingertipdesigner.core.modules.artist.dto.*; -import com.xiaowang.fingertipdesigner.core.modules.auth.dto.*; -import com.xiaowang.fingertipdesigner.core.modules.content.dto.*; -import com.xiaowang.fingertipdesigner.core.modules.file.dto.*; -import com.xiaowang.fingertipdesigner.core.modules.integration.dto.*; -import com.xiaowang.fingertipdesigner.core.modules.inventory.dto.*; -import com.xiaowang.fingertipdesigner.core.modules.marketing.dto.*; -import com.xiaowang.fingertipdesigner.core.modules.message.dto.*; -import com.xiaowang.fingertipdesigner.core.modules.order.dto.*; -import com.xiaowang.fingertipdesigner.core.modules.payment.dto.*; -import com.xiaowang.fingertipdesigner.core.modules.planning.dto.*; -import com.xiaowang.fingertipdesigner.core.modules.product.dto.*; -import com.xiaowang.fingertipdesigner.core.modules.security.dto.*; -import com.xiaowang.fingertipdesigner.core.modules.shop.dto.*; -import com.xiaowang.fingertipdesigner.core.modules.system.dto.*; -import com.xiaowang.fingertipdesigner.core.modules.user.dto.*; import com.xiaowang.jacyucloudsalon.core.modules.artist.dto.NailArtistInfoDTO; import com.xiaowang.jacyucloudsalon.core.modules.user.entity.UserDO; import com.xiaowang.jacyucloudsalon.core.modules.security.entity.UserPermissionDO; diff --git a/JC-Salon-Gateway/src/main/java/com/xiaowang/jayucloudsalon/gateway/JayuCloudSalonGatewayApplication.java b/JC-Salon-Gateway/src/main/java/com/xiaowang/jayucloudsalon/gateway/JayuCloudSalonGatewayApplication.java index 6506973c..2a00b6c7 100644 --- a/JC-Salon-Gateway/src/main/java/com/xiaowang/jayucloudsalon/gateway/JayuCloudSalonGatewayApplication.java +++ b/JC-Salon-Gateway/src/main/java/com/xiaowang/jayucloudsalon/gateway/JayuCloudSalonGatewayApplication.java @@ -18,4 +18,4 @@ public class JayuCloudSalonGatewayApplication { SpringApplication.run(JayuCloudSalonGatewayApplication.class, args); } -} +} \ No newline at end of file diff --git a/JC-Salon-WeChat/project.config.json b/JC-Salon-WeChat/project.config.json index cbfc8f11..033251b7 100644 --- a/JC-Salon-WeChat/project.config.json +++ b/JC-Salon-WeChat/project.config.json @@ -39,4 +39,4 @@ "simulatorPluginLibVersion": {}, "editorSetting": {}, "testRoot": "minitest/" -} +} \ No newline at end of file diff --git a/docs/scripts/sql/init/jayucloud-salon.sql b/docs/scripts/sql/init/jayucloud-salon.sql index 3a8e946e..64418c29 100644 --- a/docs/scripts/sql/init/jayucloud-salon.sql +++ b/docs/scripts/sql/init/jayucloud-salon.sql @@ -107,7 +107,7 @@ create index idx_shop_id create index idx_user_id on t_comment (user_id) - comment '按用户查询评论的索引';s + comment '按用户查询评论的索引'; -- auto-generated definition create table t_coupon diff --git a/nacos/namespaces/dev/jayucloud-salon/DEFAULT_GROUP/secret.yaml b/nacos/namespaces/dev/jayucloud-salon/DEFAULT_GROUP/secret.yaml index 1328cdda..bee001f2 100644 --- a/nacos/namespaces/dev/jayucloud-salon/DEFAULT_GROUP/secret.yaml +++ b/nacos/namespaces/dev/jayucloud-salon/DEFAULT_GROUP/secret.yaml @@ -6,10 +6,10 @@ security: username: ${BUSINESS_DB_USERNAME:root} password: ${BUSINESS_DB_PASSWORD:122503wcy} redis: - password: ${REDIS_PASSWORD:122503wcy....} + password: ${REDIS_PASSWORD:122503wcy} rabbitmq: username: ${RABBITMQ_USERNAME:rabbitmq} - password: ${RABBITMQ_PASSWORD:122503wcy....} + password: ${RABBITMQ_PASSWORD:122503wcy} spring: datasource: -- 2.54.0 From 346dde8197a3d7391509ee7386461b8d1ee99050 Mon Sep 17 00:00:00 2001 From: xiaowang <2161656029@qq.com> Date: Wed, 26 Aug 2026 20:21:49 +0800 Subject: [PATCH 06/19] =?UTF-8?q?=E9=85=8D=E7=BD=AE=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- nacos/namespaces/dev/jayucloud-salon/DEFAULT_GROUP/secret.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nacos/namespaces/dev/jayucloud-salon/DEFAULT_GROUP/secret.yaml b/nacos/namespaces/dev/jayucloud-salon/DEFAULT_GROUP/secret.yaml index bee001f2..fbf2c988 100644 --- a/nacos/namespaces/dev/jayucloud-salon/DEFAULT_GROUP/secret.yaml +++ b/nacos/namespaces/dev/jayucloud-salon/DEFAULT_GROUP/secret.yaml @@ -9,7 +9,7 @@ security: password: ${REDIS_PASSWORD:122503wcy} rabbitmq: username: ${RABBITMQ_USERNAME:rabbitmq} - password: ${RABBITMQ_PASSWORD:122503wcy} + password: ${RABBITMQ_PASSWORD:122503wcy....} spring: datasource: -- 2.54.0 From 8270784e3952e6f9ce56cc99e2f1b0aa9b4daf09 Mon Sep 17 00:00:00 2001 From: xiaowang <2161656029@qq.com> Date: Wed, 26 Aug 2026 20:30:23 +0800 Subject: [PATCH 07/19] =?UTF-8?q?=E4=BF=AE=E5=A4=8DDev=20Salon=20Redis?= =?UTF-8?q?=E6=97=A0=E7=94=A8=E6=88=B7=E5=90=8D=E8=AE=A4=E8=AF=81=E9=85=8D?= =?UTF-8?q?=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- nacos/namespaces/dev/jayucloud-salon/DEFAULT_GROUP/infra.yaml | 1 - 1 file changed, 1 deletion(-) diff --git a/nacos/namespaces/dev/jayucloud-salon/DEFAULT_GROUP/infra.yaml b/nacos/namespaces/dev/jayucloud-salon/DEFAULT_GROUP/infra.yaml index 068d635b..8483d745 100644 --- a/nacos/namespaces/dev/jayucloud-salon/DEFAULT_GROUP/infra.yaml +++ b/nacos/namespaces/dev/jayucloud-salon/DEFAULT_GROUP/infra.yaml @@ -2,7 +2,6 @@ spring: redis: host: ${REDIS_HOST:192.168.5.15} port: ${REDIS_PORT:6379} - username: ${REDIS_USERNAME:xiaowang} password: ${REDIS_PASSWORD:122503wcy....} database: ${REDIS_DATABASE:0} rabbitmq: -- 2.54.0 From bfe4d4c3441ae85dfa491b8cbc02b55055d89e5f Mon Sep 17 00:00:00 2001 From: xiaowang <2161656029@qq.com> Date: Wed, 26 Aug 2026 20:50:07 +0800 Subject: [PATCH 08/19] =?UTF-8?q?redis=E5=AF=86=E7=A0=81=E6=9B=B4=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- nacos/namespaces/dev/jayucloud-salon/DEFAULT_GROUP/infra.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nacos/namespaces/dev/jayucloud-salon/DEFAULT_GROUP/infra.yaml b/nacos/namespaces/dev/jayucloud-salon/DEFAULT_GROUP/infra.yaml index 8483d745..223da5f8 100644 --- a/nacos/namespaces/dev/jayucloud-salon/DEFAULT_GROUP/infra.yaml +++ b/nacos/namespaces/dev/jayucloud-salon/DEFAULT_GROUP/infra.yaml @@ -2,7 +2,7 @@ spring: redis: host: ${REDIS_HOST:192.168.5.15} port: ${REDIS_PORT:6379} - password: ${REDIS_PASSWORD:122503wcy....} + password: ${REDIS_PASSWORD:122503wcy} database: ${REDIS_DATABASE:0} rabbitmq: addresses: ${RABBITMQ_ADDRESSES:192.168.5.15:5672} -- 2.54.0 From a10769de45502d1743209f9966366f68ab13f0ca Mon Sep 17 00:00:00 2001 From: xiaowang <2161656029@qq.com> Date: Wed, 26 Aug 2026 21:57:15 +0800 Subject: [PATCH 09/19] =?UTF-8?q?=E9=87=8D=E6=9E=84Salon=E7=AE=A1=E7=90=86?= =?UTF-8?q?=E5=91=98=E5=90=8E=E5=8F=B0=E5=85=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/config/admin-navigation.test.ts | 3 ++- .../src/config/admin-navigation.ts | 17 +---------------- JC-Salon-Frontend/src/router/index.ts | 17 ++++++----------- 3 files changed, 9 insertions(+), 28 deletions(-) diff --git a/JC-Salon-Frontend/src/config/admin-navigation.test.ts b/JC-Salon-Frontend/src/config/admin-navigation.test.ts index 15d62791..dcfb3804 100644 --- a/JC-Salon-Frontend/src/config/admin-navigation.test.ts +++ b/JC-Salon-Frontend/src/config/admin-navigation.test.ts @@ -4,7 +4,8 @@ import { adminNavigationItems, adminPermissionRouteMap, findAdminNavigationItemB describe('admin-navigation', () => { it('keeps dashboard landing and permission routes aligned', () => { expect(ADMIN_DASHBOARD_PATH).toBe('/admin/dashboard') - expect(findAdminNavigationItemByPath('/admin/products')?.label).toBe('作品管理') + expect(findAdminNavigationItemByPath('/admin/shops')?.label).toBe('店铺管理') + expect(findAdminNavigationItemByPath('/admin/products')).toBeUndefined() expect(adminPermissionRouteMap.some(item => item.code === 'shop:view' && item.path === '/admin/shops')).toBe(true) expect(adminNavigationItems[0]?.path).toBe('/admin') }) diff --git a/JC-Salon-Frontend/src/config/admin-navigation.ts b/JC-Salon-Frontend/src/config/admin-navigation.ts index e29e39d2..d2fe3531 100644 --- a/JC-Salon-Frontend/src/config/admin-navigation.ts +++ b/JC-Salon-Frontend/src/config/admin-navigation.ts @@ -26,23 +26,8 @@ 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/products', iconKey: 'shop', label: '作品管理', permissionCode: 'product:view' }, - { path: '/admin/coupons', iconKey: 'gift', label: '优惠券管理', permissionCode: 'coupon:view' }, - { path: '/admin/comments', iconKey: 'message', label: '评论管理', permissionCode: 'comment:view' }, { path: '/admin/shops', iconKey: 'home', label: '店铺管理', permissionCode: 'shop:view' }, - { path: '/admin/permissions', iconKey: 'security', label: '权限管理', permissionCode: 'permission:view' }, - { path: '/admin/tags', iconKey: 'tag', label: '标签管理', permissionCode: 'tag:view' }, - { path: '/admin/orders', iconKey: 'shopping', label: '订单管理', permissionCode: 'order:view' }, - { path: '/admin/schedules', iconKey: 'calendar', label: '排班管理', permissionCode: 'schedule:view' }, - { path: '/admin/after-sales', iconKey: 'message', label: '售后处理', permissionCode: 'after_sale:view' }, - { path: '/admin/inventory', iconKey: 'tool', label: '库存管理', permissionCode: 'inventory:view' }, - { path: '/admin/campaigns', iconKey: 'gift', label: '活动管理', permissionCode: 'campaign:view' }, - { path: '/admin/nail-artists', iconKey: 'team', label: '美甲师管理', permissionCode: 'nail_artist:view' }, - { path: '/admin/messages', iconKey: 'message', label: '消息发布', permissionCode: 'message:view' }, - { path: '/admin/announcements', iconKey: 'message', label: '公告管理', permissionCode: 'announcement:view' }, - { path: '/admin/vip-recharge-plans', iconKey: 'gift', label: 'VIP充值配置', permissionCode: 'user:vip:manage' }, - { path: '/admin/messagehub-push-configs', iconKey: 'message', label: '参数管理', permissionCode: 'messagehub:config:manage' }, - { path: '/admin/legal-agreements', iconKey: 'security', label: '协议管理', permissionCode: 'legal_agreement:manage' } + { path: '/admin/profile', iconKey: 'user', label: '个人设置', permissionCode: '' } ] export const adminPermissionRouteMap = adminNavigationItems diff --git a/JC-Salon-Frontend/src/router/index.ts b/JC-Salon-Frontend/src/router/index.ts index 54c548d4..a8822bf5 100644 --- a/JC-Salon-Frontend/src/router/index.ts +++ b/JC-Salon-Frontend/src/router/index.ts @@ -9,17 +9,8 @@ import { const pageNames = [ ['', 'HomeView', 'admin', undefined], ['dashboard', 'DashboardView', 'admin-dashboard', 'dashboard:view'], - ['users', 'UsersView', 'admin-users', 'user:view'], ['products', 'ProductsView', 'admin-products', 'product:view'], - ['coupons', 'CouponsView', 'admin-coupons', 'coupon:view'], ['comments', 'CommentsView', 'admin-comments', 'comment:view'], - ['shops', 'ShopsView', 'admin-shops', 'shop:view'], ['permissions', 'PermissionsView', 'admin-permissions', 'permission:view'], - ['orders', 'OrdersView', 'admin-orders', 'order:view'], ['schedules', 'SchedulesView', 'admin-schedules', 'schedule:view'], - ['after-sales', 'AfterSalesView', 'admin-after-sales', 'after_sale:view'], ['inventory', 'InventoryView', 'admin-inventory', 'inventory:view'], - ['campaigns', 'CampaignsView', 'admin-campaigns', 'campaign:view'], ['manage', 'ManageView', 'admin-manage', undefined], - ['profile', 'ProfileView', 'admin-profile', undefined], ['tags', 'TagsView', 'admin-tags', 'tag:view'], - ['nail-artists', 'NailArtistsView', 'admin-nail-artists', 'nail_artist:view'], ['messages', 'SystemMessagesView', 'admin-messages', 'message:view'], - ['announcements', 'AnnouncementsView', 'admin-announcements', 'announcement:view'], ['vip-recharge-plans', 'VipRechargePlansView', 'admin-vip-recharge-plans', 'user:vip:manage'], - ['messagehub-push-configs', 'MessageHubPushConfigsView', 'admin-messagehub-push-configs', 'messagehub:config:manage'], - ['legal-agreements', 'LegalAgreementsView', 'admin-legal-agreements', 'legal_agreement:manage'] + ['users', 'UsersView', 'admin-users', 'user:view'], ['shops', 'ShopsView', 'admin-shops', 'shop:view'], + ['profile', 'ProfileView', 'admin-profile', undefined] ] as const const routes = [ @@ -42,6 +33,10 @@ router.beforeEach(async to => { if (!snapshot.token || !snapshot.userInfo) return true return (await ensureAdminAuthBootstrap()) === 'ready' ? resolveAdminLandingPath() : true } + if (!snapshot.isPlatformAdmin) { + clearAdminBootstrapSession() + return '/admin/login' + } if (!snapshot.token || !snapshot.userInfo) { clearAdminBootstrapSession() return '/admin/login' -- 2.54.0 From fe4baad70c5dfd40c0e5dc6ce46ff0ad4df0e2d0 Mon Sep 17 00:00:00 2001 From: xiaowang <2161656029@qq.com> Date: Wed, 26 Aug 2026 22:04:41 +0800 Subject: [PATCH 10/19] =?UTF-8?q?=E6=94=B6=E6=95=9BSalon=E5=90=8E=E5=8F=B0?= =?UTF-8?q?=E9=A6=96=E9=A1=B5=E7=AE=A1=E7=90=86=E5=85=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/views/admin/HomeView.vue | 91 +------------------ 1 file changed, 2 insertions(+), 89 deletions(-) diff --git a/JC-Salon-Frontend/src/views/admin/HomeView.vue b/JC-Salon-Frontend/src/views/admin/HomeView.vue index e045f490..8f39c049 100644 --- a/JC-Salon-Frontend/src/views/admin/HomeView.vue +++ b/JC-Salon-Frontend/src/views/admin/HomeView.vue @@ -9,7 +9,7 @@ type="info" show-icon message="当前处于平台总览模式" - description="可以查看总览、店铺列表和权限入口;用户、作品、订单、优惠券等店铺业务默认仅可查看,编辑操作已关闭。" + description="当前后台仅面向平台管理员,负责维护店铺、用户账号、角色归属和平台运行状态。" /> -
- 暂无权限信息 -
+
暂无权限信息
@@ -157,16 +155,8 @@ import { computed, onBeforeUnmount, onMounted, ref } from 'vue' import { useRouter } from 'vue-router' import { DashboardOutlined, - FileProtectOutlined, - GiftOutlined, HomeOutlined, - MessageOutlined, SafetyCertificateOutlined, - SettingOutlined, - ShopOutlined, - ShoppingOutlined, - TagOutlined, - TeamOutlined, UserOutlined } from '@ant-design/icons-vue' /** @@ -255,89 +245,12 @@ const quickActions = computed(() => { icon: UserOutlined, permissionCode: 'user:view' }, - { - key: 'products', - title: '作品管理', - path: '/admin/products', - icon: ShopOutlined, - permissionCode: 'product:view' - }, - { - key: 'coupons', - title: '优惠券', - path: '/admin/coupons', - icon: GiftOutlined, - permissionCode: 'coupon:view' - }, - { - key: 'orders', - title: '订单管理', - path: '/admin/orders', - icon: ShoppingOutlined, - permissionCode: 'order:view' - }, - { - key: 'tags', - title: '标签管理', - path: '/admin/tags', - icon: TagOutlined, - permissionCode: 'tag:view' - }, - { - key: 'artists', - title: '美甲师管理', - path: '/admin/nail-artists', - icon: TeamOutlined, - permissionCode: 'nail_artist:view' - }, { key: 'shops', title: '店铺管理', path: '/admin/shops', icon: HomeOutlined, permissionCode: 'shop:view' - }, - { - key: 'permissions', - title: '权限管理', - path: '/admin/permissions', - icon: SafetyCertificateOutlined, - permissionCode: 'permission:view' - }, - { - key: 'messages', - title: '消息发布', - path: '/admin/messages', - icon: MessageOutlined, - permissionCode: 'message:view' - }, - { - key: 'announcements', - title: '公告管理', - path: '/admin/announcements', - icon: MessageOutlined, - permissionCode: 'announcement:view' - }, - { - key: 'vip-plans', - title: 'VIP充值配置', - path: '/admin/vip-recharge-plans', - icon: GiftOutlined, - permissionCode: 'user:vip:manage' - }, - { - key: 'parameters', - title: '参数管理', - path: '/admin/messagehub-push-configs', - icon: SettingOutlined, - permissionCode: 'messagehub:config:manage' - }, - { - key: 'agreements', - title: '协议管理', - path: '/admin/legal-agreements', - icon: FileProtectOutlined, - permissionCode: 'legal_agreement:manage' } ] -- 2.54.0 From 025af6ba9b14de1622d235dcd41d8e1f5adc7186 Mon Sep 17 00:00:00 2001 From: xiaowang <2161656029@qq.com> Date: Wed, 26 Aug 2026 22:26:06 +0800 Subject: [PATCH 11/19] =?UTF-8?q?=E7=BB=9F=E4=B8=80Salon=E7=AE=A1=E7=90=86?= =?UTF-8?q?=E5=90=8E=E5=8F=B0=E5=93=81=E7=89=8C=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- JC-Salon-Frontend/src/config/brand.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/JC-Salon-Frontend/src/config/brand.ts b/JC-Salon-Frontend/src/config/brand.ts index f595b4ad..ddf9909a 100644 --- a/JC-Salon-Frontend/src/config/brand.ts +++ b/JC-Salon-Frontend/src/config/brand.ts @@ -4,9 +4,9 @@ function normalizeBrandValue(value: string | undefined, fallbackValue: string): } export const BRAND_CONFIG = { - appName: normalizeBrandValue(import.meta.env.VITE_APP_NAME, '甲屿设计师'), - appNameEn: normalizeBrandValue(import.meta.env.VITE_APP_NAME_EN, 'Jiayu Designer'), - appTitle: normalizeBrandValue(import.meta.env.VITE_APP_TITLE, '甲屿设计师'), - adminAppName: normalizeBrandValue(import.meta.env.VITE_ADMIN_APP_NAME, '甲屿设计师管理台'), - appShortName: normalizeBrandValue(import.meta.env.VITE_APP_SHORT_NAME, 'YN') + appName: normalizeBrandValue(import.meta.env.VITE_APP_NAME, '甲屿店务'), + appNameEn: normalizeBrandValue(import.meta.env.VITE_APP_NAME_EN, 'Jiayu Salon'), + appTitle: normalizeBrandValue(import.meta.env.VITE_APP_TITLE, '甲屿店务'), + adminAppName: normalizeBrandValue(import.meta.env.VITE_ADMIN_APP_NAME, '甲屿店务管理台'), + appShortName: normalizeBrandValue(import.meta.env.VITE_APP_SHORT_NAME, 'JS') } -- 2.54.0 From a0f659c5c458e8b5bd2f6c757a395d91fb171326 Mon Sep 17 00:00:00 2001 From: xiaowang <2161656029@qq.com> Date: Wed, 26 Aug 2026 23:18:16 +0800 Subject: [PATCH 12/19] =?UTF-8?q?=E4=BF=AE=E6=AD=A3Salon=E7=AE=A1=E7=90=86?= =?UTF-8?q?=E5=90=8E=E5=8F=B0=E5=93=81=E7=89=8C=E7=8E=AF=E5=A2=83=E9=85=8D?= =?UTF-8?q?=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- JC-Salon-Frontend/.env.development | 10 +++++----- JC-Salon-Frontend/.env.production | 10 +++++----- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/JC-Salon-Frontend/.env.development b/JC-Salon-Frontend/.env.development index 0d2962f0..b61bddd4 100644 --- a/JC-Salon-Frontend/.env.development +++ b/JC-Salon-Frontend/.env.development @@ -1,8 +1,8 @@ VITE_API_BASE_URL=/api VITE_ADMIN_API_BASE_URL=/admin/api VITE_DEV_PROXY_TARGET=http://127.0.0.1:80 -VITE_APP_NAME=指尖设计师 -VITE_APP_NAME_EN=Fingertip Designer -VITE_APP_TITLE=Fingertip Designer 指尖设计师 -VITE_ADMIN_APP_NAME=指尖设计师管理台 -VITE_APP_SHORT_NAME=YN +VITE_APP_NAME=甲屿店务 +VITE_APP_NAME_EN=Jiayu Salon +VITE_APP_TITLE=Jiayu Salon 甲屿店务 +VITE_ADMIN_APP_NAME=甲屿店务管理台 +VITE_APP_SHORT_NAME=JS diff --git a/JC-Salon-Frontend/.env.production b/JC-Salon-Frontend/.env.production index ddefe686..02f83777 100644 --- a/JC-Salon-Frontend/.env.production +++ b/JC-Salon-Frontend/.env.production @@ -1,7 +1,7 @@ VITE_API_BASE_URL=https://yunail.art/api VITE_ADMIN_API_BASE_URL=https://yunail.art/admin/api -VITE_APP_NAME=指尖设计师 -VITE_APP_NAME_EN=Fingertip Designer -VITE_APP_TITLE=Fingertip Designer 指尖设计师 -VITE_ADMIN_APP_NAME=指尖设计师管理台 -VITE_APP_SHORT_NAME=YN +VITE_APP_NAME=甲屿店务 +VITE_APP_NAME_EN=Jiayu Salon +VITE_APP_TITLE=Jiayu Salon 甲屿店务 +VITE_ADMIN_APP_NAME=甲屿店务管理台 +VITE_APP_SHORT_NAME=JS -- 2.54.0 From c08a65e14f476bb006736eee531517c726b8fd24 Mon Sep 17 00:00:00 2001 From: xiaowang <2161656029@qq.com> Date: Thu, 27 Aug 2026 11:19:43 +0800 Subject: [PATCH 13/19] =?UTF-8?q?=E4=BF=AE=E5=A4=8DSalonAdmin=E6=A0=87?= =?UTF-8?q?=E8=AF=86=E4=B8=8E=E7=99=BB=E5=BD=95=E4=BB=A4=E7=89=8C=E6=A0=A1?= =?UTF-8?q?=E9=AA=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- JC-Salon-Frontend/index.html | 4 ++-- JC-Salon-Frontend/public/salon-admin-icon.svg | 4 ++++ JC-Salon-Gateway/src/main/resources/application.yaml | 2 +- scripts/SalonAdmin登录令牌修复_20260827.md | 11 +++++++++++ 4 files changed, 18 insertions(+), 3 deletions(-) create mode 100644 JC-Salon-Frontend/public/salon-admin-icon.svg create mode 100644 scripts/SalonAdmin登录令牌修复_20260827.md diff --git a/JC-Salon-Frontend/index.html b/JC-Salon-Frontend/index.html index c3913ed9..2bf7a0a7 100644 --- a/JC-Salon-Frontend/index.html +++ b/JC-Salon-Frontend/index.html @@ -2,9 +2,9 @@ - + - %VITE_APP_TITLE% + SalonAdmin
diff --git a/JC-Salon-Frontend/public/salon-admin-icon.svg b/JC-Salon-Frontend/public/salon-admin-icon.svg new file mode 100644 index 00000000..3a8342de --- /dev/null +++ b/JC-Salon-Frontend/public/salon-admin-icon.svg @@ -0,0 +1,4 @@ + + + + diff --git a/JC-Salon-Gateway/src/main/resources/application.yaml b/JC-Salon-Gateway/src/main/resources/application.yaml index 9c91bc17..b2fab928 100644 --- a/JC-Salon-Gateway/src/main/resources/application.yaml +++ b/JC-Salon-Gateway/src/main/resources/application.yaml @@ -126,7 +126,7 @@ spring: fingertip-designer: security: jwt: - issuer: fingertip-designer + issuer: jayucloud-salon clock-skew-seconds: 30 gateway: whitelist: diff --git a/scripts/SalonAdmin登录令牌修复_20260827.md b/scripts/SalonAdmin登录令牌修复_20260827.md new file mode 100644 index 00000000..3eecd092 --- /dev/null +++ b/scripts/SalonAdmin登录令牌修复_20260827.md @@ -0,0 +1,11 @@ +# SalonAdmin 登录令牌修复 + +## 变更 + +- 管理台页签标题固定为 `SalonAdmin`,favicon 使用 SalonAdmin 专用图标。 +- Salon Gateway 的 JWT `issuer` 与 Salon Core 统一为 `jayucloud-salon`。 +- Salon 开发环境 Nacos 的 `gateway.yaml` 需要同步使用 `jayucloud-salon`,避免 Nacos 配置覆盖本地配置。 + +## 验证 + +登录接口签发令牌后,使用该令牌访问 `/admin/permission/user/current` 应返回 HTTP 200,不应因发行者不一致返回 401。 -- 2.54.0 From 216efa6b3c370a6f0e57743a533e1824171c3e4b Mon Sep 17 00:00:00 2001 From: xiaowang <2161656029@qq.com> Date: Thu, 27 Aug 2026 11:31:27 +0800 Subject: [PATCH 14/19] =?UTF-8?q?=E4=BF=AE=E6=AD=A3Salon=E5=88=9D=E5=A7=8B?= =?UTF-8?q?=E5=8C=96SQL=E8=AF=AF=E5=88=A0=E4=B8=9A=E5=8A=A1=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/scripts/sql/init/jayucloud-salon.sql | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/docs/scripts/sql/init/jayucloud-salon.sql b/docs/scripts/sql/init/jayucloud-salon.sql index 64418c29..c6178509 100644 --- a/docs/scripts/sql/init/jayucloud-salon.sql +++ b/docs/scripts/sql/init/jayucloud-salon.sql @@ -1782,7 +1782,7 @@ CREATE TABLE IF NOT EXISTS `t_messagehub_push_config` ( PRIMARY KEY (`id`), UNIQUE KEY `uk_messagehub_push_config_scene` (`scene_code`), KEY `idx_messagehub_push_config_enabled` (`enabled`, `is_delete`) -) COMMENT='Fingertip Designer按业务场景投递MessageHub的配置'; +) COMMENT='甲屿店务按业务场景投递MessageHub的配置'; DROP PROCEDURE IF EXISTS sp_add_column_if_not_exists; DROP PROCEDURE IF EXISTS sp_add_index_if_not_exists; @@ -2223,8 +2223,8 @@ DEALLOCATE PREPARE stmt_system_parameter_enabled; INSERT INTO t_legal_agreement (id, agreement_type, title, version, content, status, effective_time, create_time, update_time, is_delete) VALUES - (313931273555138001, 'USER_TERMS', '用户协议', '2026.05.18', '欢迎使用 Fingertip Designer 指尖设计师。请在使用账号、预约、订单、会员、消息等功能前仔细阅读本协议。继续登录或注册即表示你已理解并同意平台基础服务规则、账号安全要求、订单预约规则和依法合规使用要求。', 1, NOW(), NOW(), NOW(), 0), - (313931273555138002, 'PRIVACY_POLICY', '隐私政策', '2026.05.18', 'Fingertip Designer 指尖设计师会在提供登录注册、预约下单、会员余额、消息通知和客户服务时处理必要的手机号、昵称、门店归属、订单与设备信息。我们仅在业务需要和法律允许范围内使用这些信息,并采取访问控制、脱敏展示和审计记录等措施保护数据安全。', 1, NOW(), NOW(), NOW(), 0) + (313931273555138001, 'USER_TERMS', '用户协议', '2026.05.18', '欢迎使用 Jiayu Salon 甲屿店务。请在使用账号、预约、订单、会员、消息等功能前仔细阅读本协议。继续登录或注册即表示你已理解并同意平台基础服务规则、账号安全要求、订单预约规则和依法合规使用要求。', 1, NOW(), NOW(), NOW(), 0), + (313931273555138002, 'PRIVACY_POLICY', '隐私政策', '2026.05.18', 'Jiayu Salon 甲屿店务会在提供登录注册、预约下单、会员余额、消息通知和客户服务时处理必要的手机号、昵称、门店归属、订单与设备信息。我们仅在业务需要和法律允许范围内使用这些信息,并采取访问控制、脱敏展示和审计记录等措施保护数据安全。', 1, NOW(), NOW(), NOW(), 0) ON DUPLICATE KEY UPDATE title = VALUES(title), content = VALUES(content), @@ -2321,5 +2321,4 @@ CREATE TABLE IF NOT EXISTS t_artist_schedule_exception ( id bigint unsigned NOT NULL COMMENT '排班例外ID', shop_id bigint unsigned NOT NULL COMMENT '店铺ID', artist_id bigint unsigned NOT NULL COMMENT '美甲师用户ID', work_date date NOT NULL COMMENT '例外日期', exception_type varchar(32) NOT NULL COMMENT '例外类型:REST/EXTRA_WORK/CHANGE_SHIFT', start_time time NULL COMMENT '例外开始时间', end_time time NULL COMMENT '例外结束时间', slot_minutes int NOT NULL DEFAULT 60 COMMENT '预约间隔分钟', capacity int NOT NULL DEFAULT 1 COMMENT '同一时间段容量', remark varchar(255) NULL COMMENT '备注', create_time datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', update_time datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', is_delete tinyint NOT NULL DEFAULT 0 COMMENT '逻辑删除', PRIMARY KEY (id), UNIQUE KEY uk_artist_schedule_exception_date (shop_id, artist_id, work_date, is_delete), KEY idx_artist_schedule_exception_artist_date (artist_id, work_date, is_delete) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='美甲师排班例外表'; SET FOREIGN_KEY_CHECKS = 0; -DROP TABLE IF EXISTS t_wishlist; DROP TABLE IF EXISTS t_wishlist_group; DROP TABLE IF EXISTS t_product_like; DROP TABLE IF EXISTS t_cart; DROP TABLE IF EXISTS t_vip_info; DROP TABLE IF EXISTS t_vip_benefit; DROP TABLE IF EXISTS t_user_growth_record; DROP TABLE IF EXISTS t_user_coupon; DROP TABLE IF EXISTS t_coupon_tag; DROP TABLE IF EXISTS t_coupon; SET FOREIGN_KEY_CHECKS = 1; -- 2.54.0 From e9748119eff85d92edf26eb6ba0d830495c8bae5 Mon Sep 17 00:00:00 2001 From: xiaowang <2161656029@qq.com> Date: Thu, 27 Aug 2026 12:13:21 +0800 Subject: [PATCH 15/19] =?UTF-8?q?=E8=AE=B0=E5=BD=95Salon=E7=94=9F=E4=BA=A7?= =?UTF-8?q?=E5=9F=BA=E7=A1=80=E7=8E=AF=E5=A2=83=E5=87=86=E5=A4=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/项目变更记录.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/docs/项目变更记录.md b/docs/项目变更记录.md index 26b7a141..db0107f5 100644 --- a/docs/项目变更记录.md +++ b/docs/项目变更记录.md @@ -1,5 +1,12 @@ # 项目变更记录 +## 2026-08-27 Salon 生产后端基础环境准备 + +- 已连接并盘点 Salon 生产 6 台后端服务器:Core `192.168.10.24`、`192.168.10.25`、`192.168.20.16`;Gateway `192.168.10.26`、`192.168.10.27`、`192.168.20.18`。 +- 6 台均为 Rocky Linux 9.8,已安装 `java-17-openjdk-headless`(Java `17.0.20.1`)。 +- 已创建 Core `/opt/jc-salon-core/{releases,backups,logs}` 与 Gateway `/opt/jc-salon-gateway/{releases,backups,logs}`,目录权限为 `755 root:root`。 +- 未创建或启动 systemd 业务单元,未开放或监听 80/81 业务端口;后续部署时再上传 JAR、写入服务单元并执行健康检查。 + ## 2026-08-25 生产对象存储与中间件配置调整 - 两个生产 namespace 的 `core.yaml`、`infra.yaml` 补齐中心1 MinIO、七牛云 Kodo 与阿里云 OSS 的非敏感默认参数。 -- 2.54.0 From 0df0a86d9a13a8539b4bc46f3db4f11d9a24a16d Mon Sep 17 00:00:00 2001 From: xiaowang <2161656029@qq.com> Date: Thu, 27 Aug 2026 12:24:22 +0800 Subject: [PATCH 16/19] =?UTF-8?q?=E6=96=B0=E5=A2=9ESalon=E7=94=9F=E4=BA=A7?= =?UTF-8?q?=E5=8F=91=E5=B8=83=E6=B5=81=E6=B0=B4=E7=BA=BF=E8=AE=BE=E8=AE=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...27-salon-prod-gitea-auto-prepare-design.md | 55 +++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 docs/superpowers/specs/2026-08-27-salon-prod-gitea-auto-prepare-design.md diff --git a/docs/superpowers/specs/2026-08-27-salon-prod-gitea-auto-prepare-design.md b/docs/superpowers/specs/2026-08-27-salon-prod-gitea-auto-prepare-design.md new file mode 100644 index 00000000..8095e564 --- /dev/null +++ b/docs/superpowers/specs/2026-08-27-salon-prod-gitea-auto-prepare-design.md @@ -0,0 +1,55 @@ +# Salon 生产分支自动准备与人工发布设计 + +## 目标 + +实现 `sit` 合并到 `prod` 后自动准备 Salon 全量发布包,并保留最终生产发布的人工作业确认。发布范围包括 Core、Gateway、Nacos 配置和阿里云 NGINX 上的 Salon 前端;数据库 SQL 只归档和提示,不由流水线执行。 + +## 分支与触发 + +- Gitea `prod` 分支启用保护,禁止直接 push,仅允许 Pull Request 合并。 +- Pull Request 的源分支必须是 `sit`;工作流在事件上下文和提交历史上再次校验源分支,校验失败立即停止。 +- `prod-prepare.yml` 监听 `push` 到 `prod`,自动准备发布包。 +- `prod-deploy.yml` 只允许 `workflow_dispatch`,人工输入要发布的提交号或选择对应 Artifact。 + +## 自动准备工作流 + +准备工作流运行在具备 Node.js、JDK、Maven 和 PowerShell 的 Gitea Runner 上,步骤为: + +1. 检出合并后的 `prod` 提交并校验来源为 `sit`。 +2. 构建 `JC-Salon-Core`、`JC-Salon-Gateway` 和 `JC-Salon-Frontend`。 +3. 扫描并校验 `jayucloud-salon` 生产 Nacos 配置,不打印敏感值。 +4. 生成 Core/Gateway JAR、前端静态资源归档、manifest 和校验摘要。 +5. 生成 SQL 归档供人工执行,但不连接生产数据库。 +6. 将发布包上传为带提交号的 Actions Artifact,并输出人工发布工作流入口。 + +准备阶段不连接生产 SSH、不修改 Nacos、不写入 NGINX、不重启服务。 + +## 人工发布工作流 + +人工工作流下载指定提交的 Artifact,并按固定顺序执行: + +1. 发布并回读校验 `jayucloud-salon` 生产 Nacos 配置。 +2. Core 三节点逐台备份当前 JAR、上传新 JAR、重启 `jc-salon-core` 并检查 `/health/check`。 +3. Gateway 三节点逐台备份当前 JAR、上传新 JAR、重启 `jc-salon-gateway` 并检查 `/health/check`。 +4. 上传前端归档到阿里云 NGINX 目标机,切换发布目录,运行 `nginx -t` 后 reload。 +5. 检查 Salon 公网健康接口和业务接口。 + +每个阶段失败立即停止后续节点;远端保留按提交号命名的 release、backup 和日志目录。回滚通过重新选择上一成功 Artifact 执行同一人工发布工作流。 + +## 凭据与网络 + +- Gitea Secrets 只保存 Nacos 账号、SSH 私钥、SSH known_hosts、阿里云 NGINX 连接信息和必要的发布参数。 +- 不在工作流、仓库文件、Artifact 或日志中保存 root 密码、Nacos 密码、AccessKey 或私钥明文。 +- Runner 必须能访问生产 Nacos、6 台后端服务器和阿里云 NGINX 主机;网络检查作为发布前置步骤。 +- 后端 systemd 服务单元 `jc-salon-core`、`jc-salon-gateway` 需在首次发布前完成一次性初始化。 +- 阿里云 NGINX 的实际 IP、SSH 端口和部署目录必须以资产清单确认,不能沿用脚本默认地址。 + +## 数据库边界 + +生产 SQL 仅作为 Artifact 附件和人工执行提示,不在任何自动或人工应用发布步骤中调用 MySQL。数据库变更必须使用独立版本化 SQL,并记录目标库、执行人、时间和校验结果。 + +## 验证 + +- 对准备工作流验证:分支来源校验、三端构建、Artifact 文件清单、SHA-256 和敏感信息不回显。 +- 对发布工作流验证:先在非生产或 DryRun 模式检查 SSH、Nacos、systemd、NGINX 目标;再逐节点验证服务状态、JAR SHA-256、健康接口和公网接口。 +- 发布前运行 GitNexus `detect_changes`,确认工作流、脚本和文档变更范围符合预期。 -- 2.54.0 From 5211c2d6cd6b62c67cd8d8a5fb1f2fddce34f0e3 Mon Sep 17 00:00:00 2001 From: xiaowang <2161656029@qq.com> Date: Thu, 27 Aug 2026 12:39:20 +0800 Subject: [PATCH 17/19] =?UTF-8?q?=E5=AE=9E=E7=8E=B0Salon=E7=94=9F=E4=BA=A7?= =?UTF-8?q?=E6=B5=81=E6=B0=B4=E7=BA=BF=E8=87=AA=E5=8A=A8=E5=87=86=E5=A4=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitea/workflows/salon-prod-deploy.yml | 95 ++++++++++++++ .gitea/workflows/salon-prod-prepare.yml | 47 +++++++ .../deploy-jayucloud-salon-production.ps1 | 120 +++++++++++++++++- .../生产Salon Gitea流水线配置说明_20260827.md | 36 ++++++ 4 files changed, 292 insertions(+), 6 deletions(-) create mode 100644 .gitea/workflows/salon-prod-deploy.yml create mode 100644 .gitea/workflows/salon-prod-prepare.yml create mode 100644 docs/scripts/生产Salon Gitea流水线配置说明_20260827.md diff --git a/.gitea/workflows/salon-prod-deploy.yml b/.gitea/workflows/salon-prod-deploy.yml new file mode 100644 index 00000000..773ed72a --- /dev/null +++ b/.gitea/workflows/salon-prod-deploy.yml @@ -0,0 +1,95 @@ +name: Salon 生产发布 + +on: + workflow_dispatch: + inputs: + prepare_run_id: + description: 自动准备工作流的运行 ID + required: true + type: string + release_sha: + description: prod 合并提交 SHA + required: true + type: string + +jobs: + deploy: + runs-on: jayucloud + env: + WEB_TARGET_HOST: ${{ secrets.SALON_PROD_WEB_HOST }} + WEB_TARGET_PORT: ${{ secrets.SALON_PROD_WEB_PORT }} + WEB_TARGET_USER: ${{ secrets.SALON_PROD_WEB_USER }} + WEB_REMOTE_DIR: ${{ secrets.SALON_PROD_WEB_DIR }} + steps: + - name: 检出发布脚本 + uses: actions/checkout@v4 + with: + ref: ${{ inputs.release_sha }} + - name: 准备 Node.js 20 + uses: actions/setup-node@v4 + with: + node-version: '20' + - name: 发布并校验 Salon 生产 Nacos + shell: bash + env: + NACOS_ENVIRONMENT: prod-both + NACOS_PROD_URLS: ${{ secrets.NACOS_PROD_URLS }} + NACOS_PROD_USERNAME: ${{ secrets.NACOS_PROD_USERNAME }} + NACOS_PROD_PASSWORD: ${{ secrets.NACOS_PROD_PASSWORD }} + NACOS_DR_URLS: ${{ secrets.NACOS_DR_URLS }} + NACOS_DR_USERNAME: ${{ secrets.NACOS_DR_USERNAME }} + NACOS_DR_PASSWORD: ${{ secrets.NACOS_DR_PASSWORD }} + run: node .gitea/scripts/publish-nacos.mjs + - name: 下载已审核发布包 + uses: actions/download-artifact@v4 + with: + name: salon-prod-${{ inputs.release_sha }} + path: artifacts/release + repository: ${{ github.repository }} + run-id: ${{ inputs.prepare_run_id }} + github-token: ${{ secrets.GITHUB_TOKEN }} + - name: 写入临时 SSH 配置和目标清单 + shell: bash + env: + SALON_PROD_SSH_PRIVATE_KEY: ${{ secrets.SALON_PROD_SSH_PRIVATE_KEY }} + SALON_PROD_KNOWN_HOSTS: ${{ secrets.SALON_PROD_KNOWN_HOSTS }} + run: | + set -euo pipefail + test -n "$SALON_PROD_SSH_PRIVATE_KEY" + test -n "$SALON_PROD_KNOWN_HOSTS" + test -n "$WEB_TARGET_HOST" + test -n "$WEB_TARGET_PORT" + test -n "$WEB_TARGET_USER" + test -n "$WEB_REMOTE_DIR" + mkdir -p "$RUNNER_TEMP/salon-prod" + printf '%s\n' "$SALON_PROD_SSH_PRIVATE_KEY" > "$RUNNER_TEMP/salon-prod/id_ed25519" + printf '%s\n' "$SALON_PROD_KNOWN_HOSTS" > "$RUNNER_TEMP/salon-prod/known_hosts" + chmod 600 "$RUNNER_TEMP/salon-prod/id_ed25519" "$RUNNER_TEMP/salon-prod/known_hosts" + cat > "$RUNNER_TEMP/salon-prod/servers.json" <- + ./docs/scripts/deploy-jayucloud-salon-production.ps1 + -Deploy + -SkipDatabaseInit + -RequireSystemd + -PackageDirectory "artifacts/release" + -ServerInfoJsonPath "$env:SERVER_INFO_JSON" + -SshKeyPath "$env:SSH_KEY_PATH" + -KnownHostsPath "$env:KNOWN_HOSTS_PATH" + -WebTargetName salon-web + -WebRemoteDir "$env:WEB_REMOTE_DIR" diff --git a/.gitea/workflows/salon-prod-prepare.yml b/.gitea/workflows/salon-prod-prepare.yml new file mode 100644 index 00000000..0f766bad --- /dev/null +++ b/.gitea/workflows/salon-prod-prepare.yml @@ -0,0 +1,47 @@ +name: Salon 生产发布准备 + +on: + pull_request: + types: + - closed + branches: + - prod + +jobs: + prepare: + if: >- + github.event.pull_request.merged == true && + github.event.pull_request.base.ref == 'prod' && + github.event.pull_request.head.ref == 'sit' + runs-on: jayucloud + steps: + - name: 检出合并提交 + uses: actions/checkout@v4 + with: + ref: ${{ github.event.pull_request.merge_commit_sha }} + fetch-depth: 0 + - name: 准备 Java 17 + uses: actions/setup-java@v4 + with: + distribution: temurin + java-version: '17' + cache: maven + - name: 准备 Node.js 20 + uses: actions/setup-node@v4 + with: + node-version: '20' + cache: npm + cache-dependency-path: JC-Salon-Frontend/package-lock.json + - name: 构建 Salon 发布包 + shell: pwsh + run: >- + ./docs/scripts/deploy-jayucloud-salon-production.ps1 + -PackageOnly + -SkipDatabaseInit + - name: 上传发布包 + uses: actions/upload-artifact@v4 + with: + name: salon-prod-${{ github.event.pull_request.merge_commit_sha }} + path: artifacts/release/* + if-no-files-found: error + retention-days: 30 diff --git a/docs/scripts/deploy-jayucloud-salon-production.ps1 b/docs/scripts/deploy-jayucloud-salon-production.ps1 index 0df3e944..176fffd5 100644 --- a/docs/scripts/deploy-jayucloud-salon-production.ps1 +++ b/docs/scripts/deploy-jayucloud-salon-production.ps1 @@ -8,6 +8,12 @@ param( [switch]$SkipTests, [switch]$AllowDirtyWorkingTree, [switch]$SkipDatabaseInit, + [switch]$PackageOnly, + [switch]$RequireSystemd, + [string]$PackageDirectory = "", + [string]$ServerInfoJsonPath = "", + [string]$SshKeyPath = "", + [string]$KnownHostsPath = "", [string]$DatabaseTargetName = "mysql02", [int]$DatabasePort = 3306, [string]$DatabaseName = "jayucloud_salon", @@ -324,6 +330,31 @@ function Get-ServersFromWorkbook { } } +function Get-ServersFromJson { + param([string]$Path) + + if (-not (Test-Path -LiteralPath $Path)) { + throw "服务器 JSON 清单不存在:$Path" + } + + $items = @(Get-Content -LiteralPath $Path -Raw -Encoding UTF8 | ConvertFrom-Json) + foreach ($item in $items) { + if (-not $item.Name -or -not $item.Host) { + throw "服务器 JSON 清单缺少 Name 或 Host:$Path" + } + [pscustomobject]@{ + Name = [string]$item.Name + Host = [string]$item.Host + Port = if ($item.Port) { [int]$item.Port } else { 22 } + User = if ($item.User) { [string]$item.User } else { "root" } + Password = "" + Purpose = if ($item.Purpose) { [string]$item.Purpose } else { "" } + Note = if ($item.Note) { [string]$item.Note } else { "" } + Environment = if ($item.Environment) { [string]$item.Environment } else { "prod" } + } + } +} + function Resolve-ServerInfoPath { param([string]$ExplicitPath) @@ -374,7 +405,15 @@ function Invoke-RemoteShell { [switch]$Sensitive ) - if ($UsePuttyPassword) { + if ($SshKeyPath) { + $sshArgs = @("-o", "BatchMode=yes", "-o", "StrictHostKeyChecking=yes", "-i", $SshKeyPath) + if ($KnownHostsPath) { + $sshArgs += @("-o", "UserKnownHostsFile=$KnownHostsPath") + } + $sshArgs += @("-p", [string]$Server.Port, (Get-SshTarget $Server), $Command) + Invoke-Native "ssh" $sshArgs -Sensitive:$Sensitive -RemoteMutation + } + elseif ($UsePuttyPassword) { $plink = Get-Command plink -ErrorAction SilentlyContinue if ((-not $DryRun) -and (-not $plink)) { throw "找不到 PuTTY plink,请安装 PuTTY 工具或改用 SSH key。" @@ -399,7 +438,15 @@ function Copy-FileToRemote { throw "本地上传文件不存在:$LocalPath" } - if ($UsePuttyPassword) { + if ($SshKeyPath) { + $scpArgs = @("-o", "BatchMode=yes", "-o", "StrictHostKeyChecking=yes", "-i", $SshKeyPath) + if ($KnownHostsPath) { + $scpArgs += @("-o", "UserKnownHostsFile=$KnownHostsPath") + } + $scpArgs += @("-P", [string]$Server.Port, $LocalPath, "$(Get-SshTarget $Server):$RemotePath") + Invoke-Native "scp" $scpArgs -Sensitive:$Sensitive -RemoteMutation + } + elseif ($UsePuttyPassword) { $pscp = Get-Command pscp -ErrorAction SilentlyContinue if ((-not $DryRun) -and (-not $pscp)) { throw "找不到 PuTTY pscp,请安装 PuTTY 工具或改用 SSH key。" @@ -569,6 +616,10 @@ RELEASE="`$APP_DIR/releases/`$RELEASE_NAME" BACKUP_NAME="app-$releaseTimestamp.jar" mkdir -p "`$APP_DIR/releases" "`$APP_DIR/backups" "`$APP_DIR/logs" test -f "`$RELEASE" +if [ "`$RequireSystemd" = "True" ] && ! systemctl list-unit-files | grep -q "^`$SERVICE.service"; then + echo "Required systemd unit missing: `$SERVICE" + exit 44 +fi if command -v systemctl >/dev/null 2>&1 && systemctl list-unit-files | grep -q "^`$SERVICE.service"; then systemctl stop "`$SERVICE" || true fi @@ -776,9 +827,66 @@ function Invoke-PublicSmokeTests { } } +if ($PackageOnly) { + Write-Step "检查工作区" + $gitState = Test-GitState + Write-Step "构建发布包" + $package = Build-ReleasePackage $gitState + $packageManifest = [pscustomobject]@{ + releaseTimestamp = $releaseTimestamp + git = $package.Git + artifacts = $package.Hashes + parameters = [pscustomobject]@{ + databaseName = $DatabaseName + webRemoteDir = $WebRemoteDir + publicBaseUrl = $PublicBaseUrl + nacosNamespace = "jayucloud-salon" + packageOnly = $true + } + } + $packageManifest | ConvertTo-Json -Depth 8 | Set-Content -LiteralPath $manifestPath -Encoding UTF8 + Write-Host "发布包已生成:$($package.Directory)" + exit 0 +} + +function Get-ExistingReleasePackage { + param([string]$Path) + + if (-not (Test-Path -LiteralPath $Path)) { + throw "已下载发布包目录不存在:$Path" + } + $manifestFile = Get-ChildItem -LiteralPath $Path -Filter "manifest.json" -File -Recurse | Select-Object -First 1 + if (-not $manifestFile) { + throw "发布包目录中缺少 manifest.json:$Path" + } + $releaseDir = $manifestFile.Directory.FullName + $coreArtifact = Join-Path $releaseDir "backend\JC-Salon-Core.jar" + $gatewayArtifact = Join-Path $releaseDir "backend\JC-Salon-Gateway.jar" + $frontendArtifact = Join-Path $releaseDir "frontend\jc-salon-frontend-dist.tar.gz" + $sqlArtifact = Join-Path $releaseDir "sql\jayucloud-salon.sql" + foreach ($requiredPath in @($coreArtifact, $gatewayArtifact, $frontendArtifact, $sqlArtifact)) { + if (-not (Test-Path -LiteralPath $requiredPath)) { + throw "发布包缺少文件:$requiredPath" + } + } + $hashes = foreach ($artifact in @($coreArtifact, $gatewayArtifact, $frontendArtifact, $sqlArtifact)) { + $hash = Get-FileHash -LiteralPath $artifact -Algorithm SHA256 + [pscustomobject]@{ Path = $artifact.Replace($releaseDir, "").TrimStart("\", "/"); Sha256 = $hash.Hash } + } + [pscustomobject]@{ + Directory = $releaseDir + CoreJar = $coreArtifact + GatewayJar = $gatewayArtifact + FrontendArchive = $frontendArtifact + InitSql = $sqlArtifact + Hashes = @($hashes) + Git = $null + } +} + Write-Step "读取服务器清单" -$resolvedServerInfoPath = Resolve-ServerInfoPath $ServerInfoPath -$servers = @(Get-ServersFromWorkbook $resolvedServerInfoPath) +$resolvedServerInfoPath = if ($ServerInfoJsonPath) { (Resolve-Path -LiteralPath $ServerInfoJsonPath).Path } else { Resolve-ServerInfoPath $ServerInfoPath } +$servers = if ($ServerInfoJsonPath) { @(Get-ServersFromJson $resolvedServerInfoPath) } else { @(Get-ServersFromWorkbook $resolvedServerInfoPath) } $coreServers = @($servers | Where-Object { $_.Name -match $CorePattern }) $gatewayServers = @($servers | Where-Object { $_.Name -match $GatewayPattern }) $webServers = @(if ($WebTargetName) { @@ -816,8 +924,8 @@ if ($databaseServer) { Write-Step "检查工作区" $gitState = Test-GitState -Write-Step "构建发布包" -$package = Build-ReleasePackage $gitState +Write-Step "准备发布包" +$package = if ($PackageDirectory) { Get-ExistingReleasePackage $PackageDirectory } else { Build-ReleasePackage $gitState } Write-ReleaseManifest $package $coreServers $gatewayServers $webServers[0] $databaseServer $resolvedServerInfoPath if (-not $Deploy) { diff --git a/docs/scripts/生产Salon Gitea流水线配置说明_20260827.md b/docs/scripts/生产Salon Gitea流水线配置说明_20260827.md new file mode 100644 index 00000000..c563e193 --- /dev/null +++ b/docs/scripts/生产Salon Gitea流水线配置说明_20260827.md @@ -0,0 +1,36 @@ +# Salon 生产 Gitea 流水线配置说明 + +## 工作流 + +- `.gitea/workflows/salon-prod-prepare.yml`:仅在 `sit` 来源的 PR 合并到 `prod` 后自动运行,构建后端、前端和 SQL 归档并上传 Artifact,不修改生产环境。 +- `.gitea/workflows/salon-prod-deploy.yml`:仅支持手工运行,填写准备工作流运行 ID 和合并提交 SHA 后,下载对应 Artifact 并执行生产发布。 + +## prod 分支保护 + +在 Gitea 仓库的 Branches/Protected branches 中为 `prod` 配置: + +- 禁止直接 push; +- 仅允许 Pull Request 合并; +- 合并来源分支限制为 `sit`; +- 至少一名审批人,并要求状态检查 `Salon 生产发布准备 / prepare` 成功。 + +## Runner + +Runner 标签为 `jayucloud`,需要预装或可用:Node.js 20、JDK 17、Maven、npm、tar、PowerShell 7、OpenSSH client。人工发布阶段还必须能访问生产 Nacos、6 台 Salon 后端服务器和阿里云 NGINX 主机。 + +## Secrets + +仓库 Actions Secrets 需要配置: + +- `SALON_PROD_SSH_PRIVATE_KEY`:仅用于生产发布的 SSH 私钥; +- `SALON_PROD_KNOWN_HOSTS`:6 台后端和阿里云 NGINX 的固定主机指纹; +- `SALON_PROD_WEB_HOST`、`SALON_PROD_WEB_PORT`、`SALON_PROD_WEB_USER`、`SALON_PROD_WEB_DIR`:阿里云 NGINX 实际目标信息; +- `GITHUB_TOKEN`:用于下载准备工作流 Artifact(由 Gitea 自动提供)。 + +SSH 私钥必须对应后端节点和 Web 节点上的部署公钥,禁止把 root 密码写入工作流或 Secrets。生产 Nacos 认证和应用启动所需运行时变量应通过受控的服务环境文件或 Gitea Secrets 注入,不能写入仓库。 + +## 发布边界 + +自动准备阶段不连接生产 SSH、不发布 Nacos、不重启服务、不执行 SQL。人工发布阶段跳过数据库初始化;SQL 仅作为 Artifact 附件,由 DBA 按版本化迁移规则人工执行并记录。 + +首次人工发布前,需在 6 台后端完成 `jc-salon-core`、`jc-salon-gateway` 服务单元及运行时环境文件初始化;人工发布工作流使用 `-RequireSystemd`,缺少服务单元会直接失败,不会退回后台进程模式。还需确认阿里云 NGINX 已使用 `/opt/jc-salon-frontend/current` 或等价目录作为 Salon 站点根目录。 -- 2.54.0 From 57dfe82a5d93e0f01cc10d6e8b35656e0585a5a1 Mon Sep 17 00:00:00 2001 From: xiaowang <2161656029@qq.com> Date: Thu, 27 Aug 2026 13:24:43 +0800 Subject: [PATCH 18/19] =?UTF-8?q?=E8=A1=A5=E5=85=85Salon=E4=B8=9A=E5=8A=A1?= =?UTF-8?q?=E6=9C=8D=E5=8A=A1=E5=99=A8=E6=B8=85=E5=8D=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/业务服务器清单.md | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 docs/业务服务器清单.md diff --git a/docs/业务服务器清单.md b/docs/业务服务器清单.md new file mode 100644 index 00000000..3f46c3ba --- /dev/null +++ b/docs/业务服务器清单.md @@ -0,0 +1,21 @@ +# Salon 业务服务器清单 + +更新时间:2026-08-27 + +## 后端服务器 + +| 名称 | 环境 | 角色 | IP 地址 | SSH 端口 | 操作系统 | Java | 应用目录 | 当前状态 | +| --- | --- | --- | --- | ---: | --- | --- | --- | --- | +| core01-01 | 生产 | Salon Core | `192.168.10.24` | 22 | Rocky Linux 9.8 | 17.0.20.1 | `/opt/jc-salon-core` | 已创建发布、备份、日志目录;服务单元待首次部署创建 | +| core01-02 | 生产 | Salon Core | `192.168.10.25` | 22 | Rocky Linux 9.8 | 17.0.20.1 | `/opt/jc-salon-core` | 已创建发布、备份、日志目录;服务单元待首次部署创建 | +| core01-03 | 生产 | Salon Core | `192.168.20.16` | 22 | Rocky Linux 9.8 | 17.0.20.1 | `/opt/jc-salon-core` | 已创建发布、备份、日志目录;服务单元待首次部署创建 | +| gateway01-01 | 生产 | Salon Gateway | `192.168.10.26` | 22 | Rocky Linux 9.8 | 17.0.20.1 | `/opt/jc-salon-gateway` | 已创建发布、备份、日志目录;服务单元待首次部署创建 | +| gateway01-02 | 生产 | Salon Gateway | `192.168.10.27` | 22 | Rocky Linux 9.8 | 17.0.20.1 | `/opt/jc-salon-gateway` | 已创建发布、备份、日志目录;服务单元待首次部署创建 | +| gateway01-03 | 生产 | Salon Gateway | `192.168.20.18` | 22 | Rocky Linux 9.8 | 17.0.20.1 | `/opt/jc-salon-gateway` | 已创建发布、备份、日志目录;服务单元待首次部署创建 | + +## 统一基线 + +- 6 台服务器 SSH 端口均为 `22`,防火墙由 firewalld 管理并处于运行状态。 +- 应用目录及其 `releases`、`backups`、`logs` 子目录权限均为 `755 root:root`。 +- 当前未创建或启动 `jc-salon-core`、`jc-salon-gateway` systemd 服务,80/81 业务端口未监听。 +- 生产 SSH 凭据、Nacos 凭据和部署私钥由私有凭据管理,不写入本清单。 -- 2.54.0 From ccadd8dc623e8a204622f1713e649b44203075db Mon Sep 17 00:00:00 2001 From: xiaowang <2161656029@qq.com> Date: Thu, 27 Aug 2026 13:28:24 +0800 Subject: [PATCH 19/19] =?UTF-8?q?=E6=95=B4=E7=90=86=E5=BC=80=E5=8F=91?= =?UTF-8?q?=E5=88=86=E6=94=AF=E5=BD=93=E5=89=8D=E4=BB=A3=E7=A0=81=E4=B8=8E?= =?UTF-8?q?=E9=A1=B9=E7=9B=AE=E8=A7=84=E5=88=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- AGENTS.md | 10 +- CLAUDE.md | 10 +- .../指尖管理师上线检查清单_20260622.md | 53 ---- .../指尖管理师上线部署审计报告_20260622.md | 297 ------------------ .../指尖设计师三端真实测试报告_20260618.md | 188 ----------- 5 files changed, 10 insertions(+), 548 deletions(-) delete mode 100644 docs/testing/指尖管理师上线检查清单_20260622.md delete mode 100644 docs/testing/指尖管理师上线部署审计报告_20260622.md delete mode 100644 docs/testing/指尖设计师三端真实测试报告_20260618.md diff --git a/AGENTS.md b/AGENTS.md index bbf8bbbd..de918b91 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -1,7 +1,7 @@ # GitNexus — Code Intelligence -This project is indexed by GitNexus as **FingertipDesigner** (15270 symbols, 32958 relationships, 300 execution flows). Use the GitNexus MCP tools to understand code, assess impact, and navigate safely. +This project is indexed by GitNexus as **JayuCloud** (22596 symbols, 47343 relationships, 300 execution flows). Use the GitNexus MCP tools to understand code, assess impact, and navigate safely. > Index stale? Run `node .gitnexus/run.cjs analyze` from the project root — it auto-selects an available runner. No `.gitnexus/run.cjs` yet? `npx gitnexus analyze` (npm 11 crash → `npm i -g gitnexus`; #1939). @@ -24,10 +24,10 @@ This project is indexed by GitNexus as **FingertipDesigner** (15270 symbols, 329 | Resource | Use for | |----------|---------| -| `gitnexus://repo/FingertipDesigner/context` | Codebase overview, check index freshness | -| `gitnexus://repo/FingertipDesigner/clusters` | All functional areas | -| `gitnexus://repo/FingertipDesigner/processes` | All execution flows | -| `gitnexus://repo/FingertipDesigner/process/{name}` | Step-by-step execution trace | +| `gitnexus://repo/JayuCloud/context` | Codebase overview, check index freshness | +| `gitnexus://repo/JayuCloud/clusters` | All functional areas | +| `gitnexus://repo/JayuCloud/processes` | All execution flows | +| `gitnexus://repo/JayuCloud/process/{name}` | Step-by-step execution trace | ## CLI diff --git a/CLAUDE.md b/CLAUDE.md index e2b0c45f..b53a6048 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -1,7 +1,7 @@ # GitNexus — Code Intelligence -This project is indexed by GitNexus as **FingertipDesigner** (15270 symbols, 32958 relationships, 300 execution flows). Use the GitNexus MCP tools to understand code, assess impact, and navigate safely. +This project is indexed by GitNexus as **JayuCloud** (22596 symbols, 47343 relationships, 300 execution flows). Use the GitNexus MCP tools to understand code, assess impact, and navigate safely. > Index stale? Run `node .gitnexus/run.cjs analyze` from the project root — it auto-selects an available runner. No `.gitnexus/run.cjs` yet? `npx gitnexus analyze` (npm 11 crash → `npm i -g gitnexus`; #1939). @@ -24,10 +24,10 @@ This project is indexed by GitNexus as **FingertipDesigner** (15270 symbols, 329 | Resource | Use for | |----------|---------| -| `gitnexus://repo/FingertipDesigner/context` | Codebase overview, check index freshness | -| `gitnexus://repo/FingertipDesigner/clusters` | All functional areas | -| `gitnexus://repo/FingertipDesigner/processes` | All execution flows | -| `gitnexus://repo/FingertipDesigner/process/{name}` | Step-by-step execution trace | +| `gitnexus://repo/JayuCloud/context` | Codebase overview, check index freshness | +| `gitnexus://repo/JayuCloud/clusters` | All functional areas | +| `gitnexus://repo/JayuCloud/processes` | All execution flows | +| `gitnexus://repo/JayuCloud/process/{name}` | Step-by-step execution trace | ## CLI diff --git a/docs/testing/指尖管理师上线检查清单_20260622.md b/docs/testing/指尖管理师上线检查清单_20260622.md deleted file mode 100644 index 2c238f55..00000000 --- a/docs/testing/指尖管理师上线检查清单_20260622.md +++ /dev/null @@ -1,53 +0,0 @@ -# 指尖管理师上线检查清单(2026-06-24 更新) - -## 总体结论 - -- [ ] 当前可上线 -- [x] 当前仍需完成部署前验证 -- [ ] 高风险修复后可灰度 -- [ ] 中低风险可带风险上线 - -## 初始化 SQL - -- [x] 店务端初始化脚本入口:`docs/scripts/sql/init/jayucloud-salon.sql` -- [x] 已明确开发、测试、上线空库只执行该 SQL -- [x] 已删除旧迁移 SQL,历史变更已合并进初始化基线 -- [x] 已保留一名平台管理员 `xiaowang` -- [x] 已保留完整权限字典和管理员全量授权 -- [x] 已保留协议、系统参数、MessageHub、VIP 基础配置 -- [x] 已合并 `t_object_storage_file_replica` -- [x] 已合并 `t_product.front_visible` -- [x] 已合并 `t_product.source_type` -- [x] 已确认 `t_messagehub_push_config.source_system` 使用 `fingertipdesigner` -- [ ] 需在可直连 MySQL 的环境创建临时库并全量执行 `jayucloud-salon.sql` -- [ ] 需记录 fresh install 执行耗时、warning、失败语句和最终表结构 -- [ ] 需确认生产 MySQL `lower_case_table_names` 与库名大小写策略 - -## 后端 FD-Core - -- [x] manager 边界目标测试通过:`AdminManagerControllerTest` -- [ ] 需跑全量 `rtk mvn -f FD-Core/pom.xml test` -- [ ] 需确认全量测试失败是否与本轮 SQL/manager 改动相关 -- [ ] 需用生产或预发配置启动 Core 并验证 MySQL、Redis、RabbitMQ、对象存储连接 - -## 后端 FD-Gateway - -- [x] manager 路由测试通过:`AuthGlobalFilterWhitelistTest` -- [ ] 需跑全量 `rtk mvn -f FD-Gateway/pom.xml test` -- [ ] 需启动 Gateway 验证 `/api/admin/manager/**` 可正确转发到 Core - -## 指尖管理师小程序 - -- [x] 核心 API 已迁移到 `/manager/**` 方向 -- [x] JS 静态语法检查通过 -- [ ] 需用微信开发者工具跑登录、规划、客户、员工、排班、店铺设置冒烟 -- [ ] 需确认 `project.config.json` appid 改动是否属于当前发布配置 - -## 上线门槛 - -- [ ] 初始化 SQL 临时库执行成功 -- [ ] Core/Gateway 全量测试完成 -- [ ] 小程序核心链路冒烟完成 -- [ ] Nacos、MySQL、Redis、RabbitMQ、对象存储生产配置核对完成 -- [ ] GitNexus `detect_changes(scope="all")` 完成;若 MCP 不可用,需记录原因 -- [ ] 回滚方案和数据库备份方案确认 diff --git a/docs/testing/指尖管理师上线部署审计报告_20260622.md b/docs/testing/指尖管理师上线部署审计报告_20260622.md deleted file mode 100644 index e615624f..00000000 --- a/docs/testing/指尖管理师上线部署审计报告_20260622.md +++ /dev/null @@ -1,297 +0,0 @@ -# 指尖管理师上线部署审计报告(2026-06-22) - -## 审计结论 - -结论:**阻断上线**。 - -后端 `FD-Core`、`FD-Gateway` 当前可以通过测试和打包,初始化 SQL 与后端实体的主体覆盖关系较完整;但指尖管理师小程序 `FM-Wechat-Fronted` 仍存在生产域名硬编码为本机地址、与 Gateway 路由契约不一致、多个核心页面在接口失败时静默展示 mock/static 数据、门店设置/导出/客户详情等功能未接入真实后端的问题。这些问题会导致真实部署后登录注册、规划、客户、员工、商品、门店设置、导出等核心链路不可用或展示假数据,因此不建议上线。 - -## 审计范围 - -- 当前初始化脚本:`docs/scripts/sql/init/jayucloud-salon.sql` -- 后端服务:`FD-Core`、`FD-Gateway` -- 指尖管理师小程序:`FM-Wechat-Fronted` -- GitNexus:索引时间为 2026-06-16,仅用于辅助导航;结论以当前文件系统源码和本轮命令输出为准。 - -## 2026-06-24 SQL 基线修订 - -- 当前店务端空库初始化以 `docs/scripts/sql/init/jayucloud-salon.sql` 为准;设计师端使用 `docs/scripts/sql/init/jayucloud-artlist.sql`。 -- 旧项目命名、MinIO 三副本对象存储、预约手动项目展示控制等历史变更已合并进初始化基线。 -- `docs/scripts/sql/migrations` 当前不再保留历史迁移 SQL;本轮开发环境测试不再要求额外执行迁移脚本。 -- 已部署生产库不能直接执行初始化 SQL;如果需要升级已有库,必须单独制定迁移方案并人工确认。 -- 原报告中的增量脚本补齐建议已被本次基线策略取代。 - -## 执行摘要 - -| 类别 | 结论 | 证据 | -| --- | --- | --- | -| SQL 完整度 | 主体完整,但存在部署方式风险 | 当前 MySQL `fingertipdesigner` 有 54 张表、323 个索引、所有表有主键;静态解析 54 个 `@TableName` 实体与 54 张表无缺失 | -| SQL 合理性 | 可用于空库初始化,不适合直接重复执行 | `jayucloud-salon.sql` 固定创建并使用 `jayucloud_salon`,前置建表不是全部 `IF NOT EXISTS` | -| SQL 兼容性 | 有大小写和排序规则风险 | 后端默认 datasource 写 `FingertipDesigner`,SQL/当前库为 `fingertipdesigner`;当前 4 张表为 `utf8mb4_general_ci`,其余为 `utf8mb4_unicode_ci` | -| 后端构建 | 通过 | `FD-Core mvn test` 131 个测试通过;`FD-Gateway mvn test` 4 个测试通过;两者 `mvn package -DskipTests` 成功 | -| 后端/数据库匹配 | 主体匹配 | SQL 表与实体表名覆盖一致;`FingertipDesignerSqlSchemaTest` 覆盖对象存储、运营表、权限、默认密码等关键脚本片段 | -| Gateway 契约 | 阻断 | Gateway 支持 `/api/admin/**`、`/admin/api/**`、`/admin/auth/**`,小程序默认请求 `/admin/planning`、`/admin/user`、`/admin/product` 等路径 | -| 小程序逻辑 | 阻断 | 多个核心页接口失败后使用 `utils/mock` 或静态数据,生产环境会隐藏后端故障并展示假数据 | -| 小程序发布配置 | 阻断 | `utils/config.js` 默认 `http://127.0.0.1:80`;`project.config.json` 和 `project.private.config.json` 均关闭 `urlCheck` | -| 自动化冒烟 | 受环境阻塞 | 微信开发者工具 automator 可连,但当前会话页为 `pages/auth/index`,而本项目 `app.json` 首页为 `pages/login/index`;导航到 `pages/login/index`、`pages/planning/index` 均返回 page not found | - -## 验证记录 - -### SQL 与数据库 - -- MySQL MCP 可访问的实例版本:MySQL 5.7.44。 -- 当前业务库:`fingertipdesigner`。 -- 当前库结构:54 张表、323 个索引、0 张无主键表。 -- 排序规则:50 张表为 `utf8mb4_unicode_ci`,4 张表为 `utf8mb4_general_ci`,分别是 `t_legal_agreement`、`t_security_audit_log`、`t_system_parameter_config`、`t_user_agreement_consent`。 -- 关键初始化数据:`t_permission` 77 行、`t_user` 5 行、`t_system_parameter_config` 5 行、`t_legal_agreement` 2 行、`t_messagehub_push_config` 6 行。 -- 临时库执行:已尝试用 JDBC 在本机创建 `fingertip_designer_deploy_check_20260622` 并执行脚本;`127.0.0.1:3306` 连接被拒绝,MySQL MCP 暴露的主机名 `a7437d06c91b` 在本机不可解析。已通过 MCP 执行 `DROP DATABASE IF EXISTS fingertip_designer_deploy_check_20260622` 清理同名临时库。该项未完成全量新库执行,需在可直连 MySQL 的部署机或 CI 中补跑。 - -### 后端构建与测试 - -- `FD-Core`: `mvn test` 成功,Tests run: 131, Failures: 0, Errors: 0, Skipped: 0。 -- `FD-Gateway`: `mvn test` 成功,Tests run: 4, Failures: 0, Errors: 0, Skipped: 0。 -- `FD-Core`: `mvn package -DskipTests` 成功,产物 `docs/product/FingertipDesigner-Core.jar`,约 82.1 MB。 -- `FD-Gateway`: `mvn package -DskipTests` 成功,产物 `docs/product/FingertipDesigner-Gateway.jar`,约 47.5 MB。 -- `FM-Wechat-Fronted`: 31 个 JS 文件执行 `node --check` 通过,无 JS 语法错误。 - -### 小程序自动化 - -- `mp_ensureConnection` 曾连接到历史管理师小程序工程的 automator,会话显示 SDKVersion 3.15.2。 -- 当前 automator 会话页为 `pages/auth/index`,但 `FM-Wechat-Fronted/app.json` 注册页面为 `pages/login/index`、`pages/register/index`、`pages/planning/index` 等 19 个页面,不包含 `pages/auth/index`。 -- `mp_navigate` 到 `pages/login/index` 和 `pages/planning/index` 均失败:`page is not found`。 -- 结论:本轮无法用当前开发者工具会话完成真实页面冒烟,该自动化环境不能作为上线通过证据。 - -## 阻断问题 - -### 1. 小程序默认请求本机地址,无法发布到生产 - -严重级别:阻断上线。 - -证据: - -- `FM-Wechat-Fronted/utils/config.js:1`:`DEFAULT_DOMAIN = 'http://127.0.0.1:80'` -- `FM-Wechat-Fronted/utils/config.js:5`:`ADMIN_API_BASE_URL: ${DEFAULT_DOMAIN}/admin` -- `FM-Wechat-Fronted/project.config.json:10`:`urlCheck: false` -- `FM-Wechat-Fronted/project.private.config.json:6`:`urlCheck: false` - -影响: - -- 真机和线上小程序会请求用户设备自己的 `127.0.0.1`,不会请求生产服务。 -- 微信发布要求服务端域名配置和 HTTPS 域名校验,关闭 `urlCheck` 只能用于开发阶段。 - -建议: - -- 引入明确的环境构建配置,生产包使用 HTTPS 生产域名。 -- 提交审核前恢复域名校验,并在微信公众平台配置合法 request 域名。 -- 将小程序默认后台 API 前缀统一为 Gateway 可识别路径,例如 `/api/admin`,或在 Gateway/Nginx 明确支持 `/admin/**`。 - -### 2. 小程序后台 API 前缀与 Gateway 路由不匹配 - -严重级别:阻断上线。 - -证据: - -- Gateway `FD-Gateway/src/main/resources/application.yaml:101` 支持 `/api/admin/**` 并重写到 `/admin/**`。 -- Gateway `FD-Gateway/src/main/resources/application.yaml:109` 支持 `/admin/api/**` 并重写到 `/admin/**`。 -- Gateway `FD-Gateway/src/main/resources/application.yaml:116` 仅兼容 `/admin/auth/**`。 -- 小程序默认 baseUrl 是 `${DEFAULT_DOMAIN}/admin`,因此 `api/planning.js` 的 `planning/calendar` 会变成 `/admin/planning/calendar`。 -- 后端 Core 有 `AdminPlanningController @RequestMapping("/admin/planning")`,但 Gateway 没有 `/admin/planning/**` 路由。 - -影响: - -- 如果生产流量走 Gateway,小程序除 `/admin/auth/**` 外的大部分后台接口会 404 或无法路由:规划、员工、排班、客户、商品、门店、库存、营销等均受影响。 - -建议: - -- 优先调整小程序 `ADMIN_API_BASE_URL` 为生产域名加 `/api/admin`。 -- 或 Gateway 增加清晰的 `/admin/**` 后台路由,并确保鉴权、白名单、跨域、安全策略一致。 -- 修复后至少对登录、注册、规划日历、创建预约、员工列表、客户列表、商品列表、门店设置进行接口级冒烟。 - -### 3. Gateway 白名单缺少管理师注册接口 - -严重级别:阻断上线。 - -证据: - -- 后端 Core 存在 `AdminAuthController @RequestMapping("/admin/auth")` 和 `@PostMapping("/register")`。 -- Gateway 默认白名单包含 `/api/admin/auth/login`、`/admin/auth/login`、`/admin/api/auth/login`,但未包含 `/admin/auth/register` 或 `/api/admin/auth/register`。 -- 小程序 `api/auth.js` 注册调用 `auth/register`,在当前 baseUrl 下会请求 `/admin/auth/register`。 - -影响: - -- 生产若通过 Gateway,未登录用户调用注册会被鉴权过滤器拦截。 - -建议: - -- 明确注册是否开放。如果开放,将注册、验证码、协议等未登录接口加入 Gateway/Core 双侧白名单。 -- 如果注册不开放,前端必须移除或隐藏注册入口,并给出受控邀请/开户注册流程。 - -### 4. 核心页面在接口失败后展示 mock/static 数据 - -严重级别:阻断上线。 - -证据: - -- `FM-Wechat-Fronted/pages/planning/index.js:135`:日历接口失败后 `applyCalendar(mock.buildCalendar(...))`。 -- `FM-Wechat-Fronted/pages/appointment-form/index.js:40`、`:50`:商品接口失败后使用 `fallbackProducts`。 -- `FM-Wechat-Fronted/pages/appointment-form/index.js:117`:排班接口失败后使用 `mock.buildCalendar(...)` 做冲突判断。 -- `FM-Wechat-Fronted/pages/appointment-detail/index.js:22`:详情失败后使用 mock 预约。 -- `FM-Wechat-Fronted/pages/customers/index.js:20`、`:37`:客户列表失败后使用 fallback 客户。 -- `FM-Wechat-Fronted/pages/employees/index.js:14`、`:33`:员工列表失败后使用 mock 员工。 -- `FM-Wechat-Fronted/pages/employee-detail/index.js:10`、`:11`:员工详情使用 mock 员工。 - -影响: - -- 后端不可用、权限错误、字段错配时,门店人员会看到假预约、假客户、假员工、假可用档期。 -- 预约冲突判断可能基于 mock 数据放行,造成超卖或错排。 -- 线上问题会被前端静默掩盖,排障困难。 - -建议: - -- 生产代码中移除 mock 兜底;接口失败必须展示明确错误、重试入口和空状态。 -- mock 数据仅允许通过显式开发环境开关启用,且生产构建强制关闭。 -- 对规划、预约、客户、员工页面增加真实接口冒烟或 E2E。 - -### 5. 门店设置、导出、客户详情未接入真实后端 - -严重级别:阻断上线。 - -证据: - -- `FM-Wechat-Fronted/api/shop.js:6`、`:12` 调用 `/shops/current`,但 `AdminShopController` 仅提供 `/list`、`/create`、`/update/{id}`、`/delete/{id}`、`/status/{id}`、`/list/all`、`/{id}`。 -- `FM-Wechat-Fronted/api/shop.js:20` 调用 `/export`,后端控制器扫描未发现 `admin/export` 或 `/export` 后台导出入口。 -- `FM-Wechat-Fronted/pages/shop-settings/index.js` 没有调用 `api/shop.js`,保存只 `wx.showToast`。 -- `FM-Wechat-Fronted/pages/export/index.js` 导出只 `wx.showToast`。 -- `FM-Wechat-Fronted/api/customers.js` 定义 `/user/detail/${id}`,但 `AdminUserController` 未提供 `/detail/{id}`;`pages/customer-detail/index.js` 使用静态客户和订单数据。 - -影响: - -- 设置、导出、客户详情属于管理师上线必用功能,当前无法真实保存、导出或查看真实明细。 - -建议: - -- 明确功能是否纳入本次上线。纳入则补齐后端接口和前端接入;不纳入则从小程序入口、菜单、路由中下线。 -- 对每个入口建立接口契约表:URL、方法、鉴权、请求体、响应字段、错误态。 - -## 高风险问题 - -### 6. 初始化 SQL 与默认 datasource 库名大小写不一致 - -严重级别:高风险需修复。 - -证据: - -- `jayucloud-salon.sql` 创建并使用 `jayucloud_salon`。 -- `FD-Core/src/main/resources/application.yaml:3` 默认连接 `jdbc:mysql://localhost:3306/FingertipDesigner`。 -- MySQL MCP 当前库名为 `fingertipdesigner`。 - -影响: - -- Linux MySQL 上数据库名大小写可能敏感,默认配置与初始化库名不一致会导致服务连错库或启动失败。 - -建议: - -- 统一初始化 SQL、Nacos datasource、应用默认配置和部署文档中的库名。 -- 生产环境优先通过 Nacos/环境变量显式配置,不依赖本地默认值。 - -### 7. 增量迁移链缺失,不满足已有库升级要求 - -严重级别:高风险需修复。 - -证据: - -- `docs/scripts/sql/migrations` 当前仅有 `.gitkeep`。 -- 当前端侧初始化脚本不再依赖历史增量脚本。 -- 项目规则要求后端涉及 SQL 时不要修改初始化 SQL,必须新增版本变更 SQL。 - -影响: - -- 空库部署可以依赖初始化 SQL,但已有环境升级缺少可审计、可回放的版本变更脚本。 -- 如果直接对已有库执行初始化 SQL,前置非 `IF NOT EXISTS` 建表语句存在失败风险。 - -建议: - -- 恢复或新增本次上线对应的版本变更 SQL,文件名使用中文、体现功能和日期,内容完整可执行。 -- 初始化 SQL 只作为空库入口,已有库必须走迁移脚本。 - -### 8. 表排序规则不完全一致 - -严重级别:中风险。 - -证据: - -- 50 张表为 `utf8mb4_unicode_ci`,4 张表为 `utf8mb4_general_ci`。 - -影响: - -- 跨表字符串比较、唯一约束、排序、模糊搜索可能出现边界差异。 - -建议: - -- 统一表级和字段级排序规则,至少对系统配置、协议、审计等新增表给出明确排序规则。 - -### 9. 部署配置仍保留测试/默认依赖值 - -严重级别:高风险需修复。 - -证据: - -- `FD-Core/src/main/resources/bootstrap.yaml` 和 `FD-Gateway/src/main/resources/bootstrap.yaml` 默认 `NACOS_NAMESPACE` 为 `FingertipDesigner-Test`。 -- Nacos 默认用户名/密码写在配置文件默认值中。 -- `FD-Core/src/main/resources/application.yaml` 对象存储主提供方为 `QINIU_KODO`,但 `QINIU_KODO_ACCESS_KEY`、`SECRET_KEY`、`BUCKET_NAME`、`DOMAIN`、`ZONE` 默认空。 -- Core 依赖 MySQL、Redis、RabbitMQ、对象存储;Gateway 依赖 Nacos、Redis 和服务发现。 - -影响: - -- 生产环境若未显式覆盖,会连到测试命名空间或因对象存储缺配置导致上传/签名失败。 - -建议: - -- 发布前输出生产环境变量清单,并在启动脚本或部署平台强制校验必填项。 -- 清理配置文件中的敏感默认值,避免误用。 - -## 后端与数据库匹配评估 - -### 匹配良好的部分 - -- 初始化 SQL 与实体表名覆盖一致:54 张 SQL 表与 54 个 `@TableName` 实体无缺失。 -- 关键业务表存在:预约 `t_appointment_reservation`、员工排班 `t_artist_schedule`、员工信息 `t_nail_artist_info`、客户/用户 `t_user`、门店 `t_shop`、角色权限 `t_shop_role`/`t_shop_role_permission`/`t_user_shop_role`、协议 `t_legal_agreement`、审计 `t_security_audit_log`、系统参数 `t_system_parameter_config`。 -- 预约规划 DTO/VO 与前端主要字段基本一致:`PlanningAppointmentCreateDTO` 包含 `customerName`、`phone`、`productId`、`artistId`、`appointmentDate`、`appointmentTime`、`durationMinutes`、`clientRequestId`;`PlanningCalendarVO` 返回 `businessStartTime`、`businessEndTime`、`artists`、`schedules`、`appointments`、`daySummaries`。 -- Core 的 SQL schema 测试覆盖了对象存储字段、运营表、权限、默认密码、用户资料字段等初始化脚本片段。 - -### 仍需补测的部分 - -- 本轮未能完成新建临时库全量执行,因此没有 fresh install 的执行耗时、warning 和失败语句记录。 -- 未启动 Core/Gateway 进行真实 HTTP 冒烟,因为外部 Nacos/Redis/RabbitMQ/对象存储生产依赖未在本轮确认可用。 -- 未完成小程序真实页面 E2E,因为开发者工具 automator 当前会话与 `FM-Wechat-Fronted/app.json` 页面不一致。 - -## 小程序接口契约评估 - -| 小程序调用 | 期望后端 | 当前状态 | 风险 | -| --- | --- | --- | --- | -| `/admin/auth/login` | Core 存在,Gateway 兼容且白名单放行 | 基本匹配 | 需生产域名验证 | -| `/admin/auth/register` | Core 存在 | Gateway 白名单未放行 | 注册失败 | -| `/admin/planning/calendar` | Core 存在 | Gateway 无 `/admin/planning/**` 路由 | 日历失败,前端展示 mock | -| `/admin/planning/appointments` | Core 存在 | Gateway 无路由 | 创建预约失败 | -| `/admin/nail-artist/list` | Core 存在 | Gateway 无 `/admin/nail-artist/**` 路由 | 员工列表失败,前端展示 mock | -| `/admin/artist-schedule/list` | Core 存在 | Gateway 无 `/admin/artist-schedule/**` 路由 | 排班失败 | -| `/admin/user/list` | Core 存在 | Gateway 无 `/admin/user/**` 路由 | 客户列表失败,前端展示 fallback | -| `/admin/user/detail/{id}` | Core 未发现 | 前端 API 定义但页面未真实使用 | 客户详情是假数据 | -| `/admin/product/list` | Core 存在 | Gateway 无 `/admin/product/**` 路由 | 商品列表失败,预约表单展示 fallback | -| `/admin/shops/current` | Core 未发现 | 前端 API 调用但页面未真实接入 | 门店设置不可用 | -| `/admin/export` | Core 未发现 | 页面只 toast | 导出不可用 | - -## 上线判断 - -当前状态不满足上线部署条件。建议将以下问题作为上线前硬门禁: - -1. 修复小程序生产域名和 Gateway 路由前缀。 -2. 明确并修复注册白名单策略。 -3. 移除生产 mock/static 兜底,改为真实错误态。 -4. 补齐或下线门店设置、导出、客户详情等未接入功能。 -5. 在可直连 MySQL 的环境全量执行 `jayucloud-salon.sql` 到临时库,并记录 warning。 -6. 验证唯一初始化 SQL 已包含全部上线所需表、字段、索引和运行必需种子数据。 -7. 用干净的微信开发者工具会话重新打开 `FM-Wechat-Fronted` 并跑核心页面冒烟。 -8. 以生产 Nacos/Redis/RabbitMQ/MySQL/对象存储配置启动 Core/Gateway 并跑接口冒烟。 - -只有以上门禁关闭后,才建议进入灰度或预发布验收。 diff --git a/docs/testing/指尖设计师三端真实测试报告_20260618.md b/docs/testing/指尖设计师三端真实测试报告_20260618.md deleted file mode 100644 index c9bd5867..00000000 --- a/docs/testing/指尖设计师三端真实测试报告_20260618.md +++ /dev/null @@ -1,188 +0,0 @@ -# 指尖设计师三端真实测试报告 20260618 - -## 执行概况 - -- 测试计划来源:原始测试计划已清理;本报告保留测试结论。 -- Web 执行方式:Edge DevTools MCP 真实浏览器导航、点击、DOM 读取、截图、Console/Network 检查 -- Web 环境:`http://127.0.0.1:3000/` -- 数据库:`FingertipDesigner` -- 管理员账号:`xiaowang / 888888` -- 普通测试账号:`quancelianguser / 888888` -- 图片策略:仅复用数据库已有图片文件记录和已签名图片地址,未上传新图片 -- 小程序状态:阻塞,当前线程未暴露微信开发者工具 MCP,未伪造小程序通过结果 - -## 本次补造测试数据 - -| 类型 | 标识 | 中文数据 | -| --- | --- | --- | -| 用户 | `326100000000000001` | 全量测试用户,账号 `quancelianguser`,手机号 `18800070029` | -| 购物车 | `326100000000000201` | 作品01 x 2 | -| 收藏 | `326100000000000202` | 作品02,备注“全量测试收藏备注” | -| 订单 | `326100000000000301` / `QLTEST202606180001` | 作品01,测试店铺,美甲师01,金额 156 | -| 预约 | `326100000000000303` | 预约确认,关联订单 `QLTEST202606180001` | -| 售后 | `326100000000000401` / `ASQLTEST202606180001` | 退款 20,原因“全量测试售后原因” | -| 排班 | `326100000000000501` | 美甲师01,2026-06-19 09:00-18:00,“全量测试排班” | -| 库存 | `326100000000000601` | 全量测试甲油胶,库存 88 | -| 活动 | `326100000000000701` | 全量测试夏日活动 | -| 优惠券 | `326100000000000801` | 全量测试优惠券,满 100 减 15 | - -## Web 前台结果 - -| 用例 | 模块 | 结果 | 实际结果 | -| --- | --- | --- | --- | -| WEB-001 | 登录/注册 | 通过 | 使用测试账号进入登录后状态,个人中心、订单、购物车均识别为“全量测试用户” | -| WEB-002 | 首页 | 通过 | `/home` 正常展示,无白屏,无明显布局遮挡 | -| WEB-003 | 作品列表 | 通过 | `/products` 正常展示作品列表,可滚动,图片可渲染 | -| WEB-004 | 作品详情 | 通过 | `/product/325562950938992640` 展示作品、价格、门店和服务信息 | -| WEB-005 | 门店详情 | 通过 | `/shop/325517293758889984` 展示测试店铺资料 | -| WEB-006 | 设计师主页 | 失败 | `/artist/325562887617585152` 显示“美甲师信息不存在”,但数据库存在该美甲师信息 | -| WEB-007 | 未登录拦截 | 通过 | 购物车等受保护页面未登录时跳转登录页 | -| WEB-008 | 购物车 | 通过 | `/cart` 显示作品01 x 2、测试店铺、美甲师01、预约时间选择;结算按钮按选择状态控制 | -| WEB-009 | 订单列表 | 部分通过 | `/orders` 显示 `QLTEST202606180001`、作品01、美甲师01和金额;但该页截图发现移动壳内内容有横向裁切风险 | -| WEB-010 | 订单详情 | 通过 | `/orders/326100000000000301` 展示订单号、测试店铺、作品、美甲师、预约时间、售后记录 | -| WEB-011 | 服务进度 | 通过 | `/service-progress?orderId=326100000000000301` 展示订单创建、预约确认、服务安排、售后/评价节点 | -| WEB-012 | 售后记录 | 通过 | `/after-sales` 展示 `ASQLTEST202606180001`、退款金额 20、原因“全量测试售后原因” | -| WEB-013 | 售后申请 | 通过 | `/after-sale/apply?...` 展示订单、项目、可申请金额、退款类型、原因输入框;未重复提交 | -| WEB-014 | 收藏 | 通过 | `/wishlist` 展示作品02、“全量测试收藏备注”,图片签名地址加载成功 | -| WEB-015 | 优惠券 | 通过 | `/coupons` 展示“全量测试优惠券”,满 100 减 15,未使用 | -| WEB-016 | VIP 中心 | 通过 | `/vip-center` 展示会员等级、余额、充值档位、会员权益,页面可滚动 | -| WEB-017 | 消息通知 | 通过 | `/notifications` 展示现有中文消息“店长消息测试”,接口 200 | -| WEB-018 | 个人中心/设置 | 通过 | `/profile` 展示全量测试用户、可用券 1、购物车 2;账号设置和密码设置页表单布局正常 | - -## Web 后台结果 - -| 用例 | 模块 | 结果 | 实际结果 | -| --- | --- | --- | --- | -| WEB-019 | 后台登录 | 通过 | `xiaowang / 888888` 登录成功,进入 `/admin/dashboard` | -| WEB-020 | 看板 | 通过 | 指标、热门作品、最近动态正常展示 | -| WEB-021 | 用户管理 | 通过 | 列表、筛选、分页、操作入口正常展示 | -| WEB-022 | 作品管理 | 通过 | 作品列表正常展示;图片使用已有文件记录 | -| WEB-023 | 门店管理 | 通过 | 测试店铺正常展示 | -| WEB-024 | 美甲师管理 | 通过 | 美甲师01正常展示 | -| WEB-025 | 订单管理 | 通过 | `/admin/orders` 表格展示 `QLTEST202606180001`、用户ID、金额、待完成状态 | -| WEB-026 | 排班管理 | 通过 | `/admin/schedules` 展示美甲师01、2026-06-19、容量 3、备注“全量测试排班” | -| WEB-027 | 售后处理 | 通过 | `/admin/after-sales` 展示 `ASQLTEST202606180001`、退款 20、待处理,审核按钮可见 | -| WEB-028 | 库存管理 | 通过 | `/admin/inventory` 展示“全量测试甲油胶”,库存 88,入库/出库入口可见 | -| WEB-029 | 活动管理 | 通过 | `/admin/campaigns` 展示“全量测试夏日活动”,状态启用 | -| WEB-030 | 优惠券管理 | 通过 | `/admin/coupons` 展示“全量测试优惠券”,满 100 减 15 | -| WEB-031 | 权限管理 | 通过 | 权限页面可打开,布局正常 | -| WEB-032 | 消息/公告 | 通过 | 消息发布、公告管理页面可打开,布局正常 | -| WEB-033 | 协议/参数/VIP配置 | 通过 | 协议管理、参数管理、VIP充值配置页面可打开,布局正常 | - -## 跨端与非功能 - -| 项目 | 结果 | 实际结果 | -| --- | --- | --- | -| Web 用户端到后台订单同步 | 通过 | 同一订单号 `QLTEST202606180001` 在用户订单、订单详情、服务进度、后台订单页一致 | -| Web 用户端到后台售后同步 | 通过 | 同一售后单 `ASQLTEST202606180001` 在用户售后记录、服务进度、后台售后处理页一致 | -| 排班同步 | 部分通过 | 后台排班存在,美甲师01在购物车可选择;小程序端未测 | -| 作品/门店/优惠券同步 | 通过 | 前台作品/门店/优惠券与后台列表数据一致 | -| 页面布局 | 部分通过 | 大多数页面无白屏、无不可点击遮挡;订单列表页存在移动壳内横向裁切风险 | -| 控制台质量 | 失败 | 后台多个表格 `total` 使用字符串传给 Ant Design Vue 分页,持续触发类型警告 | -| 网络请求 | 部分通过 | 主要业务接口 200;订单相关图片曾出现 `/api/file/get/{id}` 401,签名图片地址加载正常 | -| 小程序用户端 MP-001 至 MP-035 | 阻塞 | 当前线程无微信开发者工具 MCP,未执行模拟器真实点击和截图 | -| 小程序管理师端 FM-001 至 FM-019 | 阻塞 | 当前线程无微信开发者工具 MCP,未执行模拟器真实点击和截图 | -| iOS/Android 真机兼容 | 阻塞 | 未提供真机环境 | - -## 主要缺陷 - -1. `WEB-006 / INT-004`:数据库存在美甲师 `325562887617585152`,但前台 `/artist/325562887617585152` 显示“美甲师信息不存在”。 -2. `WEB-009`:用户端订单列表页截图发现内容在手机壳内有横向裁切风险,顶部和卡片边缘显示不如订单详情页稳定。 -3. 后台多处表格分页 `total` 为字符串,Ant Design Vue 警告“Expected Number, got String”,涉及用户、门店、售后、库存、活动等页面。 -4. 订单详情/订单列表相关图片曾触发 `/api/file/get/325562654963736576` 401;使用签名 URL 的图片能正常加载,但直接文件接口鉴权行为需要确认。 -5. 小程序真实测试阻塞:本线程没有微信开发者工具 MCP,无法执行用户小程序和管理师小程序的真实模拟器点击、截图、控制台和网络检查。 - -## 结论 - -- Web 前台和后台已经用真实 Edge 页面补测,不只是接口检查;缺数据项已补中文测试数据并在页面确认。 -- Web P0 主链路整体可用,但设计师主页失败、订单列表布局风险、控制台分页警告需要修复。 -- 小程序和真机兼容未达成执行条件,应保持“阻塞”而不是“通过”。 -# 2026-06-20 小程序 MCP 补测记录 - -## 执行环境 - -- 微信开发者工具 MCP 已恢复可用,自动化会话可建立。 -- 用户端项目:历史测试工程 `FD-WeChat-Fronted`(原路径不再作为当前仓库入口)。 -- 管理师端项目:历史测试工程 `FM-Wechat-Fronted`(原路径不再作为当前仓库入口)。 -- 测试方式:微信开发者工具 MCP 真实导航、点击、输入、页面 data 读取、元素布局快照、控制台日志读取。 -- 测试数据:全部使用中文;管理师端表单输入使用“全量测试客户”“中文测试备注:喜欢浅粉色猫眼款式”。 - -## 用户小程序补测 - -| 用例 | 模块 | 结果 | 实际结果 | -| --- | --- | --- | --- | -| MP-001 | 冷启动/首页 | 通过 | `pages/home/index` 可打开,显示“游客模式”“先逛逛喜欢的款式和门店”,无白屏,首页主体、标题、搜索框可定位。 | -| MP-002 | TabBar 首页/作品/购物车/我的 | 通过 | 首页、作品、购物车、我的均可切换;作品为空态展示“暂时没有匹配的作品”,购物车和我的展示未登录引导。 | -| MP-003 | 登录页 | 通过 | `pages/auth/index` 可打开,显示“登录/注册”“微信手机号一键登录”“其他登录方式”,页面布局正常。 | -| MP-004 | 订单未登录态 | 通过 | `pages/orders/index` 展示“登录后查看订单”,未登录保护正常。 | -| MP-005 | 售后未登录拦截 | 通过 | 访问 `pages/after-sales/index` 自动跳转登录页,并带 redirect 参数。 | -| MP-006 | 服务进度未登录拦截 | 通过 | 访问 `pages/service-progress/index?orderId=326100000000000301` 自动跳转登录页,并带 redirect 参数。 | -| MP-007 | 真实业务数据加载 | 阻塞 | 项目缺少 `utils/config.local.js`,默认请求 `http://127.0.0.1:80/api`,微信开发者工具提示 `url not in domain list`,导致作品、订单、购物车等真实接口数据无法加载。 | -| MP-008 | 微信手机号登录 | 阻塞 | 当前 DevTools 环境 `wechatMiniSupported=false`,页面提示“当前环境无法使用微信手机号登录,请使用账号密码或验证码登录”。 | - -## 管理师小程序补测 - -| 用例 | 模块 | 结果 | 实际结果 | -| --- | --- | --- | --- | -| FM-001 | 登录页 | 通过 | `pages/login/index` 可打开,账号、密码输入框和“登录/忘记密码/注册账号/微信快捷登录”按钮可见。 | -| FM-002 | 规划日历 | 通过 | `pages/planning/index` 可打开,显示 2026 年 6 月规划数据,小王/小李/小张、王女士/陈女士/林女士、纯色美甲/猫眼延长/手部护理等中文业务数据正常。 | -| FM-003 | 客户列表 | 通过 | `pages/customers/index` 可打开,页面 data 中客户列表为 3 条中文客户数据。 | -| FM-004 | 员工列表 | 通过 | `pages/employees/index` 可打开,员工小王/小李/小张及月订单、金额数据正常。 | -| FM-005 | 我的/个人中心 | 通过 | `pages/profile/index` 显示 Fingertip Designer、店长端,以及店铺设置、数据导出、修改密码、关于系统入口。 | -| FM-006 | 新建预约表单 | 通过 | `pages/appointment-form/index` 显示客户姓名、手机号、预约日期、预约时间、项目内容、指定员工、备注、容量校验和“保存预约”。中文输入“全量测试客户”“中文测试备注:喜欢浅粉色猫眼款式”能写入并渲染。 | -| FM-007 | 预约详情 | 通过 | `pages/appointment-detail/index?id=326100000000000301` 显示王女士、纯色美甲、小王、已确认、时间、确认/完成/取消按钮。 | -| FM-008 | 预约改派 | 通过 | `pages/artist-transfer/index?id=326100000000000301` 显示小王可接、小李有冲突、小张已满,以及新日期、新时间和确认改派按钮。 | -| FM-009 | 排班设置 | 通过 | `pages/schedule-setting/index` 显示日期、开始时间、结束时间、容量和“保存排班”。 | -| FM-010 | 请假管理 | 通过 | `pages/leave-management/index` 显示 1-31 日期、2026-06-12 全天请假、2026-06-25 下午请假和“新增请假”。 | -| FM-011 | 店铺设置 | 通过 | `pages/shop-settings/index` 显示 Fingertip Designer、10:00-22:00、默认时长 60、预约规则和“保存设置”。 | -| FM-012 | 数据导出 | 通过 | `pages/export/index` 显示订单数据、2026-06-01 至 2026-06-20、导出 Excel。 | -| FM-013 | 修改密码 | 通过 | `pages/password/index` 显示原密码、新密码、确认密码和“保存密码”。 | -| FM-014 | 关于系统 | 通过 | `pages/about/index` 显示“指尖管理师”、版本 1.0.0、定位“规划 / 客户 / 员工 / 我的”。 | -| FM-015 | 颜色设置 | 通过 | `pages/color-setting/index` 显示推荐色、色盘选择、应用、保存颜色;元素快照显示底部按钮位置接近,需要后续截图通道恢复后复核视觉重叠。 | -| FM-016 | 客户详情 | 通过 | `pages/customer-detail/index?id=1` 显示王女士、累计订单 12、累计消费 2860、历史订单纯色美甲/猫眼延长/手部护理。 | -| FM-017 | 员工详情 | 通过 | `pages/employee-detail/index?id=101` 显示小王、员工色、本月订单 32、本月营业额 5800、排班设置/请假管理/颜色设置/订单记录入口。 | -| FM-018 | 员工订单 | 通过 | `pages/employee-orders/index?id=101` 显示纯色美甲、猫眼延长、手部护理 3 条中文订单。 | - -## 本轮新增问题与环境限制 - -1. 用户小程序真实数据接口被微信 DevTools 域名限制拦截:`http://127.0.0.1:80/api` 不在合法域名列表,作品、订单、购物车、售后等登录后真实链路无法继续执行。 -2. 用户小程序微信手机号登录在当前模拟器环境不可用,页面 data 为 `wechatMiniSupported=false`。 -3. 管理师端大量页面使用本地 mock/fallback 中文数据,即页面可测,但不能证明已与后端真实订单、排班、客户数据联通。 -4. 微信 MCP 截图通道在后半段出现 `SCREENSHOT_TIMEOUT`,健康检查显示连接仍正常、`needsRecovery=false`,已用页面元素坐标、尺寸、文本和 data 快照兜底验证布局。 -5. MCP 健康检查中 `projectPath/defaultProjectPath` 曾保留用户端默认值,但 `sourceProjectPath` 和实际路由为管理师端;切换两个小程序项目时建议先完全退出开发者工具,再只启动目标项目,避免共享 `9420` 自动化端口造成项目识别混乱。 - -## 小程序补测结论 - -- 用户小程序未登录态、TabBar、首页、登录页、认证拦截链路通过;登录后真实业务链路仍被域名配置阻塞。 -- 管理师小程序主要页面、详情页、设置页和中文输入链路均已通过真实模拟器测试,未发现白屏或控制台异常。 -- 本轮控制台日志读取结果为空,未捕获小程序运行时异常。 -# 2026-06-20 后端启动后小程序阻塞复测 - -## 测试环境调整 - -- 后端 `http://127.0.0.1:80` 已有服务响应。 -- 为允许微信开发者工具模拟器访问本地 HTTP,新增用户小程序本地私有调试配置:`FD-WeChat-Fronted/project.private.config.json`,内容为 `setting.urlCheck=false`。 -- 该配置仅用于本地测试环境,未修改业务代码。 - -## 用户小程序复测结果 - -| 用例 | 模块 | 结果 | 实际结果 | -| --- | --- | --- | --- | -| MP-007-R1 | 小程序内真实后端请求 | 通过 | `wx.request` 请求 `http://127.0.0.1:80/api/product/list/page?page=1&size=2` 返回 200,拿到“布局测试作品01/02”、测试店铺、签名图片 URL。 | -| MP-009 | 首页真实数据 | 部分通过 | 首页可从后端加载门店橱窗,`bannerImages.length=1`,显示测试店铺和门店实拍;精选作品、热门推荐仍为空,`featuredItems.length=0`、`popularItems.length=0`。 | -| MP-010 | 作品列表真实数据 | 通过 | `pages/products/index` 加载 10 条作品,首条为“布局测试作品01”,总数 22,`hasMore=true`,价格和图片签名地址正常。 | -| MP-011 | 作品详情真实数据 | 通过 | `pages/product-detail/index?id=325700000000000001` 显示“布局测试作品01”、价格 99、测试店铺、2 张图片、标签和可预约信息。 | -| MP-012 | 门店详情真实数据 | 通过 | `pages/shop-detail/index?id=325517293758889984` 显示“测试店铺”、重庆地址、营业时间 05:00-22:00、门店介绍和环境图片。 | -| MP-013 | 账号密码登录 | 通过 | 通过登录页真实 `handleSubmit` 提交 `quancelianguser / 888888`,登录后回到首页,`isLoggedIn=true`,用户为“全量测试用户”。 | -| MP-014 | 购物车登录后数据 | 通过 | `pages/cart/index` 显示购物车 1 条“作品01”x2,优惠券“全量测试优惠券”可用,预估应付 ¥297.00;提示需选择美甲师和预约时间后提交订单。 | -| MP-015 | 订单列表登录后数据 | 通过 | `pages/orders/index` 加载订单数据,包含订单号 `QLTEST202606180001`、状态“待完成”、作品01、测试店铺和美甲师01。 | -| MP-016 | 订单详情登录后数据 | 通过 | `pages/order-detail/index?id=326100000000000301` 显示订单号、状态“待完成”、作品01、美甲师01、预约时间、售后记录和联系信息。 | -| MP-017 | 售后列表登录后数据 | 通过 | `pages/after-sales/index` 显示 `ASQLTEST202606180001`,类型退款,状态“审核中”,退款金额 ¥20.00,原因“全量测试售后原因”。 | -| MP-018 | 服务进度登录后数据 | 通过 | `pages/service-progress/index?orderId=326100000000000301` 显示订单创建、预约确认、服务安排、服务完成、售后/评价 5 个节点。 | - -## 本轮仍需关注的问题 - -1. 用户小程序首页精选作品和热门推荐仍为空,但作品列表接口已有 22 条数据;需要确认首页所用接口的筛选条件或推荐规则是否符合预期。 -2. 多个小程序长链路 `navigate` 步出现 MCP 等待超时,但后续路由断言和页面 data 均成功;暂记为自动化等待抖动,不作为页面失败。 -3. 微信 MCP 截图通道仍处于 `SCREENSHOT_TIMEOUT` 降级状态,本轮主要使用元素尺寸、文本和页面 data 快照作为布局证据。 -4. `FD-WeChat-Fronted/project.private.config.json` 是本地调试配置,若后续不需要本地 HTTP 测试,可以删除或保持本地不提交。 -- 2.54.0