修复规划页错误展示和迁移发布包
This commit is contained in:
@@ -1,6 +1,16 @@
|
||||
const planningApi = require('../../api/planning')
|
||||
const dateUtil = require('../../utils/date')
|
||||
|
||||
const CALENDAR_ERROR_FALLBACK_MESSAGE = '规划数据暂时不可用,请稍后重试'
|
||||
const TECHNICAL_ERROR_PATTERNS = [
|
||||
/###\s*Error/i,
|
||||
/SQLSyntaxErrorException/i,
|
||||
/bad\s+SQL\s+grammar/i,
|
||||
/Unknown\s+column/i,
|
||||
/mapper\//i,
|
||||
/java\./i
|
||||
]
|
||||
|
||||
function canCreateAppointment() {
|
||||
const app = getApp()
|
||||
const userInfo = app.globalData.userInfo || {}
|
||||
@@ -8,7 +18,12 @@ function canCreateAppointment() {
|
||||
}
|
||||
|
||||
function resolveCalendarErrorMessage(error) {
|
||||
return error && error.message ? error.message : '规划数据加载失败'
|
||||
const message = error && error.message ? String(error.message).trim() : ''
|
||||
if (!message) {
|
||||
return CALENDAR_ERROR_FALLBACK_MESSAGE
|
||||
}
|
||||
const hasTechnicalMessage = TECHNICAL_ERROR_PATTERNS.some(pattern => pattern.test(message))
|
||||
return hasTechnicalMessage ? CALENDAR_ERROR_FALLBACK_MESSAGE : message
|
||||
}
|
||||
|
||||
function toLocalDate(value) {
|
||||
|
||||
@@ -27,8 +27,8 @@
|
||||
|
||||
.calendar-error-card {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
flex-direction: column;
|
||||
align-items: stretch;
|
||||
gap: 16rpx;
|
||||
margin-top: 18rpx;
|
||||
padding: 18rpx;
|
||||
@@ -52,15 +52,18 @@
|
||||
}
|
||||
|
||||
.calendar-error-message {
|
||||
display: block;
|
||||
color: #b06a52;
|
||||
font-size: 22rpx;
|
||||
line-height: 1.5;
|
||||
word-break: break-word;
|
||||
}
|
||||
|
||||
.calendar-error-action {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
align-self: flex-end;
|
||||
width: 96rpx;
|
||||
min-width: 96rpx;
|
||||
height: 52rpx;
|
||||
|
||||
@@ -874,3 +874,10 @@ messagehub:
|
||||
- 2026-07-20 已删除旧 `JayuCloud` namespace,并清理旧 tenant 下残留的 `core.yaml`、`gateway.yaml`、`infra.yaml`、`secret.yaml`、`logging.yaml`;旧 tenant 下 `datasource.yaml` 原本不存在。
|
||||
- 生产对象存储 bucket 命名统一为小写:MinIO `minio.bucket-name=jayucloud`,七牛 `qiniu.kodo.bucket-name=jayucloud`,阿里云 OSS `aliyun.oss.bucket-name=jayucloud`。
|
||||
- 生产三台 Nacos 节点 `192.168.5.101`、`192.168.5.102`、`192.168.10.145` 均已复核:旧 `JayuCloud` / `jayuCloud` 相关 dataId 返回 `404`,当前 `jayu-cloud` 六个生产 dataId 返回 `200`。
|
||||
|
||||
### 2026-07-21 版本迁移 SQL 发布包携带规则
|
||||
|
||||
- `scripts/package-release.ps1` 的发布压缩包会同时携带根目录 `JayuCloud.sql` 和 `migrations/` 目录。
|
||||
- `scripts/deploy-jayu-cloud-production.ps1` 生成的发布目录会在 `sql/migrations/` 中保留仓库的版本迁移 SQL。
|
||||
- `JayuCloud.sql` 仍仅用于空库初始化;已有数据库遇到字段缺失时,按对应功能执行 `scripts/sql/migrations/` 下的幂等迁移脚本,不回写初始化 SQL。
|
||||
- 当前规划页 `appointment_product_title` 缺列问题,对应脚本为 `scripts/sql/migrations/预约作品快照/预约作品快照字段_20260721.sql`。
|
||||
|
||||
@@ -251,3 +251,11 @@
|
||||
- 数据库变更:新增 `scripts/sql/migrations/预约作品快照/预约作品快照字段_20260721.sql`,为 `t_order_item` 增加预约作品快照相关幂等列,并将 `product_id` 调整为可空以支持仅保存预约作品快照;不修改初始化 SQL。
|
||||
- 影响范围:影响 `JY-Core` 预约创建、预约修改、预约详情、预约图片维护和改派权限;影响 `JY-Salon-WeChat` 预约表单、预约详情及标签/规划接口封装。
|
||||
- 验证方式:`PlanningServiceImplTest` 通过 12 个用例;`JayuCloudSqlSchemaTest` 通过;小程序变更 JS 执行 Node 24 `--check` 通过;`git diff --check` 通过;GitNexus `detect_changes -r JayuCloud --scope unstaged` 结果为 low,影响流程 0。
|
||||
|
||||
## 2026-07-21 规划页数据库异常展示与迁移发布包修正
|
||||
|
||||
- 变更原因:店务小程序规划页加载时,当前数据库缺少 `t_order_item.appointment_product_title`,后端返回 MyBatis/SQL 技术异常,小程序错误卡片直接展示原始异常并导致重试按钮与长文本重叠。
|
||||
- 处理方式:规划页将 SQL、Mapper、Java 异常等技术文案统一收敛为“规划数据暂时不可用,请稍后重试”,错误卡片改为纵向布局;发布打包脚本和生产部署发布目录同步携带 `scripts/sql/migrations/`,避免发布产物只包含初始化 SQL。
|
||||
- 数据库说明:本次未新增 SQL;需执行已存在的 `scripts/sql/migrations/预约作品快照/预约作品快照字段_20260721.sql` 才能补齐当前报错字段。
|
||||
- 影响范围:影响 `JY-Salon-WeChat` 规划页错误展示、`scripts/package-release.ps1` 和 `scripts/deploy-jayu-cloud-production.ps1` 的发布产物内容;不修改初始化 SQL。
|
||||
- 验证方式:执行小程序规划页 JS 语法检查、发布脚本 PowerShell 解析检查、`git diff --check` 和 GitNexus `detect_changes`。
|
||||
|
||||
@@ -216,3 +216,11 @@
|
||||
- 处理方式:登录页 `onLoad` 先读取本地 session,确认存在 accessToken 且 userInfo.shopId 后,同步 app session 并 `reLaunch` 到规划页;没有可用 session 时才展示登录表单。
|
||||
- 以后避免:把登录页作为首屏的小程序或前端入口,必须在登录页自身实现有效 session 的自动跳转,不能只依赖全局启动恢复。
|
||||
- 验证方式:本地已有有效 session 时打开登录页应直接进入规划页;session 过期时业务页请求返回 401 后再清理登录态并回到登录页。
|
||||
|
||||
## 2026-07-21 预约快照字段代码发布后必须执行对应迁移
|
||||
|
||||
- 问题:规划页接口查询 `t_order_item.appointment_product_title` 时,当前运行库缺少该列,后端返回 `Unknown column 'appointment_product_title' in 'field list'`。
|
||||
- 原因:预约作品快照字段已经通过版本迁移 SQL 提交,但当前数据库没有执行 `scripts/sql/migrations/预约作品快照/预约作品快照字段_20260721.sql`;发布产物此前也只携带初始化 SQL,不便于一起交付迁移脚本。
|
||||
- 处理方式:发布包和生产部署发布目录携带 `scripts/sql/migrations/`;规划页遇到 SQL/MyBatis/Java 技术异常时只显示业务提示。
|
||||
- 以后避免:后端代码引用新增字段时,发布和验收必须同步校验目标库已执行对应迁移;发布包必须带出版本迁移目录,不能只带初始化 SQL。
|
||||
- 验证方式:上线前查询 `information_schema.columns` 确认目标列存在;规划页接口失败时小程序不得展示原始 SQL 或 Mapper 路径。
|
||||
|
||||
+11
-11
@@ -2,26 +2,26 @@
|
||||
|
||||
## 当前任务
|
||||
|
||||
改造店务小程序预约作品选择、预约作品图片展示/修改,并限制改派仅店长可用。
|
||||
修复店务小程序规划页数据库异常展示混乱,并排查 `appointment_product_title` 缺列来源。
|
||||
|
||||
## 已完成
|
||||
|
||||
- 后端预约创建不再为手动作品新增隐藏作品库记录,改为保存订单项预约作品快照。
|
||||
- 后端预约详情返回预约作品描述、标签、注意事项、图片文件 ID 和图片 URL。
|
||||
- 后端新增预约图片更新接口,并将店务/规划改派入口限制为店长。
|
||||
- 店务小程序预约表单改为“选择作品”弹窗,模板列表移入“使用已有作品模板”抽屉,标签改为店铺标签下拉,图片上传改为加号入口。
|
||||
- 店务小程序预约详情新增作品图片展示、上传、重传、删除和预览。
|
||||
- 已更新服务层测试和项目变更记录。
|
||||
- 已通过 `PlanningServiceImplTest`、`JayuCloudSqlSchemaTest`、小程序 JS 语法检查、`git diff --check` 和 GitNexus `detect_changes`。
|
||||
- 已确认缺列对应的版本迁移 SQL 已存在:`scripts/sql/migrations/预约作品快照/预约作品快照字段_20260721.sql`。
|
||||
- 已确认当前报错原因是运行库尚未执行上述迁移,而不是本次需要新增 SQL。
|
||||
- 已将规划页 MyBatis、SQL、Java 类技术异常收敛为业务提示,避免原始异常撑乱页面。
|
||||
- 已将规划页错误卡片改为纵向布局,重试按钮不再覆盖长文本。
|
||||
- 已让发布打包脚本和生产部署发布目录携带 `scripts/sql/migrations/`。
|
||||
- 已更新 `docs/项目变更记录.md` 和 `docs/运维配置与集成说明.md`。
|
||||
|
||||
## 下一步
|
||||
|
||||
- 最终复查 diff,暂存本次任务相关文件并创建中文提交。
|
||||
- 运行语法检查、diff 检查和 GitNexus 变更检测。
|
||||
- 只暂存本次任务相关文件并创建中文提交。
|
||||
|
||||
## 当前阻塞点
|
||||
|
||||
- 无。
|
||||
- 未连接真实数据库执行迁移;需要明确目标环境后再执行已存在的预约作品快照迁移 SQL。
|
||||
|
||||
## 最近一次重要操作结果
|
||||
|
||||
2026-07-21 验证通过,GitNexus `detect_changes -r JayuCloud --scope unstaged` 结果为 low,影响流程 0。
|
||||
2026-07-21 已完成代码、脚本和文档修改,待验证。
|
||||
|
||||
@@ -47,6 +47,7 @@ $frontendDir = Join-Path $releaseDir "frontend"
|
||||
$sqlDir = Join-Path $releaseDir "sql"
|
||||
$manifestPath = Join-Path $releaseDir "manifest.json"
|
||||
$defaultInitSqlPath = Join-Path $resolvedRepoRoot "scripts\sql\init\JayuCloud.sql"
|
||||
$migrationSqlRoot = Join-Path $resolvedRepoRoot "scripts\sql\migrations"
|
||||
if (-not $InitSqlPath) {
|
||||
$InitSqlPath = $defaultInitSqlPath
|
||||
}
|
||||
@@ -513,7 +514,7 @@ function Build-ReleasePackage {
|
||||
$gatewayJar = Join-Path $resolvedRepoRoot "JY-Gateway\target\JY-Gateway.jar"
|
||||
$frontendDist = Join-Path $resolvedRepoRoot "JY-Artist-Frontend\dist"
|
||||
$managerMobileDist = Join-Path $resolvedRepoRoot "JY-Salon-Front\dist"
|
||||
foreach ($requiredPath in @($coreJar, $gatewayJar, $frontendDist, $managerMobileDist, $InitSqlPath)) {
|
||||
foreach ($requiredPath in @($coreJar, $gatewayJar, $frontendDist, $managerMobileDist, $InitSqlPath, $migrationSqlRoot)) {
|
||||
if (-not (Test-Path -LiteralPath $requiredPath)) {
|
||||
throw "缺少发布产物:$requiredPath"
|
||||
}
|
||||
@@ -523,9 +524,11 @@ function Build-ReleasePackage {
|
||||
$gatewayArtifact = Join-Path $backendDir "JY-Gateway.jar"
|
||||
$frontendArtifact = Join-Path $frontendDir "jy-artist-frontend-dist.tar.gz"
|
||||
$sqlArtifact = Join-Path $sqlDir "JayuCloud.sql"
|
||||
$migrationSqlArtifact = Join-Path $sqlDir "migrations"
|
||||
Copy-Item -LiteralPath $coreJar -Destination $coreArtifact -Force
|
||||
Copy-Item -LiteralPath $gatewayJar -Destination $gatewayArtifact -Force
|
||||
Copy-Item -LiteralPath $InitSqlPath -Destination $sqlArtifact -Force
|
||||
Copy-Item -LiteralPath $migrationSqlRoot -Destination $migrationSqlArtifact -Recurse -Force
|
||||
|
||||
$tar = Get-Command tar -ErrorAction SilentlyContinue
|
||||
if (-not $tar) {
|
||||
@@ -560,6 +563,7 @@ function Build-ReleasePackage {
|
||||
GatewayJar = $gatewayArtifact
|
||||
FrontendArchive = $frontendArtifact
|
||||
InitSql = $sqlArtifact
|
||||
MigrationSql = $migrationSqlArtifact
|
||||
Hashes = @($hashes)
|
||||
Git = $GitState
|
||||
}
|
||||
|
||||
@@ -13,6 +13,7 @@ $backendDir = Join-Path $releaseDir "backend"
|
||||
$frontendDir = Join-Path $releaseDir "frontend"
|
||||
$miniProgramDir = Join-Path $releaseDir "miniprograms"
|
||||
$sqlPath = Join-Path $repoRoot "scripts\sql\init\JayuCloud.sql"
|
||||
$migrationSqlRoot = Join-Path $repoRoot "scripts\sql\migrations"
|
||||
|
||||
function Resolve-Maven {
|
||||
param([string]$PreferredPath)
|
||||
@@ -131,6 +132,7 @@ Copy-Directory $managerMobileDist (Join-Path $frontendDir "dist\jy-salon-front")
|
||||
Copy-Directory (Join-Path $repoRoot "JY-Artist-WeChat") (Join-Path $miniProgramDir "JY-Artist-WeChat")
|
||||
Copy-Directory (Join-Path $repoRoot "JY-Salon-WeChat") (Join-Path $miniProgramDir "JY-Salon-WeChat")
|
||||
Copy-RequiredFile $sqlPath (Join-Path $releaseDir "JayuCloud.sql")
|
||||
Copy-Directory $migrationSqlRoot (Join-Path $releaseDir "migrations")
|
||||
|
||||
$manifest = @(
|
||||
"# JayuCloud Release $timestamp",
|
||||
@@ -144,9 +146,11 @@ $manifest = @(
|
||||
"- miniprograms/JY-Artist-WeChat",
|
||||
"- miniprograms/JY-Salon-WeChat",
|
||||
"- JayuCloud.sql",
|
||||
"- migrations",
|
||||
"",
|
||||
"Nacos namespace: jayu-cloud",
|
||||
"Database initialized by: scripts/sql/init/JayuCloud.sql",
|
||||
"Database migrations by: scripts/sql/migrations",
|
||||
"Database name: jayu_cloud",
|
||||
"Manager mini program API: https://yunail.art/api/admin",
|
||||
"Manager mobile web: https://yunail.art/jy-salon-front/"
|
||||
|
||||
Reference in New Issue
Block a user