oms/backend/package.json
liufumingren 81855f2cab fix(order): 修复状态表存在无索引记录的订单导致「列表可见但详情提示非本主体」
现象:异常/委外中/配送/已作废/已取消/历史等视图里能看到订单,
点「查看」却报「存在 1 条订单不存在或不属于当前主体」。

根因不是主体过滤缺失,而是数据不一致:
列表按状态表查询,详情按 order_index 校验主体;
历史迁移留下 25 条「状态表有行、order_index 无记录」的脏数据
(异常 8 / 委外中 5 / 配送 3 / 已作废 1 / 已取消 1 / 历史 7),
于是列表看得到、详情必然失败,报错文案又让人以为是跨主体。

改动:
- orderStatus.list:加 EXISTS(order_index) 条件,只返回索引表存在且主体一致的订单,
  杜绝同类脏数据再次「列表可见、点不开」
- 新增 scripts/repair-order-index(npm run order-index:repair):扫描各状态表补写缺失的
  索引记录(支持 --dry-run),已执行修复上述 25 条

验证:7 个视图列表与详情全部一致(pending 105 / exception 8 / outsourcing 5 / delivery 3 /
void 1 / canceled 1 / history 7,详情失败均为 0);principal=6 各视图均为 0 条;
人为插入孤儿行后列表不再显示该行。

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-11-03 03:46:00 +08:00

53 lines
1.8 KiB
JSON
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

{
"name": "oms",
"version": "1.0.0",
"description": "OMS 后端服务(Egg.js)",
"private": true,
"scripts": {
"dev": "egg-bin dev --port 6090",
"start": "egg-scripts start --daemon --title=egg-server-oms",
"stop": "egg-scripts stop --title=egg-server-oms",
"test": "npm run lint -- --fix && npm run test-local",
"test-local": "egg-bin test",
"cov": "egg-bin cov",
"lint": "eslint .",
"ci": "npm run lint && npm run cov",
"migration:up": "sequelize-cli db:migrate",
"migration:down": "sequelize-cli db:migrate:undo",
"migration:down:all": "sequelize-cli db:migrate:undo:all",
"migration:create": "sequelize-cli migration:generate --name",
"swagger:export": "node scripts/export-swagger.js",
"order-items:rebuild": "node scripts/rebuild-order-items.js",
"order-index:repair": "node scripts/repair-order-index.js",
"deploy": "npm run deploy:prod",
"deploy:prod": "npm --prefix ../tools run deploy --",
"deploy:backend": "npm --prefix ../tools run deploy:backend --",
"deploy:init": "npm --prefix ../tools run init",
"rollback": "npm run rollback:prod",
"rollback:prod": "npm --prefix ../tools run rollback --",
"rollback:backend": "npm --prefix ../tools run rollback:backend --"
},
"dependencies": {
"dotenv": "^17.4.2",
"egg": "^3.34.0",
"egg-jwt": "^3.1.7",
"egg-redis": "^2.6.1",
"egg-scripts": "^3.1.0",
"egg-sequelize": "^6.0.0",
"egg-swagger-doc": "^2.3.2",
"exceljs": "^4.4.0",
"mysql2": "^3.24.4",
"nodemailer": "^10.0.1"
},
"devDependencies": {
"egg-bin": "^6.13.0",
"egg-mock": "^5.12.0",
"eslint": "^8.57.0",
"eslint-config-egg": "^14.1.0",
"sequelize-cli": "^6.6.5"
},
"engines": {
"node": ">=16.0.0"
}
}