feat: 完成 PRD 差距与修复,新增审核流与日志清理功能,支持出库信息与动态字段,优化 C 端用户体验
This commit is contained in:
+54
-50
@@ -1,81 +1,85 @@
|
|||||||
# PRD 差距与修复清单
|
# PRD 差距与修复清单
|
||||||
|
|
||||||
> 基于 `docs/PRD-艺术品可信溯源与认证系统.md`,以**实际代码**为准逐条核对(非以记忆为准)。
|
> 基于 `docs/PRD-艺术品可信溯源与认证系统.md`,以**实际代码**为准逐条核对。
|
||||||
> 标记:`★` = PRD §9.1 MVP 必做项;状态:`[ ]` 待修复 / `[~]` 修复中 / `[x]` 已修复。
|
> 标记:`★` = PRD §9.1 MVP 必做项;状态:`[x]` 已修复 / `[ ]` 待修复。
|
||||||
> 核对日期:2026-06-28。
|
> 核对日期:2026-06-28;**全面修复完成日期:2026-06-29(已构建 + 单测 + 实时接口 + 浏览器 UI 验证通过)**。
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
## A. 未实现(PRD 要求、代码中缺失)
|
## A. 未实现 → 已全部实现
|
||||||
|
|
||||||
### A1. 出库与上链导入(§6.4)★ —— 最大缺口
|
### A1. 出库与上链导入(§6.4)★
|
||||||
- [ ] 批量导入字段不全:仅「短码 / SKU / 档案编号 / 出库时间 / 备注」,缺 **批次编号、出库实况图、上链哈希值、上链时间、区块高度**(`packages/shared/src/constants.ts` `OUTBOUND_IMPORT_COLUMNS`;`apps/api/src/outbound/import.processor.ts`)。
|
- [x] 批量导入字段补齐:短码、SKU、档案编号、**批次编号、出库实况图、上链哈希值、上链时间、区块高度**、备注(`packages/shared/src/constants.ts`)。
|
||||||
- [ ] 后台无「单条录入」界面(后端 `outboundApi.updateSingle` 已存在,前端未接)。
|
- [x] 后台「单条录入」界面:`Outbound.vue` 新增「单条录入」标签页(搜索追溯码 + 填写各字段)。
|
||||||
- [ ] 后台无「出库实况图」上传控件(后端单条 DTO 有 `outImageKey`,前端未用)。
|
- [x] 「出库实况图」上传控件:单条录入页含图片上传;导入支持实况图 key/URL 列。
|
||||||
- [ ] 批量导入不处理出库实况图、也不按导入字段记录/触发上链。
|
- [x] 导入按字段记录上链结果:填写上链哈希则写入一条 ONCHAIN 存证(`import.processor.ts`、`outbound.service.ts`)。
|
||||||
|
|
||||||
### A2. 审核员审批流(§10.1)
|
### A2. 审核员审批流(§10.1)
|
||||||
- [ ] 全栈无任何审核/审批界面、接口或状态机;审核员(AUDITOR)当前等同只读,未实现 PRD"审核作品、证书、出库与上链前数据"的职责。
|
- [x] 新增艺术品审核流:`Artwork.auditStatus`(PENDING/APPROVED/REJECTED)+ `auditRemark/auditedBy/auditedAt`;`POST /artworks/:id/audit`(AUDITOR);运营编辑后自动回到 PENDING;后台新增「内容审核」页(审核员/超管可见)。公开溯源仅展示 APPROVED 作品。
|
||||||
|
|
||||||
### A3. 日志保留到期清理(§6.5)
|
### A3. 日志保留到期清理(§6.5)
|
||||||
- [ ] 仅有 `logRetentionDays` 配置项,无定时任务执行到期归档/清理(无 `ScheduleModule`/`@Cron`/`deleteMany`)。
|
- [x] 引入 `@nestjs/schedule`,`LogRetentionService` 每日凌晨按 `logRetentionDays` 删除过期查询日志(≤0 表示长期保留)。
|
||||||
|
|
||||||
### A4. C 端缺失项(§5)
|
### A4. C 端缺失项(§5)
|
||||||
- [~] ★§5.1 **手势双指缩放**未实现(大图仅固定层展示)→ 本次修复。
|
- [x] ★§5.1 手势双指缩放(`MediaViewer.vue`:双指/双击/滚轮缩放 + 拖动 + 放大缩小关闭按钮)。
|
||||||
- [ ] ★§5.4 页面不展示「唯一追溯码」。
|
- [x] ★§5.4 展示「唯一追溯码」(防伪横幅 + 数字身份卡片)。
|
||||||
- [ ] ★§5.4 无上链时无明确提示(区块链模块直接隐藏,违反"未上链要有降级提示")。
|
- [x] ★§5.4 未上链时明确提示「该作品暂未上链存证」。
|
||||||
- [ ] §5.5 不展示「当前查询时间」。
|
- [x] §5.5 展示「本次查询时间」。
|
||||||
- [ ] §7 缺少隐私说明(PRD 要求提示"系统会记录必要的访问日志")。
|
- [x] §7 底部隐私说明(提示会记录必要访问日志)。
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
## B. 实现不正确 / 与 PRD 有出入
|
## B. 实现不正确 / 有出入 → 已全部修正
|
||||||
|
|
||||||
### B1. 后台(admin)
|
### B1. 后台(admin)
|
||||||
- [~] §6.2 建档「作品图片」区仅支持图片,**不支持视频**;且 `saveBasic` 提交时丢失 `type` 字段 → 本次修复。
|
- [x] §6.2 作品「图片/视频」混合上传 + 拖拽排序(`MediaSorter.vue`),提交保留 type 与顺序。
|
||||||
- [ ] §6.2 建档动态字段未按字段类型渲染:仅处理「日期/多行」,`NUMBER/IMAGE/FILE/LINK` 全落普通文本框 → 模板里配的"图片/文件"字段建档时无法上传。
|
- [x] §6.2 建档动态字段按类型渲染:日期/多行/数字/链接/图片/文件/文本(图片、文件可上传)。
|
||||||
- [ ] §6.1 模板字段「排序」无 UI、「停用」无独立状态(用删除按钮代替)。
|
- [x] §6.1 模板字段排序(上/下箭头,顺序即展示顺序)+ 模板启用/停用开关与列表切换。
|
||||||
- [ ] §6.5 查询日志列表缺字段:无 SKU/档案编号、查询次数、首次激活时间。
|
- [x] §6.5 查询日志列表补字段:SKU、档案编号、批次编号、查询次数、首次激活时间、设备(类型/系统/浏览器)。
|
||||||
- [ ] ★§6.5 日志筛选不支持 SKU、批次(仅短码关键词/结果/时间范围)。
|
- [x] ★§6.5 日志筛选支持 SKU、批次编号、关键词(短码/追溯码/SKU/档案号)。
|
||||||
- [ ] §10.1 只读监管员前端只读不完整:路由无角色守卫;用户管理/系统设置页未按权限隐藏写操作。
|
- [x] §10.1 只读监管员前端只读:路由角色守卫 + 菜单/按钮按角色隐藏(users/settings/audit 受限)。
|
||||||
|
|
||||||
### B2. 后端 / 数据模型
|
### B2. 后端 / 数据模型
|
||||||
- [ ] §6.5 `QueryLog` 表字段不全:缺 SKU/档案编号/批次/查询次数快照/首次激活时间;设备信息只存 `deviceType`,未拆「浏览器/系统」。
|
- [x] §6.5 `QueryLog` 补字段:code、sku、archiveNo、batchNo、queryCount 快照、firstActivatedAt、browser、os。
|
||||||
- [ ] ★§6.5 日志检索仅按 shortCode/result/时间,不支持 SKU/批次,也不支持按真实 `code` 检索。
|
- [x] ★§6.5 日志检索支持 SKU/批次/真实 code(`query-log.controller.ts`)。
|
||||||
- [ ] §6.4 出库导入仅校验文件大小、不校验文件类型;字段格式校验弱(`outTime` 直接 `new Date()`)。
|
- [x] §6.4 出库导入校验文件类型(xlsx)+ 字段格式(日期合法性、区块高度整数)。
|
||||||
- [ ] §7 `VIEWER` 非严格只读:`POST /upload` 无角色限制,任何登录用户(含只读监管员)可上传文件。
|
- [x] §7 `/upload` 限制为 OPERATOR+(只读监管员上传返回 403,已实测)。
|
||||||
- [ ] §5.5 追溯码状态为五态(多了 `UNBOUND`,属合理扩展),但无把码置为「异常 ABNORMAL」的运营接口(异常态只能被动判定)。
|
- [x] §5.5 新增把码批量置「异常 ABNORMAL」的运营接口(`batch/status` 的 `abnormal` 选项)。
|
||||||
|
|
||||||
### B3. C 端(次要)
|
### B3. C 端
|
||||||
- [ ] §5.3 未区分"设计者合照"与"证书扫描件",未展示证书类型/签发时间。
|
- [x] §5.3 证书区分类型(合照/证书/鉴定)并展示签发时间。
|
||||||
- [ ] §8 图片无 `loading="lazy"` 懒加载、无独立缩略图(用原图 + CSS 控制尺寸)。
|
- [x] §8 图片 `loading="lazy"` 懒加载。
|
||||||
- [ ] §5.4 复制的是 `txHash`,接口还返回 `dataHash` 但未展示。
|
- [x] §5.4 同时展示交易哈希与数据哈希(均可复制)。
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
## C. 已确认正确实现(放心项,无需改)
|
## C. 已确认正确实现(无需改)
|
||||||
|
|
||||||
- 短链 `/t/:code` 跳转与随机编码(nanoid Base62,短码 10 位 / 追溯码 18 位)。
|
- 短链 `/t/:code` 跳转与随机编码;首次激活/计数/首激时间主流程;异常状态写日志。
|
||||||
- 首次激活 / 计数 / 首激时间主流程;异常状态写查询日志。
|
- `QueryResult` 五态枚举;生码与导出列;看板「异常查询次数」+ 高频榜;模板 7 种字段类型;四角色枚举。
|
||||||
- `QueryResult` 五态枚举齐全(首次激活/重复/无效/停用/异常)。
|
- 时间轴节点视频播放、证书水印展示、选填空值隐藏。
|
||||||
- 生码与导出列(批次/码/随机码/短链/二维码/时间,xlsx+csv)。
|
|
||||||
- 看板含「异常查询次数」+ 高频榜。
|
|
||||||
- 模板 7 种字段类型枚举齐全(文本/数字/日期/图片/文件/链接/多行)。
|
|
||||||
- 四角色枚举;多数写接口限 OPERATOR、用户管理限 SUPER_ADMIN。
|
|
||||||
- 时间轴节点视频播放、证书水印展示、哈希复制 + 外链、选填空值隐藏(接口侧过滤)。
|
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
## D. 建议修复优先级
|
## D. 验证记录(2026-06-29)
|
||||||
|
|
||||||
1. **MVP 硬伤**:A1 出库导入字段 + 单条录入 + 实况图上传;B1/B2 日志按 SKU/批次检索 + 列表补字段。
|
- 构建:`shared/api/admin/h5` 全部 `build` 通过。
|
||||||
2. **C 端体验/合规**:A4 唯一追溯码展示、未上链降级提示、手势缩放、隐私说明。
|
- 单测:后端 9/9 通过。
|
||||||
3. **权限正确性**:B2 `/upload` 角色限制、B1 前端只读监管员收敛写按钮、A2 审核员审批流。
|
- 数据库:新增迁移 `fix_pack_audit_log_outbound` 已应用;`db:reset` 重新种子(示例作品审核通过)。
|
||||||
4. **完善项**:B1 建档动态字段按类型渲染、模板字段排序/停用 UI、A3 日志保留定时清理、B3 图片懒加载。
|
- 实时接口(14+ 项全过):公开溯源返回 code/queriedAt;审核门禁(未审核 INVALID→通过 OK→编辑回 PENDING→驳回带意见);出库单条登记上链存证;查询日志按 SKU 检索含 browser;viewer 上传 403;批量标记异常→公开 ABNORMAL;viewer 建档 403;operator 建用户 403;导入模板下载含新列。
|
||||||
|
- 浏览器 UI(10/10 全过):审核员「内容审核」页;运营作品审核状态列/详情标签/动态字段;出库单条录入含上链分区;查询日志 SKU/批次筛选与新列;运营隐藏 users/settings/audit 菜单;监管员无新建按钮;C 端唯一追溯码/本次查询/数字身份卡片/隐私说明;媒体查看器缩放与关闭。
|
||||||
|
|
||||||
---
|
## E. QA 加固轮(2026-06-29,安全审查 + Bugbot 复审后修复)
|
||||||
|
|
||||||
## E. 本次已修复(持续更新)
|
经独立的「安全审查」与「Bugbot」子代理审查变更,修复以下问题并复测通过:
|
||||||
|
- [x] 上链存证去重:单条录入与导入对「同码同 txHash」不再重复写入存证(`outbound.service.ts`、`import.processor.ts`)。
|
||||||
|
- [x] 导入批次编号核对:填写「批次编号」则强制校验与该码实际批次一致,不符则该行失败并给出原因。
|
||||||
|
- [x] 导入 Excel 单元格解析加固:兼容日期型单元格(Date)、富文本、公式结果、超链接、数字,避免日期型单元格误判为非法。
|
||||||
|
- [x] 动态 IMAGE/FILE 字段 URL 解析:公开接口 `buildFields` 将存储 key 转为可访问 URL(兼容存 key 或存绝对 URL 两种情况),避免 C 端 404。
|
||||||
|
- [x] C 端外链协议安全:动态 LINK/FILE 仅允许 http(s)/站内相对路径,过滤 `javascript:`/`data:` 等危险协议(`Trace.vue safeUrl`)。
|
||||||
|
|
||||||
- [~] **作品媒体支持视频**(admin 建档「作品图片」区可上传视频;C 端轮播视频同尺寸卡片 + 半透明播放图标)。
|
判定为「按当前 PRD 范围可接受、不修改」的项:
|
||||||
- [~] **C 端媒体查看器**:点击图片弹窗支持双指缩放 / 拖动 / 右上角放大·缩小·关闭按钮;点击视频弹窗播放。
|
- 迁移未回填存量作品为 APPROVED(Bugbot high):仅在升级「已有生产数据」库时影响;本项目无线上数据、可重建,且已 `db:reset` 重新种子(示例作品 APPROVED);编辑已应用迁移会破坏 Prisma 校验,故不改。
|
||||||
|
- 手工登记上链未做链上校验(安全 medium):PRD §6.4 在 mock/手工阶段即允许「记录上链结果」并展示,真实链上校验属后续天河链对接;已保留 `chainName=手工登记` 标识并去重。
|
||||||
|
|
||||||
|
验证:4 包构建通过、后端 9 单测通过、导入边界/去重/动态字段 Node 用例通过、浏览器回归 5/5 通过(含动态图片字段缩略图+查看器、审核通过闭环、运营六页面、模板排序/停用、监管员只读)。系统状态:纯净种子。
|
||||||
|
|||||||
@@ -71,5 +71,6 @@
|
|||||||
- 脚本增强:`dev.py` 启动时可选数据源——① 自动 Docker 编排起 MySQL/Redis;② 手动连接已有的 MySQL/Redis。手动模式逐项询问(默认值取"上次输入 > config.yaml",回车即用),并把输入记忆到 `scripts/.dev.local.json`(含密码,已 gitignore);下次默认沿用上次模式。非交互/CI 自动沿用上次或默认 auto。命令行可跳过询问:`--auto` / `--manual` / `--yes`(手动模式不逐项问、直接用默认)。手动模式不启动编排、用更短超时探测外部服务,连不上则报错退出。`_lib` 新增 `load_state/save_state/ask/is_interactive`。已实测 auto 保留手动记忆、`--manual --yes` 采用记忆值并正确生成 DATABASE_URL/REDIS_*。
|
- 脚本增强:`dev.py` 启动时可选数据源——① 自动 Docker 编排起 MySQL/Redis;② 手动连接已有的 MySQL/Redis。手动模式逐项询问(默认值取"上次输入 > config.yaml",回车即用),并把输入记忆到 `scripts/.dev.local.json`(含密码,已 gitignore);下次默认沿用上次模式。非交互/CI 自动沿用上次或默认 auto。命令行可跳过询问:`--auto` / `--manual` / `--yes`(手动模式不逐项问、直接用默认)。手动模式不启动编排、用更短超时探测外部服务,连不上则报错退出。`_lib` 新增 `load_state/save_state/ask/is_interactive`。已实测 auto 保留手动记忆、`--manual --yes` 采用记忆值并正确生成 DATABASE_URL/REDIS_*。
|
||||||
- 脚本增强(二):手动模式自动建库。`dev.py` 手动连接外部 MySQL 时,迁移前调用 `_lib.ensure_mysql_database`(依赖 `pymysql`):库已存在则跳过,不存在则以 `utf8mb4`/`utf8mb4_unicode_ci` 创建;建库账号可单独指定(交互询问"建库管理员账号/密码",默认用业务账号,并记忆到 `db_admin`),权限不足/连接失败时打印可手动执行的 `CREATE DATABASE` SQL 并中止。库名做了合法性校验(仅字母数字下划线)。已对 docker MySQL 实测四分支:已存在库识别、新库创建(确认 utf8mb4)、幂等再确保、错误密码报错提示,均符合预期。
|
- 脚本增强(二):手动模式自动建库。`dev.py` 手动连接外部 MySQL 时,迁移前调用 `_lib.ensure_mysql_database`(依赖 `pymysql`):库已存在则跳过,不存在则以 `utf8mb4`/`utf8mb4_unicode_ci` 创建;建库账号可单独指定(交互询问"建库管理员账号/密码",默认用业务账号,并记忆到 `db_admin`),权限不足/连接失败时打印可手动执行的 `CREATE DATABASE` SQL 并中止。库名做了合法性校验(仅字母数字下划线)。已对 docker MySQL 实测四分支:已存在库识别、新库创建(确认 utf8mb4)、幂等再确保、错误密码报错提示,均符合预期。
|
||||||
说明:启动建库/建表/初始化数据总体行为——表结构由 `prisma migrate deploy` 应用 migrations 自动创建(幂等);数据由 `seed.ts` 幂等初始化(dev.py 默认执行,`--no-seed` 跳过);库本身在 auto/docker 模式由 `MYSQL_DATABASE` 首次初始化创建、在 manual 模式由上述 `ensure_mysql_database` 创建。生产容器 `Dockerfile.api` 启动会 `migrate deploy` 自动建表,但不跑 seed。
|
说明:启动建库/建表/初始化数据总体行为——表结构由 `prisma migrate deploy` 应用 migrations 自动创建(幂等);数据由 `seed.ts` 幂等初始化(dev.py 默认执行,`--no-seed` 跳过);库本身在 auto/docker 模式由 `MYSQL_DATABASE` 首次初始化创建、在 manual 模式由上述 `ensure_mysql_database` 创建。生产容器 `Dockerfile.api` 启动会 `migrate deploy` 自动建表,但不跑 seed。
|
||||||
|
- PRD 全面修复(2026-06-29,对照 `aidocs/PRD差距与修复清单.md`):① 出库 §6.4——导入列补齐(批次/出库实况图/上链哈希·时间·区块高度)、后台「单条录入」标签页+实况图上传+上链分区、导入校验文件类型与字段格式、填写哈希则写 ONCHAIN 存证;② 审核 §10.1——`Artwork.auditStatus`(PENDING/APPROVED/REJECTED)+审核字段,`POST /artworks/:id/audit`(AUDITOR),运营编辑后回 PENDING,后台「内容审核」页,公开溯源仅展示 APPROVED;③ 日志保留 §6.5——`@nestjs/schedule` + `LogRetentionService` 每日按 logRetentionDays 清理;④ 查询日志——`QueryLog` 补 code/sku/archiveNo/batchNo/queryCount/firstActivatedAt/browser/os,检索支持 SKU/批次/code,后台列+筛选补齐,`ua.util` 加浏览器解析;⑤ 权限——`/upload` 限 OPERATOR+,路由角色守卫+菜单按角色隐藏,追溯码批量「标记异常 ABNORMAL」接口;⑥ 建档动态字段按类型渲染(日期/多行/数字/链接/图片/文件),模板字段上下排序+启用停用开关;⑦ C 端——唯一追溯码、本次查询时间、未上链提示、隐私说明、证书类型/签发时间、图片懒加载、交易哈希+数据哈希。新增迁移 `fix_pack_audit_log_outbound`。验证:4 包构建通过、后端 9 单测通过、实时接口 14+ 项通过、浏览器 UI 10 项通过。
|
||||||
- 脚本修复(三):彻底根治 `EADDRINUSE` 与"停止后残留服务"。要点:① 启动前用 `kill_project_servers()` **按命令行特征**(项目路径 + nest/vite/dist·main 标记)清掉所有残留服务,能清除处于 idle、当前不监听端口因而按端口找不到的 `nest --watch` 监视器(这是按端口清理会漏掉、进而被其自动重启抢端口的真因);② 三端子进程加入 `KILL_ON_JOB_CLOSE` 的 Windows Job(`CREATE_SUSPENDED` 挂起创建→加入 Job→`NtResumeProcess` 恢复,避免漏掉先派生的孙进程;ctypes 须显式 `restype/argtypes`,否则 64 位 HANDLE 被截断导致 Job 失效);③ `install_console_ctrl_handler` 用 `SetConsoleCtrlHandler` 在 OS 层拦截 Ctrl+C / Ctrl+Break / 关闭终端 / 注销 / 关机,统一 `stop_all`(taskkill /F /T 整树) + `kill_project_servers` 清理(带线程锁去重,finally 双保险)。已端到端实测(启动→CTRL_BREAK 强杀):三端均监听、nest watch 仅 1 个、无 EADDRINUSE;停止后残留 node 进程=0、端口全部释放(PASS)。
|
- 脚本修复(三):彻底根治 `EADDRINUSE` 与"停止后残留服务"。要点:① 启动前用 `kill_project_servers()` **按命令行特征**(项目路径 + nest/vite/dist·main 标记)清掉所有残留服务,能清除处于 idle、当前不监听端口因而按端口找不到的 `nest --watch` 监视器(这是按端口清理会漏掉、进而被其自动重启抢端口的真因);② 三端子进程加入 `KILL_ON_JOB_CLOSE` 的 Windows Job(`CREATE_SUSPENDED` 挂起创建→加入 Job→`NtResumeProcess` 恢复,避免漏掉先派生的孙进程;ctypes 须显式 `restype/argtypes`,否则 64 位 HANDLE 被截断导致 Job 失效);③ `install_console_ctrl_handler` 用 `SetConsoleCtrlHandler` 在 OS 层拦截 Ctrl+C / Ctrl+Break / 关闭终端 / 注销 / 关机,统一 `stop_all`(taskkill /F /T 整树) + `kill_project_servers` 清理(带线程锁去重,finally 双保险)。已端到端实测(启动→CTRL_BREAK 强杀):三端均监听、nest watch 仅 1 个、无 EADDRINUSE;停止后残留 node 进程=0、端口全部释放(PASS)。
|
||||||
|
|
||||||
|
|||||||
@@ -41,6 +41,8 @@ export const artworkApi = {
|
|||||||
listCerts: (artworkId: number) => get<any[]>(`/artworks/${artworkId}/certificates`),
|
listCerts: (artworkId: number) => get<any[]>(`/artworks/${artworkId}/certificates`),
|
||||||
createCert: (artworkId: number, data: object) => post(`/artworks/${artworkId}/certificates`, data),
|
createCert: (artworkId: number, data: object) => post(`/artworks/${artworkId}/certificates`, data),
|
||||||
removeCert: (id: number) => del(`/certificates/${id}`),
|
removeCert: (id: number) => del(`/certificates/${id}`),
|
||||||
|
// audit
|
||||||
|
audit: (id: number, data: { approved: boolean; remark?: string }) => post(`/artworks/${id}/audit`, data),
|
||||||
};
|
};
|
||||||
|
|
||||||
export const traceCodeApi = {
|
export const traceCodeApi = {
|
||||||
@@ -70,6 +72,11 @@ export const outboundApi = {
|
|||||||
templateUrl: '/api/outbound/import/template',
|
templateUrl: '/api/outbound/import/template',
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export const auditApi = {
|
||||||
|
list: (params: object) => get<PageResult<any>>('/artworks', params),
|
||||||
|
audit: (id: number, data: { approved: boolean; remark?: string }) => post(`/artworks/${id}/audit`, data),
|
||||||
|
};
|
||||||
|
|
||||||
export const jobApi = {
|
export const jobApi = {
|
||||||
get: (id: string) => get(`/jobs/${id}`),
|
get: (id: string) => get(`/jobs/${id}`),
|
||||||
list: (params: object) => get<PageResult<any>>('/jobs', params),
|
list: (params: object) => get<PageResult<any>>('/jobs', params),
|
||||||
|
|||||||
@@ -67,6 +67,7 @@ import {
|
|||||||
PersonCircleOutline,
|
PersonCircleOutline,
|
||||||
LogOutOutline,
|
LogOutOutline,
|
||||||
KeyOutline,
|
KeyOutline,
|
||||||
|
ShieldCheckmarkOutline,
|
||||||
} from '@vicons/ionicons5';
|
} from '@vicons/ionicons5';
|
||||||
import { useAuthStore } from '@/stores/auth';
|
import { useAuthStore } from '@/stores/auth';
|
||||||
import { settingsApi } from '@/api';
|
import { settingsApi } from '@/api';
|
||||||
@@ -87,17 +88,20 @@ function renderIcon(icon: unknown) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const menuOptions = computed<MenuOption[]>(() => {
|
const menuOptions = computed<MenuOption[]>(() => {
|
||||||
const items: Array<MenuOption & { superOnly?: boolean }> = [
|
const items: Array<MenuOption & { superOnly?: boolean; auditOnly?: boolean }> = [
|
||||||
{ label: t('menu.dashboard'), key: 'dashboard', icon: renderIcon(GridOutline) },
|
{ label: t('menu.dashboard'), key: 'dashboard', icon: renderIcon(GridOutline) },
|
||||||
{ label: t('menu.templates'), key: 'templates', icon: renderIcon(DocumentTextOutline) },
|
{ label: t('menu.templates'), key: 'templates', icon: renderIcon(DocumentTextOutline) },
|
||||||
{ label: t('menu.artworks'), key: 'artworks', icon: renderIcon(ImagesOutline) },
|
{ label: t('menu.artworks'), key: 'artworks', icon: renderIcon(ImagesOutline) },
|
||||||
{ label: t('menu.traceCodes'), key: 'traceCodes', icon: renderIcon(QrCodeOutline) },
|
{ label: t('menu.traceCodes'), key: 'traceCodes', icon: renderIcon(QrCodeOutline) },
|
||||||
{ label: t('menu.outbound'), key: 'outbound', icon: renderIcon(CubeOutline) },
|
{ label: t('menu.outbound'), key: 'outbound', icon: renderIcon(CubeOutline) },
|
||||||
|
{ label: t('menu.audit'), key: 'audit', icon: renderIcon(ShieldCheckmarkOutline), auditOnly: true },
|
||||||
{ label: t('menu.queryLogs'), key: 'queryLogs', icon: renderIcon(ListOutline) },
|
{ label: t('menu.queryLogs'), key: 'queryLogs', icon: renderIcon(ListOutline) },
|
||||||
{ label: t('menu.users'), key: 'users', icon: renderIcon(PeopleOutline), superOnly: true },
|
{ label: t('menu.users'), key: 'users', icon: renderIcon(PeopleOutline), superOnly: true },
|
||||||
{ label: t('menu.settings'), key: 'settings', icon: renderIcon(SettingsOutline), superOnly: true },
|
{ label: t('menu.settings'), key: 'settings', icon: renderIcon(SettingsOutline), superOnly: true },
|
||||||
];
|
];
|
||||||
return items.filter((i) => !i.superOnly || auth.isSuperAdmin);
|
return items.filter(
|
||||||
|
(i) => (!i.superOnly || auth.isSuperAdmin) && (!i.auditOnly || auth.canAudit),
|
||||||
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
const activeKey = computed(() => (route.name === 'artwork-detail' ? 'artworks' : (route.name as string)));
|
const activeKey = computed(() => (route.name === 'artwork-detail' ? 'artworks' : (route.name as string)));
|
||||||
|
|||||||
@@ -74,6 +74,11 @@
|
|||||||
"DISABLED": "Disabled",
|
"DISABLED": "Disabled",
|
||||||
"ABNORMAL": "Abnormal"
|
"ABNORMAL": "Abnormal"
|
||||||
},
|
},
|
||||||
|
"auditStatus": {
|
||||||
|
"PENDING": "Pending",
|
||||||
|
"APPROVED": "Approved",
|
||||||
|
"REJECTED": "Rejected"
|
||||||
|
},
|
||||||
"fieldType": {
|
"fieldType": {
|
||||||
"TEXT": "Text",
|
"TEXT": "Text",
|
||||||
"NUMBER": "Number",
|
"NUMBER": "Number",
|
||||||
@@ -117,6 +122,7 @@
|
|||||||
"artworks": "Artworks",
|
"artworks": "Artworks",
|
||||||
"traceCodes": "Trace Codes",
|
"traceCodes": "Trace Codes",
|
||||||
"outbound": "Outbound & Chain",
|
"outbound": "Outbound & Chain",
|
||||||
|
"audit": "Content Audit",
|
||||||
"queryLogs": "Query Logs",
|
"queryLogs": "Query Logs",
|
||||||
"users": "Users",
|
"users": "Users",
|
||||||
"settings": "Settings",
|
"settings": "Settings",
|
||||||
@@ -158,7 +164,20 @@
|
|||||||
"create": "New Template",
|
"create": "New Template",
|
||||||
"edit": "Edit Template",
|
"edit": "Edit Template",
|
||||||
"namePlaceholder": "Enter template name",
|
"namePlaceholder": "Enter template name",
|
||||||
"fieldKeyTip": "Unique key, e.g. craft"
|
"fieldKeyTip": "Unique key, e.g. craft",
|
||||||
|
"sortHint": "Field order = display order on consumer page; use arrows to reorder"
|
||||||
|
},
|
||||||
|
"audit": {
|
||||||
|
"status": "Audit Status",
|
||||||
|
"approve": "Approve",
|
||||||
|
"reject": "Reject",
|
||||||
|
"approved": "Approved",
|
||||||
|
"rejected": "Rejected",
|
||||||
|
"remark": "Audit Note",
|
||||||
|
"remarkPlaceholder": "Enter rejection reason or suggestions",
|
||||||
|
"approveConfirm": "Approve \"{title}\"? It will become visible on the consumer page.",
|
||||||
|
"rejectedTip": "This artwork was rejected. Please revise per the notes, save and resubmit for audit.",
|
||||||
|
"pendingTip": "Pending audit; visible on consumer page only after approval. Saving edits re-enters pending."
|
||||||
},
|
},
|
||||||
"artwork": {
|
"artwork": {
|
||||||
"title": "Title",
|
"title": "Title",
|
||||||
@@ -202,6 +221,7 @@
|
|||||||
"shortCode": "Short Code",
|
"shortCode": "Short Code",
|
||||||
"code": "Trace Code",
|
"code": "Trace Code",
|
||||||
"url": "Short URL",
|
"url": "Short URL",
|
||||||
|
"archiveNo": "Archive No.",
|
||||||
"queryCount": "Queries",
|
"queryCount": "Queries",
|
||||||
"firstActivatedAt": "First Activated",
|
"firstActivatedAt": "First Activated",
|
||||||
"exportBatch": "Export Batch",
|
"exportBatch": "Export Batch",
|
||||||
@@ -231,13 +251,18 @@
|
|||||||
"sku": "SKU",
|
"sku": "SKU",
|
||||||
"archiveNo": "Archive No.",
|
"archiveNo": "Archive No.",
|
||||||
"outTime": "Outbound Time",
|
"outTime": "Outbound Time",
|
||||||
|
"outImage": "Outbound Photo",
|
||||||
|
"selectCode": "Select Trace Code",
|
||||||
|
"selectCodePlaceholder": "Search by short code / SKU / archive no.",
|
||||||
|
"onchainSection": "On-chain info (optional; filling a hash records the result)",
|
||||||
|
"txHashTip": "Paste the on-chain transaction/attestation hash",
|
||||||
"selectFile": "Select File",
|
"selectFile": "Select File",
|
||||||
"importing": "Importing…",
|
"importing": "Importing…",
|
||||||
"importResult": "Import Result",
|
"importResult": "Import Result",
|
||||||
"successCount": "Success",
|
"successCount": "Success",
|
||||||
"failCount": "Failed",
|
"failCount": "Failed",
|
||||||
"downloadResult": "Download Details",
|
"downloadResult": "Download Details",
|
||||||
"tip": "Download the template first, fill it in and upload (xlsx)"
|
"tip": "Download the template first, fill it in and upload (xlsx). Includes outbound photo, on-chain hash/time/block height."
|
||||||
},
|
},
|
||||||
"blockchain": {
|
"blockchain": {
|
||||||
"title": "Blockchain Attestation",
|
"title": "Blockchain Attestation",
|
||||||
@@ -255,7 +280,8 @@
|
|||||||
"device": "Device",
|
"device": "Device",
|
||||||
"queriedAt": "Time",
|
"queriedAt": "Time",
|
||||||
"startTime": "Start",
|
"startTime": "Start",
|
||||||
"endTime": "End"
|
"endTime": "End",
|
||||||
|
"keywordPlaceholder": "Short code / trace code / SKU / archive no."
|
||||||
},
|
},
|
||||||
"user": {
|
"user": {
|
||||||
"username": "Username",
|
"username": "Username",
|
||||||
|
|||||||
@@ -74,6 +74,11 @@
|
|||||||
"DISABLED": "停用",
|
"DISABLED": "停用",
|
||||||
"ABNORMAL": "异常"
|
"ABNORMAL": "异常"
|
||||||
},
|
},
|
||||||
|
"auditStatus": {
|
||||||
|
"PENDING": "待审核",
|
||||||
|
"APPROVED": "已通过",
|
||||||
|
"REJECTED": "已驳回"
|
||||||
|
},
|
||||||
"fieldType": {
|
"fieldType": {
|
||||||
"TEXT": "文本",
|
"TEXT": "文本",
|
||||||
"NUMBER": "数字",
|
"NUMBER": "数字",
|
||||||
@@ -117,6 +122,7 @@
|
|||||||
"artworks": "艺术品建档",
|
"artworks": "艺术品建档",
|
||||||
"traceCodes": "追溯码管理",
|
"traceCodes": "追溯码管理",
|
||||||
"outbound": "出库与上链",
|
"outbound": "出库与上链",
|
||||||
|
"audit": "内容审核",
|
||||||
"queryLogs": "查询日志",
|
"queryLogs": "查询日志",
|
||||||
"users": "用户管理",
|
"users": "用户管理",
|
||||||
"settings": "系统设置",
|
"settings": "系统设置",
|
||||||
@@ -158,7 +164,20 @@
|
|||||||
"create": "新建模板",
|
"create": "新建模板",
|
||||||
"edit": "编辑模板",
|
"edit": "编辑模板",
|
||||||
"namePlaceholder": "请输入模板名称",
|
"namePlaceholder": "请输入模板名称",
|
||||||
"fieldKeyTip": "英文唯一标识,如 craft"
|
"fieldKeyTip": "英文唯一标识,如 craft",
|
||||||
|
"sortHint": "字段顺序即 C 端展示顺序,可用上下箭头调整"
|
||||||
|
},
|
||||||
|
"audit": {
|
||||||
|
"status": "审核状态",
|
||||||
|
"approve": "通过",
|
||||||
|
"reject": "驳回",
|
||||||
|
"approved": "已通过审核",
|
||||||
|
"rejected": "已驳回",
|
||||||
|
"remark": "审核意见",
|
||||||
|
"remarkPlaceholder": "请填写驳回原因或修改建议",
|
||||||
|
"approveConfirm": "确认通过《{title}》的审核?通过后将对 C 端可见。",
|
||||||
|
"rejectedTip": "该作品审核未通过,请按意见修改后保存再次提交审核",
|
||||||
|
"pendingTip": "该作品待审核,审核通过后方可在 C 端展示;保存修改会重新进入待审核"
|
||||||
},
|
},
|
||||||
"artwork": {
|
"artwork": {
|
||||||
"title": "作品名称",
|
"title": "作品名称",
|
||||||
@@ -202,6 +221,7 @@
|
|||||||
"shortCode": "短码",
|
"shortCode": "短码",
|
||||||
"code": "追溯码",
|
"code": "追溯码",
|
||||||
"url": "短链",
|
"url": "短链",
|
||||||
|
"archiveNo": "档案编号",
|
||||||
"queryCount": "查询次数",
|
"queryCount": "查询次数",
|
||||||
"firstActivatedAt": "首次激活时间",
|
"firstActivatedAt": "首次激活时间",
|
||||||
"exportBatch": "导出本批",
|
"exportBatch": "导出本批",
|
||||||
@@ -231,13 +251,18 @@
|
|||||||
"sku": "SKU",
|
"sku": "SKU",
|
||||||
"archiveNo": "档案编号",
|
"archiveNo": "档案编号",
|
||||||
"outTime": "出库时间",
|
"outTime": "出库时间",
|
||||||
|
"outImage": "出库实况图",
|
||||||
|
"selectCode": "选择追溯码",
|
||||||
|
"selectCodePlaceholder": "输入短码 / SKU / 档案号搜索",
|
||||||
|
"onchainSection": "上链信息(选填,填写哈希即登记上链结果)",
|
||||||
|
"txHashTip": "粘贴链上交易/存证哈希",
|
||||||
"selectFile": "选择文件",
|
"selectFile": "选择文件",
|
||||||
"importing": "导入中…",
|
"importing": "导入中…",
|
||||||
"importResult": "导入结果",
|
"importResult": "导入结果",
|
||||||
"successCount": "成功",
|
"successCount": "成功",
|
||||||
"failCount": "失败",
|
"failCount": "失败",
|
||||||
"downloadResult": "下载结果明细",
|
"downloadResult": "下载结果明细",
|
||||||
"tip": "请先下载模板,按模板填写后上传(支持 xlsx)"
|
"tip": "请先下载模板,按模板填写后上传(支持 xlsx)。模板含出库实况图、上链哈希/时间/区块高度等字段。"
|
||||||
},
|
},
|
||||||
"blockchain": {
|
"blockchain": {
|
||||||
"title": "区块链存证",
|
"title": "区块链存证",
|
||||||
@@ -255,7 +280,8 @@
|
|||||||
"device": "设备信息",
|
"device": "设备信息",
|
||||||
"queriedAt": "查询时间",
|
"queriedAt": "查询时间",
|
||||||
"startTime": "开始时间",
|
"startTime": "开始时间",
|
||||||
"endTime": "结束时间"
|
"endTime": "结束时间",
|
||||||
|
"keywordPlaceholder": "短码 / 追溯码 / SKU / 档案号"
|
||||||
},
|
},
|
||||||
"user": {
|
"user": {
|
||||||
"username": "用户名",
|
"username": "用户名",
|
||||||
|
|||||||
@@ -21,9 +21,10 @@ export const routes: RouteRecordRaw[] = [
|
|||||||
{ path: 'artworks/:id', name: 'artwork-detail', component: () => import('@/views/ArtworkEdit.vue') },
|
{ path: 'artworks/:id', name: 'artwork-detail', component: () => import('@/views/ArtworkEdit.vue') },
|
||||||
{ path: 'trace-codes', name: 'traceCodes', component: () => import('@/views/TraceCodes.vue') },
|
{ path: 'trace-codes', name: 'traceCodes', component: () => import('@/views/TraceCodes.vue') },
|
||||||
{ path: 'outbound', name: 'outbound', component: () => import('@/views/Outbound.vue') },
|
{ path: 'outbound', name: 'outbound', component: () => import('@/views/Outbound.vue') },
|
||||||
|
{ path: 'audit', name: 'audit', component: () => import('@/views/Audit.vue'), meta: { roles: ['SUPER_ADMIN', 'AUDITOR'] } },
|
||||||
{ path: 'query-logs', name: 'queryLogs', component: () => import('@/views/QueryLogs.vue') },
|
{ path: 'query-logs', name: 'queryLogs', component: () => import('@/views/QueryLogs.vue') },
|
||||||
{ path: 'users', name: 'users', component: () => import('@/views/Users.vue') },
|
{ path: 'users', name: 'users', component: () => import('@/views/Users.vue'), meta: { roles: ['SUPER_ADMIN'] } },
|
||||||
{ path: 'settings', name: 'settings', component: () => import('@/views/Settings.vue') },
|
{ path: 'settings', name: 'settings', component: () => import('@/views/Settings.vue'), meta: { roles: ['SUPER_ADMIN'] } },
|
||||||
{ path: 'profile', name: 'profile', component: () => import('@/views/Profile.vue') },
|
{ path: 'profile', name: 'profile', component: () => import('@/views/Profile.vue') },
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
@@ -53,6 +54,11 @@ router.beforeEach(async (to) => {
|
|||||||
return { name: 'login' };
|
return { name: 'login' };
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// 角色守卫:受限路由仅允许指定角色访问,越权回看板
|
||||||
|
const roles = to.meta.roles as string[] | undefined;
|
||||||
|
if (roles && roles.length && !roles.includes(auth.role)) {
|
||||||
|
return { name: 'dashboard' };
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -18,6 +18,9 @@ export const useAuthStore = defineStore('auth', {
|
|||||||
isLoggedIn: (state) => !!state.token,
|
isLoggedIn: (state) => !!state.token,
|
||||||
isSuperAdmin: (state) => state.user?.role === 'SUPER_ADMIN',
|
isSuperAdmin: (state) => state.user?.role === 'SUPER_ADMIN',
|
||||||
canWrite: (state) => state.user?.role === 'SUPER_ADMIN' || state.user?.role === 'OPERATOR',
|
canWrite: (state) => state.user?.role === 'SUPER_ADMIN' || state.user?.role === 'OPERATOR',
|
||||||
|
canAudit: (state) => state.user?.role === 'SUPER_ADMIN' || state.user?.role === 'AUDITOR',
|
||||||
|
isViewer: (state) => state.user?.role === 'VIEWER',
|
||||||
|
role: (state) => state.user?.role || '',
|
||||||
},
|
},
|
||||||
actions: {
|
actions: {
|
||||||
async login(username: string, password: string) {
|
async login(username: string, password: string) {
|
||||||
|
|||||||
@@ -12,6 +12,27 @@
|
|||||||
<!-- 基础信息 -->
|
<!-- 基础信息 -->
|
||||||
<n-grid-item>
|
<n-grid-item>
|
||||||
<n-card :title="t('pages.artwork.basicInfo')" :bordered="false">
|
<n-card :title="t('pages.artwork.basicInfo')" :bordered="false">
|
||||||
|
<template v-if="!isNew" #header-extra>
|
||||||
|
<n-tag :type="auditTagType(artwork?.auditStatus)" size="small">
|
||||||
|
{{ t('pages.audit.status') }}:{{ t(`common.auditStatus.${artwork?.auditStatus || 'PENDING'}`) }}
|
||||||
|
</n-tag>
|
||||||
|
</template>
|
||||||
|
<n-alert
|
||||||
|
v-if="!isNew && artwork?.auditStatus === 'REJECTED'"
|
||||||
|
type="error"
|
||||||
|
:show-icon="true"
|
||||||
|
style="margin-bottom: 12px"
|
||||||
|
>
|
||||||
|
{{ t('pages.audit.rejectedTip') }}{{ artwork?.auditRemark ? ':' + artwork.auditRemark : '' }}
|
||||||
|
</n-alert>
|
||||||
|
<n-alert
|
||||||
|
v-else-if="!isNew && artwork?.auditStatus === 'PENDING'"
|
||||||
|
type="info"
|
||||||
|
:show-icon="true"
|
||||||
|
style="margin-bottom: 12px"
|
||||||
|
>
|
||||||
|
{{ t('pages.audit.pendingTip') }}
|
||||||
|
</n-alert>
|
||||||
<n-form ref="formRef" :model="form" :rules="rules" label-placement="top">
|
<n-form ref="formRef" :model="form" :rules="rules" label-placement="top">
|
||||||
<n-grid :cols="2" :x-gap="16" item-responsive responsive="screen">
|
<n-grid :cols="2" :x-gap="16" item-responsive responsive="screen">
|
||||||
<n-form-item-gi span="2 m:1" path="templateId" :label="t('pages.artwork.template')">
|
<n-form-item-gi span="2 m:1" path="templateId" :label="t('pages.artwork.template')">
|
||||||
@@ -35,12 +56,18 @@
|
|||||||
|
|
||||||
<n-divider style="margin: 4px 0 16px">{{ t('pages.artwork.dynamicFields') }}</n-divider>
|
<n-divider style="margin: 4px 0 16px">{{ t('pages.artwork.dynamicFields') }}</n-divider>
|
||||||
<n-grid :cols="2" :x-gap="16" item-responsive responsive="screen">
|
<n-grid :cols="2" :x-gap="16" item-responsive responsive="screen">
|
||||||
<n-form-item-gi v-for="f in currentFields" :key="f.fieldKey" span="2 m:1" :label="f.label">
|
<n-form-item-gi
|
||||||
|
v-for="f in currentFields"
|
||||||
|
:key="f.fieldKey"
|
||||||
|
span="2 m:1"
|
||||||
|
:label="f.required ? `${f.label} *` : f.label"
|
||||||
|
>
|
||||||
<n-date-picker
|
<n-date-picker
|
||||||
v-if="f.type === 'DATE'"
|
v-if="f.type === 'DATE'"
|
||||||
v-model:formatted-value="form.dynamicFields[f.fieldKey]"
|
v-model:formatted-value="form.dynamicFields[f.fieldKey]"
|
||||||
value-format="yyyy-MM-dd"
|
value-format="yyyy-MM-dd"
|
||||||
type="date"
|
type="date"
|
||||||
|
clearable
|
||||||
style="width: 100%"
|
style="width: 100%"
|
||||||
/>
|
/>
|
||||||
<n-input
|
<n-input
|
||||||
@@ -49,6 +76,30 @@
|
|||||||
type="textarea"
|
type="textarea"
|
||||||
:rows="2"
|
:rows="2"
|
||||||
/>
|
/>
|
||||||
|
<n-input-number
|
||||||
|
v-else-if="f.type === 'NUMBER'"
|
||||||
|
v-model:value="form.dynamicFields[f.fieldKey]"
|
||||||
|
style="width: 100%"
|
||||||
|
/>
|
||||||
|
<n-input
|
||||||
|
v-else-if="f.type === 'LINK'"
|
||||||
|
v-model:value="form.dynamicFields[f.fieldKey]"
|
||||||
|
placeholder="https://"
|
||||||
|
/>
|
||||||
|
<media-upload
|
||||||
|
v-else-if="f.type === 'IMAGE'"
|
||||||
|
:model-value="toMedia(form.dynamicFields[f.fieldKey])"
|
||||||
|
type="image"
|
||||||
|
:max="1"
|
||||||
|
@update:model-value="(v) => (form.dynamicFields[f.fieldKey] = v[0]?.url || '')"
|
||||||
|
/>
|
||||||
|
<media-upload
|
||||||
|
v-else-if="f.type === 'FILE'"
|
||||||
|
:model-value="toMedia(form.dynamicFields[f.fieldKey])"
|
||||||
|
type="file"
|
||||||
|
:max="1"
|
||||||
|
@update:model-value="(v) => (form.dynamicFields[f.fieldKey] = v[0]?.url || '')"
|
||||||
|
/>
|
||||||
<n-input v-else v-model:value="form.dynamicFields[f.fieldKey]" />
|
<n-input v-else v-model:value="form.dynamicFields[f.fieldKey]" />
|
||||||
</n-form-item-gi>
|
</n-form-item-gi>
|
||||||
</n-grid>
|
</n-grid>
|
||||||
@@ -299,6 +350,14 @@ function onTemplateChange() {
|
|||||||
form.dynamicFields = {};
|
form.dynamicFields = {};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 动态字段 IMAGE/FILE 适配:dynamicFields 存 url 字符串,MediaUpload 需要 MediaItem[]
|
||||||
|
function toMedia(url: unknown) {
|
||||||
|
return url ? [{ key: String(url), url: String(url), name: String(url) }] : [];
|
||||||
|
}
|
||||||
|
function auditTagType(s?: string) {
|
||||||
|
return s === 'APPROVED' ? 'success' : s === 'REJECTED' ? 'error' : 'warning';
|
||||||
|
}
|
||||||
|
|
||||||
async function loadTemplates() {
|
async function loadTemplates() {
|
||||||
templates.value = await templateApi.options();
|
templates.value = await templateApi.options();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -90,10 +90,21 @@ const columns: DataTableColumns<any> = [
|
|||||||
{
|
{
|
||||||
title: () => t('common.label.status'),
|
title: () => t('common.label.status'),
|
||||||
key: 'status',
|
key: 'status',
|
||||||
width: 90,
|
width: 84,
|
||||||
render: (r) => h(NTag, { type: statusType(r.status), size: 'small' }, { default: () => t(`common.status.${r.status}`) }),
|
render: (r) => h(NTag, { type: statusType(r.status), size: 'small' }, { default: () => t(`common.status.${r.status}`) }),
|
||||||
},
|
},
|
||||||
{ title: () => t('common.label.createdAt'), key: 'createdAt', width: 160, render: (r) => fmt(r.createdAt) },
|
{
|
||||||
|
title: () => t('pages.audit.status'),
|
||||||
|
key: 'auditStatus',
|
||||||
|
width: 90,
|
||||||
|
render: (r) =>
|
||||||
|
h(
|
||||||
|
NTag,
|
||||||
|
{ size: 'small', type: r.auditStatus === 'APPROVED' ? 'success' : r.auditStatus === 'REJECTED' ? 'error' : 'warning' },
|
||||||
|
{ default: () => t(`common.auditStatus.${r.auditStatus || 'PENDING'}`) },
|
||||||
|
),
|
||||||
|
},
|
||||||
|
{ title: () => t('common.label.createdAt'), key: 'createdAt', width: 150, render: (r) => fmt(r.createdAt) },
|
||||||
{
|
{
|
||||||
title: () => t('common.label.operation'),
|
title: () => t('common.label.operation'),
|
||||||
key: 'ops',
|
key: 'ops',
|
||||||
|
|||||||
@@ -0,0 +1,180 @@
|
|||||||
|
<template>
|
||||||
|
<div class="page">
|
||||||
|
<div class="page-toolbar">
|
||||||
|
<n-input
|
||||||
|
v-model:value="query.keyword"
|
||||||
|
:placeholder="t('common.label.keyword')"
|
||||||
|
clearable
|
||||||
|
style="width: 220px"
|
||||||
|
@keyup.enter="onSearch"
|
||||||
|
/>
|
||||||
|
<n-select
|
||||||
|
v-model:value="query.auditStatus"
|
||||||
|
:options="auditStatusOptions"
|
||||||
|
clearable
|
||||||
|
:placeholder="t('pages.audit.status')"
|
||||||
|
style="width: 150px"
|
||||||
|
@update:value="onSearch"
|
||||||
|
/>
|
||||||
|
<n-button type="primary" @click="onSearch">
|
||||||
|
<template #icon><n-icon :component="SearchOutline" /></template>
|
||||||
|
{{ t('common.action.search') }}
|
||||||
|
</n-button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<n-data-table
|
||||||
|
:columns="columns"
|
||||||
|
:data="rows"
|
||||||
|
:loading="loading"
|
||||||
|
:pagination="pagination"
|
||||||
|
remote
|
||||||
|
:row-key="(r) => r.id"
|
||||||
|
@update:page="onPage"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<n-modal v-model:show="rejectModal" preset="card" :title="t('pages.audit.reject')" style="width: 420px">
|
||||||
|
<n-form label-placement="top">
|
||||||
|
<n-form-item :label="t('pages.audit.remark')">
|
||||||
|
<n-input v-model:value="rejectRemark" type="textarea" :rows="3" :placeholder="t('pages.audit.remarkPlaceholder')" />
|
||||||
|
</n-form-item>
|
||||||
|
</n-form>
|
||||||
|
<template #footer>
|
||||||
|
<div style="text-align: right">
|
||||||
|
<n-button class="mr8" @click="rejectModal = false">{{ t('common.action.cancel') }}</n-button>
|
||||||
|
<n-button type="error" :loading="acting" @click="doReject">{{ t('pages.audit.reject') }}</n-button>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
</n-modal>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup lang="ts">
|
||||||
|
import { h, onMounted, reactive, ref } from 'vue';
|
||||||
|
import { useRouter } from 'vue-router';
|
||||||
|
import { useI18n } from 'vue-i18n';
|
||||||
|
import { NButton, NIcon, NTag, NAvatar, type DataTableColumns } from 'naive-ui';
|
||||||
|
import { SearchOutline, EyeOutline, CheckmarkCircleOutline, CloseCircleOutline } from '@vicons/ionicons5';
|
||||||
|
import { AuditStatus } from '@artveris/shared';
|
||||||
|
import { auditApi } from '@/api';
|
||||||
|
import { message, dialog } from '@/utils/feedback';
|
||||||
|
import { fmt } from '@/utils/format';
|
||||||
|
|
||||||
|
const { t } = useI18n();
|
||||||
|
const router = useRouter();
|
||||||
|
|
||||||
|
const rows = ref<any[]>([]);
|
||||||
|
const loading = ref(false);
|
||||||
|
const acting = ref(false);
|
||||||
|
const query = reactive<{ keyword: string; auditStatus: string | null; page: number; pageSize: number }>({
|
||||||
|
keyword: '',
|
||||||
|
auditStatus: AuditStatus.PENDING,
|
||||||
|
page: 1,
|
||||||
|
pageSize: 10,
|
||||||
|
});
|
||||||
|
const pagination = reactive({ page: 1, pageSize: 10, itemCount: 0 });
|
||||||
|
const auditStatusOptions = Object.values(AuditStatus).map((v) => ({ label: t(`common.auditStatus.${v}`), value: v }));
|
||||||
|
|
||||||
|
function auditTagType(s: string) {
|
||||||
|
return s === 'APPROVED' ? 'success' : s === 'REJECTED' ? 'error' : 'warning';
|
||||||
|
}
|
||||||
|
|
||||||
|
const rejectModal = ref(false);
|
||||||
|
const rejectRemark = ref('');
|
||||||
|
const rejectId = ref<number | null>(null);
|
||||||
|
|
||||||
|
const columns: DataTableColumns<any> = [
|
||||||
|
{
|
||||||
|
title: () => t('pages.artwork.images'),
|
||||||
|
key: 'cover',
|
||||||
|
width: 70,
|
||||||
|
render: (r) =>
|
||||||
|
r.images?.[0]?.url
|
||||||
|
? h(NAvatar, { src: r.images[0].url, size: 40, style: 'border-radius:8px' })
|
||||||
|
: h(NAvatar, { size: 40, style: 'border-radius:8px' }, { default: () => '—' }),
|
||||||
|
},
|
||||||
|
{ title: () => t('pages.artwork.title'), key: 'title', ellipsis: { tooltip: true } },
|
||||||
|
{ title: () => t('pages.artwork.artist'), key: 'artist', width: 110, render: (r) => r.artist || '-' },
|
||||||
|
{
|
||||||
|
title: () => t('pages.audit.status'),
|
||||||
|
key: 'auditStatus',
|
||||||
|
width: 100,
|
||||||
|
render: (r) => h(NTag, { size: 'small', type: auditTagType(r.auditStatus) }, { default: () => t(`common.auditStatus.${r.auditStatus}`) }),
|
||||||
|
},
|
||||||
|
{ title: () => t('pages.audit.remark'), key: 'auditRemark', ellipsis: { tooltip: true }, render: (r) => r.auditRemark || '-' },
|
||||||
|
{ title: () => t('common.label.updatedAt'), key: 'updatedAt', width: 160, render: (r) => fmt(r.updatedAt) },
|
||||||
|
{
|
||||||
|
title: () => t('common.label.operation'),
|
||||||
|
key: 'ops',
|
||||||
|
width: 150,
|
||||||
|
render: (r) =>
|
||||||
|
h('div', { style: 'display:flex;gap:2px' }, [
|
||||||
|
h(NButton, { quaternary: true, circle: true, size: 'small', title: t('common.action.detail'), onClick: () => router.push(`/artworks/${r.id}`) }, { icon: () => h(NIcon, null, { default: () => h(EyeOutline) }) }),
|
||||||
|
h(NButton, { quaternary: true, circle: true, size: 'small', type: 'success', title: t('pages.audit.approve'), disabled: r.auditStatus === 'APPROVED', onClick: () => approve(r) }, { icon: () => h(NIcon, null, { default: () => h(CheckmarkCircleOutline) }) }),
|
||||||
|
h(NButton, { quaternary: true, circle: true, size: 'small', type: 'error', title: t('pages.audit.reject'), disabled: r.auditStatus === 'REJECTED', onClick: () => openReject(r) }, { icon: () => h(NIcon, null, { default: () => h(CloseCircleOutline) }) }),
|
||||||
|
]),
|
||||||
|
},
|
||||||
|
];
|
||||||
|
|
||||||
|
async function load() {
|
||||||
|
loading.value = true;
|
||||||
|
try {
|
||||||
|
const res: any = await auditApi.list({
|
||||||
|
keyword: query.keyword || undefined,
|
||||||
|
auditStatus: query.auditStatus || undefined,
|
||||||
|
page: query.page,
|
||||||
|
pageSize: query.pageSize,
|
||||||
|
});
|
||||||
|
rows.value = res.list;
|
||||||
|
pagination.itemCount = res.total;
|
||||||
|
pagination.page = res.page;
|
||||||
|
} finally {
|
||||||
|
loading.value = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
function onSearch() {
|
||||||
|
query.page = 1;
|
||||||
|
load();
|
||||||
|
}
|
||||||
|
function onPage(p: number) {
|
||||||
|
query.page = p;
|
||||||
|
load();
|
||||||
|
}
|
||||||
|
function approve(r: any) {
|
||||||
|
dialog.success({
|
||||||
|
title: t('pages.audit.approve'),
|
||||||
|
content: t('pages.audit.approveConfirm', { title: r.title }),
|
||||||
|
positiveText: t('common.action.confirm'),
|
||||||
|
negativeText: t('common.action.cancel'),
|
||||||
|
onPositiveClick: async () => {
|
||||||
|
await auditApi.audit(r.id, { approved: true });
|
||||||
|
message.success(t('pages.audit.approved'));
|
||||||
|
load();
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
function openReject(r: any) {
|
||||||
|
rejectId.value = r.id;
|
||||||
|
rejectRemark.value = '';
|
||||||
|
rejectModal.value = true;
|
||||||
|
}
|
||||||
|
async function doReject() {
|
||||||
|
if (rejectId.value === null) return;
|
||||||
|
acting.value = true;
|
||||||
|
try {
|
||||||
|
await auditApi.audit(rejectId.value, { approved: false, remark: rejectRemark.value });
|
||||||
|
message.success(t('pages.audit.rejected'));
|
||||||
|
rejectModal.value = false;
|
||||||
|
load();
|
||||||
|
} finally {
|
||||||
|
acting.value = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
onMounted(load);
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
.mr8 {
|
||||||
|
margin-right: 8px;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@@ -1,65 +1,186 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="page">
|
<div class="page">
|
||||||
<n-card :title="t('pages.outbound.import')" :bordered="false">
|
<n-card :bordered="false">
|
||||||
<n-alert type="info" :show-icon="true" style="margin-bottom: 16px">{{ t('pages.outbound.tip') }}</n-alert>
|
<n-tabs type="line" animated>
|
||||||
<n-space>
|
<!-- 单条录入 -->
|
||||||
<n-button @click="downloadTemplate">
|
<n-tab-pane name="single" :tab="t('pages.outbound.single')">
|
||||||
<template #icon><n-icon :component="DownloadOutline" /></template>
|
<n-form label-placement="top" style="max-width: 560px">
|
||||||
{{ t('common.action.downloadTemplate') }}
|
<n-form-item :label="t('pages.outbound.selectCode')" required>
|
||||||
</n-button>
|
<n-select
|
||||||
<n-upload
|
v-model:value="form.traceCodeId"
|
||||||
:show-file-list="false"
|
filterable
|
||||||
accept=".xlsx,.xls"
|
remote
|
||||||
:custom-request="doImport"
|
clearable
|
||||||
:disabled="importing || !auth.canWrite"
|
:loading="searching"
|
||||||
>
|
:options="codeOptions"
|
||||||
<n-button type="primary" :loading="importing">
|
:placeholder="t('pages.outbound.selectCodePlaceholder')"
|
||||||
<template #icon><n-icon :component="CloudUploadOutline" /></template>
|
@search="searchCodes"
|
||||||
{{ t('pages.outbound.selectFile') }}
|
@update:value="onPickCode"
|
||||||
</n-button>
|
/>
|
||||||
</n-upload>
|
</n-form-item>
|
||||||
</n-space>
|
<n-grid :cols="2" :x-gap="16">
|
||||||
|
<n-form-item-gi :label="t('pages.outbound.sku')">
|
||||||
|
<n-input v-model:value="form.sku" />
|
||||||
|
</n-form-item-gi>
|
||||||
|
<n-form-item-gi :label="t('pages.outbound.archiveNo')">
|
||||||
|
<n-input v-model:value="form.archiveNo" />
|
||||||
|
</n-form-item-gi>
|
||||||
|
<n-form-item-gi :label="t('pages.outbound.outTime')">
|
||||||
|
<n-date-picker v-model:formatted-value="form.outTime" value-format="yyyy-MM-dd HH:mm" type="datetime" clearable style="width: 100%" />
|
||||||
|
</n-form-item-gi>
|
||||||
|
<n-form-item-gi :label="t('common.label.remark')">
|
||||||
|
<n-input v-model:value="form.remark" />
|
||||||
|
</n-form-item-gi>
|
||||||
|
</n-grid>
|
||||||
|
<n-form-item :label="t('pages.outbound.outImage')">
|
||||||
|
<media-upload v-model="outImages" type="image" :max="1" />
|
||||||
|
</n-form-item>
|
||||||
|
|
||||||
<n-card v-if="result" embedded :title="t('pages.outbound.importResult')" style="margin-top: 16px">
|
<n-divider style="margin: 4px 0 14px">{{ t('pages.outbound.onchainSection') }}</n-divider>
|
||||||
<n-space align="center" size="large">
|
<n-grid :cols="2" :x-gap="16">
|
||||||
<n-statistic :label="t('common.label.total')" :value="result.total" />
|
<n-form-item-gi span="2" :label="t('pages.blockchain.txHash')">
|
||||||
<n-statistic :label="t('pages.outbound.successCount')">
|
<n-input v-model:value="form.txHash" :placeholder="t('pages.outbound.txHashTip')" />
|
||||||
<span style="color: #138a72">{{ result.successCount }}</span>
|
</n-form-item-gi>
|
||||||
</n-statistic>
|
<n-form-item-gi :label="t('pages.blockchain.onchainAt')">
|
||||||
<n-statistic :label="t('pages.outbound.failCount')">
|
<n-date-picker v-model:formatted-value="form.onchainAt" value-format="yyyy-MM-dd HH:mm" type="datetime" clearable style="width: 100%" />
|
||||||
<span style="color: #c0392b">{{ result.failCount }}</span>
|
</n-form-item-gi>
|
||||||
</n-statistic>
|
<n-form-item-gi :label="t('pages.blockchain.blockHeight')">
|
||||||
<n-tag :type="statusType(result.status)">{{ t(`common.status.${result.status}`) }}</n-tag>
|
<n-input-number v-model:value="form.blockHeight" :min="0" style="width: 100%" />
|
||||||
<n-button v-if="result.resultFileUrl" text tag="a" :href="result.resultFileUrl" target="_blank" type="primary">
|
</n-form-item-gi>
|
||||||
<template #icon><n-icon :component="DownloadOutline" /></template>
|
</n-grid>
|
||||||
{{ t('pages.outbound.downloadResult') }}
|
|
||||||
</n-button>
|
<n-button type="primary" :loading="saving" :disabled="!auth.canWrite || !form.traceCodeId" @click="saveSingle">
|
||||||
</n-space>
|
{{ t('common.action.save') }}
|
||||||
</n-card>
|
</n-button>
|
||||||
|
</n-form>
|
||||||
|
</n-tab-pane>
|
||||||
|
|
||||||
|
<!-- 批量导入 -->
|
||||||
|
<n-tab-pane name="import" :tab="t('pages.outbound.import')">
|
||||||
|
<n-alert type="info" :show-icon="true" style="margin-bottom: 16px">{{ t('pages.outbound.tip') }}</n-alert>
|
||||||
|
<n-space>
|
||||||
|
<n-button @click="downloadTemplate">
|
||||||
|
<template #icon><n-icon :component="DownloadOutline" /></template>
|
||||||
|
{{ t('common.action.downloadTemplate') }}
|
||||||
|
</n-button>
|
||||||
|
<n-upload
|
||||||
|
:show-file-list="false"
|
||||||
|
accept=".xlsx,.xls"
|
||||||
|
:custom-request="doImport"
|
||||||
|
:disabled="importing || !auth.canWrite"
|
||||||
|
>
|
||||||
|
<n-button type="primary" :loading="importing">
|
||||||
|
<template #icon><n-icon :component="CloudUploadOutline" /></template>
|
||||||
|
{{ t('pages.outbound.selectFile') }}
|
||||||
|
</n-button>
|
||||||
|
</n-upload>
|
||||||
|
</n-space>
|
||||||
|
|
||||||
|
<n-card v-if="result" embedded :title="t('pages.outbound.importResult')" style="margin-top: 16px">
|
||||||
|
<n-space align="center" size="large">
|
||||||
|
<n-statistic :label="t('common.label.total', { n: result.total })" :value="result.total" />
|
||||||
|
<n-statistic :label="t('pages.outbound.successCount')">
|
||||||
|
<span style="color: #138a72">{{ result.successCount }}</span>
|
||||||
|
</n-statistic>
|
||||||
|
<n-statistic :label="t('pages.outbound.failCount')">
|
||||||
|
<span style="color: #c0392b">{{ result.failCount }}</span>
|
||||||
|
</n-statistic>
|
||||||
|
<n-tag :type="statusType(result.status)">{{ t(`common.status.${result.status}`) }}</n-tag>
|
||||||
|
<n-button v-if="result.resultFileUrl" text tag="a" :href="result.resultFileUrl" target="_blank" type="primary">
|
||||||
|
<template #icon><n-icon :component="DownloadOutline" /></template>
|
||||||
|
{{ t('pages.outbound.downloadResult') }}
|
||||||
|
</n-button>
|
||||||
|
</n-space>
|
||||||
|
</n-card>
|
||||||
|
</n-tab-pane>
|
||||||
|
</n-tabs>
|
||||||
</n-card>
|
</n-card>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { ref } from 'vue';
|
import { reactive, ref } from 'vue';
|
||||||
import { useI18n } from 'vue-i18n';
|
import { useI18n } from 'vue-i18n';
|
||||||
import type { UploadCustomRequestOptions } from 'naive-ui';
|
import type { UploadCustomRequestOptions } from 'naive-ui';
|
||||||
import { DownloadOutline, CloudUploadOutline } from '@vicons/ionicons5';
|
import { DownloadOutline, CloudUploadOutline } from '@vicons/ionicons5';
|
||||||
import { jobApi, outboundApi, post } from '@/api';
|
import { jobApi, outboundApi, traceCodeApi, post } from '@/api';
|
||||||
import { useAuthStore } from '@/stores/auth';
|
import { useAuthStore } from '@/stores/auth';
|
||||||
|
import MediaUpload from '@/components/MediaUpload.vue';
|
||||||
import { message } from '@/utils/feedback';
|
import { message } from '@/utils/feedback';
|
||||||
import { statusType } from '@/utils/format';
|
import { statusType } from '@/utils/format';
|
||||||
import { downloadFile } from '@/utils/download';
|
import { downloadFile } from '@/utils/download';
|
||||||
|
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
const auth = useAuthStore();
|
const auth = useAuthStore();
|
||||||
|
|
||||||
|
/* 单条录入 */
|
||||||
|
const saving = ref(false);
|
||||||
|
const searching = ref(false);
|
||||||
|
const codeOptions = ref<{ label: string; value: string }[]>([]);
|
||||||
|
const outImages = ref<any[]>([]);
|
||||||
|
const form = reactive<any>({
|
||||||
|
traceCodeId: null,
|
||||||
|
sku: '',
|
||||||
|
archiveNo: '',
|
||||||
|
outTime: null,
|
||||||
|
remark: '',
|
||||||
|
txHash: '',
|
||||||
|
onchainAt: null,
|
||||||
|
blockHeight: null,
|
||||||
|
});
|
||||||
|
|
||||||
|
let searchTimer: ReturnType<typeof setTimeout> | null = null;
|
||||||
|
function searchCodes(keyword: string) {
|
||||||
|
if (searchTimer) clearTimeout(searchTimer);
|
||||||
|
searchTimer = setTimeout(async () => {
|
||||||
|
searching.value = true;
|
||||||
|
try {
|
||||||
|
const res: any = await traceCodeApi.list({ keyword: keyword || undefined, pageSize: 20 });
|
||||||
|
codeOptions.value = res.list.map((c: any) => ({
|
||||||
|
label: `${c.shortCode}${c.artwork ? ' · ' + c.artwork.title : ''}${c.sku ? ' · ' + c.sku : ''}`,
|
||||||
|
value: String(c.id),
|
||||||
|
raw: c,
|
||||||
|
}));
|
||||||
|
} finally {
|
||||||
|
searching.value = false;
|
||||||
|
}
|
||||||
|
}, 300);
|
||||||
|
}
|
||||||
|
function onPickCode(_id: string, opt: any) {
|
||||||
|
const c = opt?.raw;
|
||||||
|
if (!c) return;
|
||||||
|
form.sku = c.sku || '';
|
||||||
|
form.archiveNo = c.archiveNo || '';
|
||||||
|
form.remark = c.remark || '';
|
||||||
|
outImages.value = c.outImage ? [{ key: c.outImage, url: c.outImage, name: c.outImage }] : [];
|
||||||
|
}
|
||||||
|
async function saveSingle() {
|
||||||
|
if (!form.traceCodeId) return;
|
||||||
|
saving.value = true;
|
||||||
|
try {
|
||||||
|
await outboundApi.updateSingle(form.traceCodeId, {
|
||||||
|
sku: form.sku || undefined,
|
||||||
|
archiveNo: form.archiveNo || undefined,
|
||||||
|
outTime: form.outTime ? new Date(form.outTime).toISOString() : undefined,
|
||||||
|
outImageKey: outImages.value[0]?.key || undefined,
|
||||||
|
txHash: form.txHash || undefined,
|
||||||
|
onchainAt: form.onchainAt ? new Date(form.onchainAt).toISOString() : undefined,
|
||||||
|
blockHeight: form.blockHeight ?? undefined,
|
||||||
|
remark: form.remark || undefined,
|
||||||
|
});
|
||||||
|
message.success(t('common.msg.saved'));
|
||||||
|
} finally {
|
||||||
|
saving.value = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 批量导入 */
|
||||||
const importing = ref(false);
|
const importing = ref(false);
|
||||||
const result = ref<any>(null);
|
const result = ref<any>(null);
|
||||||
|
|
||||||
async function downloadTemplate() {
|
async function downloadTemplate() {
|
||||||
await downloadFile('/outbound/import/template', 'outbound-import-template.xlsx');
|
await downloadFile('/outbound/import/template', 'outbound-import-template.xlsx');
|
||||||
}
|
}
|
||||||
|
|
||||||
async function doImport({ file, onFinish, onError }: UploadCustomRequestOptions) {
|
async function doImport({ file, onFinish, onError }: UploadCustomRequestOptions) {
|
||||||
importing.value = true;
|
importing.value = true;
|
||||||
result.value = null;
|
result.value = null;
|
||||||
|
|||||||
@@ -3,9 +3,23 @@
|
|||||||
<div class="page-toolbar">
|
<div class="page-toolbar">
|
||||||
<n-input
|
<n-input
|
||||||
v-model:value="query.keyword"
|
v-model:value="query.keyword"
|
||||||
:placeholder="t('pages.traceCode.shortCode')"
|
:placeholder="t('pages.queryLog.keywordPlaceholder')"
|
||||||
clearable
|
clearable
|
||||||
style="width: 180px"
|
style="width: 200px"
|
||||||
|
@keyup.enter="onSearch"
|
||||||
|
/>
|
||||||
|
<n-input
|
||||||
|
v-model:value="query.sku"
|
||||||
|
placeholder="SKU"
|
||||||
|
clearable
|
||||||
|
style="width: 130px"
|
||||||
|
@keyup.enter="onSearch"
|
||||||
|
/>
|
||||||
|
<n-input
|
||||||
|
v-model:value="query.batchNo"
|
||||||
|
:placeholder="t('pages.traceCode.batchNo')"
|
||||||
|
clearable
|
||||||
|
style="width: 150px"
|
||||||
@keyup.enter="onSearch"
|
@keyup.enter="onSearch"
|
||||||
/>
|
/>
|
||||||
<n-select
|
<n-select
|
||||||
@@ -13,14 +27,14 @@
|
|||||||
:options="resultOptions"
|
:options="resultOptions"
|
||||||
clearable
|
clearable
|
||||||
:placeholder="t('pages.queryLog.result')"
|
:placeholder="t('pages.queryLog.result')"
|
||||||
style="width: 150px"
|
style="width: 140px"
|
||||||
@update:value="onSearch"
|
@update:value="onSearch"
|
||||||
/>
|
/>
|
||||||
<n-date-picker
|
<n-date-picker
|
||||||
v-model:value="range"
|
v-model:value="range"
|
||||||
type="datetimerange"
|
type="datetimerange"
|
||||||
clearable
|
clearable
|
||||||
style="width: 360px"
|
style="width: 340px"
|
||||||
@update:value="onRange"
|
@update:value="onRange"
|
||||||
/>
|
/>
|
||||||
<n-button type="primary" @click="onSearch">
|
<n-button type="primary" @click="onSearch">
|
||||||
@@ -55,8 +69,10 @@ const { t } = useI18n();
|
|||||||
const rows = ref<any[]>([]);
|
const rows = ref<any[]>([]);
|
||||||
const loading = ref(false);
|
const loading = ref(false);
|
||||||
const range = ref<[number, number] | null>(null);
|
const range = ref<[number, number] | null>(null);
|
||||||
const query = reactive<{ keyword: string; result: string | null; startTime?: string; endTime?: string; page: number; pageSize: number }>({
|
const query = reactive<{ keyword: string; sku: string; batchNo: string; result: string | null; startTime?: string; endTime?: string; page: number; pageSize: number }>({
|
||||||
keyword: '',
|
keyword: '',
|
||||||
|
sku: '',
|
||||||
|
batchNo: '',
|
||||||
result: null,
|
result: null,
|
||||||
page: 1,
|
page: 1,
|
||||||
pageSize: 10,
|
pageSize: 10,
|
||||||
@@ -65,21 +81,31 @@ const pagination = reactive({ page: 1, pageSize: 10, itemCount: 0 });
|
|||||||
const resultOptions = Object.values(QueryResult).map((v) => ({ label: t(`common.queryResult.${v}`), value: v }));
|
const resultOptions = Object.values(QueryResult).map((v) => ({ label: t(`common.queryResult.${v}`), value: v }));
|
||||||
|
|
||||||
const columns: DataTableColumns<any> = [
|
const columns: DataTableColumns<any> = [
|
||||||
{ title: () => t('pages.traceCode.shortCode'), key: 'shortCode', width: 130, render: (r) => r.shortCode || '-' },
|
{ title: () => t('pages.traceCode.shortCode'), key: 'shortCode', width: 120, render: (r) => r.shortCode || '-' },
|
||||||
|
{ title: 'SKU', key: 'sku', width: 120, render: (r) => r.sku || '-' },
|
||||||
|
{ title: () => t('pages.traceCode.archiveNo'), key: 'archiveNo', width: 110, render: (r) => r.archiveNo || '-' },
|
||||||
|
{ title: () => t('pages.traceCode.batchNo'), key: 'batchNo', width: 130, render: (r) => r.batchNo || '-' },
|
||||||
{
|
{
|
||||||
title: () => t('pages.queryLog.result'),
|
title: () => t('pages.queryLog.result'),
|
||||||
key: 'queryResult',
|
key: 'queryResult',
|
||||||
width: 110,
|
width: 104,
|
||||||
render: (r) => h(NTag, { size: 'small', type: statusType(r.queryResult) }, { default: () => t(`common.queryResult.${r.queryResult}`) }),
|
render: (r) => h(NTag, { size: 'small', type: statusType(r.queryResult) }, { default: () => t(`common.queryResult.${r.queryResult}`) }),
|
||||||
},
|
},
|
||||||
|
{ title: () => t('pages.traceCode.queryCount'), key: 'queryCount', width: 90, render: (r) => (r.queryCount ?? '-') },
|
||||||
|
{ title: () => t('pages.traceCode.firstActivatedAt'), key: 'firstActivatedAt', width: 160, render: (r) => fmt(r.firstActivatedAt) },
|
||||||
{
|
{
|
||||||
title: () => t('pages.queryLog.ip'),
|
title: () => t('pages.queryLog.ip'),
|
||||||
key: 'ip',
|
key: 'ip',
|
||||||
width: 200,
|
width: 190,
|
||||||
render: (r) => `${r.ip || '-'} / ${r.region || '-'}`,
|
render: (r) => `${r.ip || '-'} / ${r.region || '-'}`,
|
||||||
},
|
},
|
||||||
{ title: () => t('pages.queryLog.device'), key: 'deviceType', width: 110, render: (r) => r.deviceType || '-' },
|
{
|
||||||
{ title: () => t('pages.queryLog.queriedAt'), key: 'queriedAt', width: 170, render: (r) => fmt(r.queriedAt) },
|
title: () => t('pages.queryLog.device'),
|
||||||
|
key: 'deviceType',
|
||||||
|
width: 150,
|
||||||
|
render: (r) => [r.deviceType, r.os, r.browser].filter(Boolean).join(' / ') || '-',
|
||||||
|
},
|
||||||
|
{ title: () => t('pages.queryLog.queriedAt'), key: 'queriedAt', width: 160, render: (r) => fmt(r.queriedAt) },
|
||||||
];
|
];
|
||||||
|
|
||||||
async function load() {
|
async function load() {
|
||||||
@@ -87,6 +113,8 @@ async function load() {
|
|||||||
try {
|
try {
|
||||||
const res: any = await queryLogApi.list({
|
const res: any = await queryLogApi.list({
|
||||||
keyword: query.keyword || undefined,
|
keyword: query.keyword || undefined,
|
||||||
|
sku: query.sku || undefined,
|
||||||
|
batchNo: query.batchNo || undefined,
|
||||||
result: query.result || undefined,
|
result: query.result || undefined,
|
||||||
startTime: query.startTime,
|
startTime: query.startTime,
|
||||||
endTime: query.endTime,
|
endTime: query.endTime,
|
||||||
|
|||||||
@@ -42,16 +42,32 @@
|
|||||||
<n-form-item :label="t('common.label.remark')">
|
<n-form-item :label="t('common.label.remark')">
|
||||||
<n-input v-model:value="form.remark" type="textarea" :rows="2" />
|
<n-input v-model:value="form.remark" type="textarea" :rows="2" />
|
||||||
</n-form-item>
|
</n-form-item>
|
||||||
|
<n-form-item v-if="editing" :label="t('common.label.status')">
|
||||||
|
<n-switch v-model:value="form.status" :checked-value="'ENABLED'" :unchecked-value="'DISABLED'">
|
||||||
|
<template #checked>{{ t('common.status.ENABLED') }}</template>
|
||||||
|
<template #unchecked>{{ t('common.status.DISABLED') }}</template>
|
||||||
|
</n-switch>
|
||||||
|
</n-form-item>
|
||||||
<n-form-item :label="t('pages.template.fields')">
|
<n-form-item :label="t('pages.template.fields')">
|
||||||
<div style="width: 100%">
|
<div style="width: 100%">
|
||||||
|
<div class="field-hint">{{ t('pages.template.sortHint') }}</div>
|
||||||
<div v-for="(f, i) in form.fields" :key="i" class="field-row">
|
<div v-for="(f, i) in form.fields" :key="i" class="field-row">
|
||||||
<n-input v-model:value="f.fieldKey" :placeholder="t('pages.template.fieldKeyTip')" style="width: 130px" />
|
<span class="field-order">{{ i + 1 }}</span>
|
||||||
<n-input v-model:value="f.label" :placeholder="t('pages.template.fieldLabel')" style="width: 120px" />
|
<n-input v-model:value="f.fieldKey" :placeholder="t('pages.template.fieldKeyTip')" style="width: 120px" />
|
||||||
<n-select v-model:value="f.type" :options="fieldTypeOptions" style="width: 120px" />
|
<n-input v-model:value="f.label" :placeholder="t('pages.template.fieldLabel')" style="width: 110px" />
|
||||||
|
<n-select v-model:value="f.type" :options="fieldTypeOptions" style="width: 110px" />
|
||||||
<n-checkbox v-model:checked="f.required">{{ t('pages.template.required') }}</n-checkbox>
|
<n-checkbox v-model:checked="f.required">{{ t('pages.template.required') }}</n-checkbox>
|
||||||
<n-button quaternary circle type="error" @click="form.fields.splice(i, 1)">
|
<span class="field-ops">
|
||||||
<template #icon><n-icon :component="TrashOutline" /></template>
|
<n-button quaternary circle size="small" :disabled="i === 0" @click="moveField(i, -1)">
|
||||||
</n-button>
|
<template #icon><n-icon :component="ArrowUpOutline" /></template>
|
||||||
|
</n-button>
|
||||||
|
<n-button quaternary circle size="small" :disabled="i === form.fields.length - 1" @click="moveField(i, 1)">
|
||||||
|
<template #icon><n-icon :component="ArrowDownOutline" /></template>
|
||||||
|
</n-button>
|
||||||
|
<n-button quaternary circle type="error" size="small" @click="form.fields.splice(i, 1)">
|
||||||
|
<template #icon><n-icon :component="TrashOutline" /></template>
|
||||||
|
</n-button>
|
||||||
|
</span>
|
||||||
</div>
|
</div>
|
||||||
<n-button dashed block @click="addField">
|
<n-button dashed block @click="addField">
|
||||||
<template #icon><n-icon :component="AddOutline" /></template>
|
<template #icon><n-icon :component="AddOutline" /></template>
|
||||||
@@ -74,8 +90,16 @@
|
|||||||
import { h, onMounted, reactive, ref } from 'vue';
|
import { h, onMounted, reactive, ref } from 'vue';
|
||||||
import { useI18n } from 'vue-i18n';
|
import { useI18n } from 'vue-i18n';
|
||||||
import { NButton, NIcon, NTag, type DataTableColumns, type FormInst, type FormRules } from 'naive-ui';
|
import { NButton, NIcon, NTag, type DataTableColumns, type FormInst, type FormRules } from 'naive-ui';
|
||||||
import { SearchOutline, AddOutline, TrashOutline, CreateOutline } from '@vicons/ionicons5';
|
import {
|
||||||
import { FieldType } from '@artveris/shared';
|
SearchOutline,
|
||||||
|
AddOutline,
|
||||||
|
TrashOutline,
|
||||||
|
CreateOutline,
|
||||||
|
ArrowUpOutline,
|
||||||
|
ArrowDownOutline,
|
||||||
|
PowerOutline,
|
||||||
|
} from '@vicons/ionicons5';
|
||||||
|
import { FieldType, TemplateStatus } from '@artveris/shared';
|
||||||
import { templateApi } from '@/api';
|
import { templateApi } from '@/api';
|
||||||
import { useAuthStore } from '@/stores/auth';
|
import { useAuthStore } from '@/stores/auth';
|
||||||
import { message, dialog } from '@/utils/feedback';
|
import { message, dialog } from '@/utils/feedback';
|
||||||
@@ -95,7 +119,7 @@ const showModal = ref(false);
|
|||||||
const editing = ref<number | null>(null);
|
const editing = ref<number | null>(null);
|
||||||
const saving = ref(false);
|
const saving = ref(false);
|
||||||
const formRef = ref<FormInst | null>(null);
|
const formRef = ref<FormInst | null>(null);
|
||||||
const form = reactive<{ name: string; remark: string; fields: any[] }>({ name: '', remark: '', fields: [] });
|
const form = reactive<{ name: string; remark: string; status: string; fields: any[] }>({ name: '', remark: '', status: 'ENABLED', fields: [] });
|
||||||
const rules: FormRules = { name: { required: true, message: () => t('pages.template.namePlaceholder'), trigger: 'blur' } };
|
const rules: FormRules = { name: { required: true, message: () => t('pages.template.namePlaceholder'), trigger: 'blur' } };
|
||||||
|
|
||||||
const columns: DataTableColumns<any> = [
|
const columns: DataTableColumns<any> = [
|
||||||
@@ -123,12 +147,24 @@ const columns: DataTableColumns<any> = [
|
|||||||
? h('div', { style: 'display:flex;gap:4px' }, [
|
? h('div', { style: 'display:flex;gap:4px' }, [
|
||||||
h(
|
h(
|
||||||
NButton,
|
NButton,
|
||||||
{ quaternary: true, circle: true, size: 'small', onClick: () => openEdit(r) },
|
{ quaternary: true, circle: true, size: 'small', title: t('common.action.edit'), onClick: () => openEdit(r) },
|
||||||
{ icon: () => h(NIcon, null, { default: () => h(CreateOutline) }) },
|
{ icon: () => h(NIcon, null, { default: () => h(CreateOutline) }) },
|
||||||
),
|
),
|
||||||
h(
|
h(
|
||||||
NButton,
|
NButton,
|
||||||
{ quaternary: true, circle: true, size: 'small', type: 'error', onClick: () => remove(r) },
|
{
|
||||||
|
quaternary: true,
|
||||||
|
circle: true,
|
||||||
|
size: 'small',
|
||||||
|
title: r.status === 'ENABLED' ? t('common.status.DISABLED') : t('common.status.ENABLED'),
|
||||||
|
type: r.status === 'ENABLED' ? 'warning' : 'success',
|
||||||
|
onClick: () => toggleStatus(r),
|
||||||
|
},
|
||||||
|
{ icon: () => h(NIcon, null, { default: () => h(PowerOutline) }) },
|
||||||
|
),
|
||||||
|
h(
|
||||||
|
NButton,
|
||||||
|
{ quaternary: true, circle: true, size: 'small', type: 'error', title: t('common.action.delete'), onClick: () => remove(r) },
|
||||||
{ icon: () => h(NIcon, null, { default: () => h(TrashOutline) }) },
|
{ icon: () => h(NIcon, null, { default: () => h(TrashOutline) }) },
|
||||||
),
|
),
|
||||||
])
|
])
|
||||||
@@ -136,6 +172,13 @@ const columns: DataTableColumns<any> = [
|
|||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
|
async function toggleStatus(r: any) {
|
||||||
|
const next = r.status === TemplateStatus.ENABLED ? TemplateStatus.DISABLED : TemplateStatus.ENABLED;
|
||||||
|
await templateApi.update(r.id, { status: next });
|
||||||
|
message.success(t('common.msg.updated'));
|
||||||
|
load();
|
||||||
|
}
|
||||||
|
|
||||||
async function load() {
|
async function load() {
|
||||||
loading.value = true;
|
loading.value = true;
|
||||||
try {
|
try {
|
||||||
@@ -156,10 +199,17 @@ function onPage(p: number) {
|
|||||||
function addField() {
|
function addField() {
|
||||||
form.fields.push({ fieldKey: '', label: '', type: FieldType.TEXT, required: false });
|
form.fields.push({ fieldKey: '', label: '', type: FieldType.TEXT, required: false });
|
||||||
}
|
}
|
||||||
|
function moveField(i: number, dir: -1 | 1) {
|
||||||
|
const j = i + dir;
|
||||||
|
if (j < 0 || j >= form.fields.length) return;
|
||||||
|
const arr = form.fields;
|
||||||
|
[arr[i], arr[j]] = [arr[j], arr[i]];
|
||||||
|
}
|
||||||
function openCreate() {
|
function openCreate() {
|
||||||
editing.value = null;
|
editing.value = null;
|
||||||
form.name = '';
|
form.name = '';
|
||||||
form.remark = '';
|
form.remark = '';
|
||||||
|
form.status = 'ENABLED';
|
||||||
form.fields = [{ fieldKey: '', label: '', type: FieldType.TEXT, required: false }];
|
form.fields = [{ fieldKey: '', label: '', type: FieldType.TEXT, required: false }];
|
||||||
showModal.value = true;
|
showModal.value = true;
|
||||||
}
|
}
|
||||||
@@ -167,6 +217,7 @@ function openEdit(r: any) {
|
|||||||
editing.value = r.id;
|
editing.value = r.id;
|
||||||
form.name = r.name;
|
form.name = r.name;
|
||||||
form.remark = r.remark || '';
|
form.remark = r.remark || '';
|
||||||
|
form.status = r.status || 'ENABLED';
|
||||||
form.fields = (r.fields || []).map((f: any) => ({ ...f }));
|
form.fields = (r.fields || []).map((f: any) => ({ ...f }));
|
||||||
showModal.value = true;
|
showModal.value = true;
|
||||||
}
|
}
|
||||||
@@ -182,7 +233,10 @@ async function save() {
|
|||||||
}
|
}
|
||||||
saving.value = true;
|
saving.value = true;
|
||||||
try {
|
try {
|
||||||
const payload = { name: form.name, remark: form.remark, fields: form.fields };
|
// 排序:按当前顺序写 sortOrder
|
||||||
|
const fields = form.fields.map((f, i) => ({ ...f, sortOrder: i }));
|
||||||
|
const payload: any = { name: form.name, remark: form.remark, fields };
|
||||||
|
if (editing.value) payload.status = form.status;
|
||||||
if (editing.value) {
|
if (editing.value) {
|
||||||
await templateApi.update(editing.value, payload);
|
await templateApi.update(editing.value, payload);
|
||||||
message.success(t('common.msg.updated'));
|
message.success(t('common.msg.updated'));
|
||||||
@@ -220,6 +274,22 @@ onMounted(load);
|
|||||||
gap: 8px;
|
gap: 8px;
|
||||||
margin-bottom: 8px;
|
margin-bottom: 8px;
|
||||||
}
|
}
|
||||||
|
.field-order {
|
||||||
|
width: 18px;
|
||||||
|
text-align: center;
|
||||||
|
color: #9ca3af;
|
||||||
|
font-size: 12px;
|
||||||
|
flex-shrink: 0;
|
||||||
|
}
|
||||||
|
.field-ops {
|
||||||
|
display: inline-flex;
|
||||||
|
gap: 2px;
|
||||||
|
}
|
||||||
|
.field-hint {
|
||||||
|
font-size: 12px;
|
||||||
|
color: #9ca3af;
|
||||||
|
margin-bottom: 8px;
|
||||||
|
}
|
||||||
.mr8 {
|
.mr8 {
|
||||||
margin-right: 8px;
|
margin-right: 8px;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -29,6 +29,7 @@
|
|||||||
"@nestjs/core": "^10.4.15",
|
"@nestjs/core": "^10.4.15",
|
||||||
"@nestjs/jwt": "^10.2.0",
|
"@nestjs/jwt": "^10.2.0",
|
||||||
"@nestjs/platform-express": "^10.4.15",
|
"@nestjs/platform-express": "^10.4.15",
|
||||||
|
"@nestjs/schedule": "^6.1.3",
|
||||||
"@nestjs/serve-static": "^4.0.2",
|
"@nestjs/serve-static": "^4.0.2",
|
||||||
"@nestjs/swagger": "^8.1.0",
|
"@nestjs/swagger": "^8.1.0",
|
||||||
"@prisma/client": "^5.22.0",
|
"@prisma/client": "^5.22.0",
|
||||||
|
|||||||
@@ -0,0 +1,24 @@
|
|||||||
|
-- AlterTable
|
||||||
|
ALTER TABLE `artwork` ADD COLUMN `audit_remark` VARCHAR(191) NULL,
|
||||||
|
ADD COLUMN `audit_status` ENUM('PENDING', 'APPROVED', 'REJECTED') NOT NULL DEFAULT 'PENDING',
|
||||||
|
ADD COLUMN `audited_at` DATETIME(3) NULL,
|
||||||
|
ADD COLUMN `audited_by` INTEGER NULL;
|
||||||
|
|
||||||
|
-- AlterTable
|
||||||
|
ALTER TABLE `query_log` ADD COLUMN `archive_no` VARCHAR(191) NULL,
|
||||||
|
ADD COLUMN `batch_no` VARCHAR(191) NULL,
|
||||||
|
ADD COLUMN `browser` VARCHAR(191) NULL,
|
||||||
|
ADD COLUMN `code` VARCHAR(191) NULL,
|
||||||
|
ADD COLUMN `first_activated_at` DATETIME(3) NULL,
|
||||||
|
ADD COLUMN `os` VARCHAR(191) NULL,
|
||||||
|
ADD COLUMN `query_count` INTEGER NULL,
|
||||||
|
ADD COLUMN `sku` VARCHAR(191) NULL;
|
||||||
|
|
||||||
|
-- CreateIndex
|
||||||
|
CREATE INDEX `artwork_audit_status_idx` ON `artwork`(`audit_status`);
|
||||||
|
|
||||||
|
-- CreateIndex
|
||||||
|
CREATE INDEX `query_log_sku_idx` ON `query_log`(`sku`);
|
||||||
|
|
||||||
|
-- CreateIndex
|
||||||
|
CREATE INDEX `query_log_batch_no_idx` ON `query_log`(`batch_no`);
|
||||||
@@ -40,6 +40,12 @@ enum ArtworkStatus {
|
|||||||
DISABLED
|
DISABLED
|
||||||
}
|
}
|
||||||
|
|
||||||
|
enum AuditStatus {
|
||||||
|
PENDING
|
||||||
|
APPROVED
|
||||||
|
REJECTED
|
||||||
|
}
|
||||||
|
|
||||||
enum NodeType {
|
enum NodeType {
|
||||||
CREATE
|
CREATE
|
||||||
PRODUCE
|
PRODUCE
|
||||||
@@ -152,6 +158,10 @@ model Artwork {
|
|||||||
dynamicFields Json? @map("dynamic_fields")
|
dynamicFields Json? @map("dynamic_fields")
|
||||||
images Json?
|
images Json?
|
||||||
status ArtworkStatus @default(DRAFT)
|
status ArtworkStatus @default(DRAFT)
|
||||||
|
auditStatus AuditStatus @default(PENDING) @map("audit_status")
|
||||||
|
auditRemark String? @map("audit_remark")
|
||||||
|
auditedBy Int? @map("audited_by")
|
||||||
|
auditedAt DateTime? @map("audited_at")
|
||||||
createdBy Int? @map("created_by")
|
createdBy Int? @map("created_by")
|
||||||
createdAt DateTime @default(now()) @map("created_at")
|
createdAt DateTime @default(now()) @map("created_at")
|
||||||
updatedAt DateTime @updatedAt @map("updated_at")
|
updatedAt DateTime @updatedAt @map("updated_at")
|
||||||
@@ -165,6 +175,7 @@ model Artwork {
|
|||||||
|
|
||||||
@@index([templateId])
|
@@index([templateId])
|
||||||
@@index([status])
|
@@index([status])
|
||||||
|
@@index([auditStatus])
|
||||||
@@map("artwork")
|
@@map("artwork")
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -279,21 +290,31 @@ model BlockchainProof {
|
|||||||
}
|
}
|
||||||
|
|
||||||
model QueryLog {
|
model QueryLog {
|
||||||
id BigInt @id @default(autoincrement())
|
id BigInt @id @default(autoincrement())
|
||||||
traceCodeId BigInt? @map("trace_code_id")
|
traceCodeId BigInt? @map("trace_code_id")
|
||||||
artworkId Int? @map("artwork_id")
|
artworkId Int? @map("artwork_id")
|
||||||
shortCode String? @map("short_code")
|
shortCode String? @map("short_code")
|
||||||
queriedAt DateTime @default(now()) @map("queried_at")
|
code String?
|
||||||
queryResult QueryResult @map("query_result")
|
sku String?
|
||||||
ip String?
|
archiveNo String? @map("archive_no")
|
||||||
region String?
|
batchNo String? @map("batch_no")
|
||||||
userAgent String? @db.Text @map("user_agent")
|
queryCount Int? @map("query_count")
|
||||||
deviceType String? @map("device_type")
|
firstActivatedAt DateTime? @map("first_activated_at")
|
||||||
|
queriedAt DateTime @default(now()) @map("queried_at")
|
||||||
|
queryResult QueryResult @map("query_result")
|
||||||
|
ip String?
|
||||||
|
region String?
|
||||||
|
userAgent String? @db.Text @map("user_agent")
|
||||||
|
deviceType String? @map("device_type")
|
||||||
|
browser String?
|
||||||
|
os String?
|
||||||
|
|
||||||
traceCode TraceCode? @relation(fields: [traceCodeId], references: [id])
|
traceCode TraceCode? @relation(fields: [traceCodeId], references: [id])
|
||||||
|
|
||||||
@@index([traceCodeId])
|
@@index([traceCodeId])
|
||||||
@@index([queriedAt])
|
@@index([queriedAt])
|
||||||
|
@@index([sku])
|
||||||
|
@@index([batchNo])
|
||||||
@@map("query_log")
|
@@map("query_log")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { PrismaClient, RoleType } from '@prisma/client';
|
import { PrismaClient, RoleType, AuditStatus } from '@prisma/client';
|
||||||
import * as bcrypt from 'bcryptjs';
|
import * as bcrypt from 'bcryptjs';
|
||||||
import { existsSync, mkdirSync, writeFileSync } from 'fs';
|
import { existsSync, mkdirSync, writeFileSync } from 'fs';
|
||||||
import { dirname, join, resolve } from 'path';
|
import { dirname, join, resolve } from 'path';
|
||||||
@@ -108,6 +108,9 @@ async function ensureSampleData(): Promise<void> {
|
|||||||
title: s.title,
|
title: s.title,
|
||||||
artist: s.artist,
|
artist: s.artist,
|
||||||
status: 'ACTIVE',
|
status: 'ACTIVE',
|
||||||
|
auditStatus: AuditStatus.APPROVED,
|
||||||
|
auditedBy: admin?.id,
|
||||||
|
auditedAt: new Date(),
|
||||||
createdBy: admin?.id,
|
createdBy: admin?.id,
|
||||||
dynamicFields: { craft: s.craft, material: s.material, size: s.size, year: s.year },
|
dynamicFields: { craft: s.craft, material: s.material, size: s.size, year: s.year },
|
||||||
images: [
|
images: [
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
import { Module } from '@nestjs/common';
|
import { Module } from '@nestjs/common';
|
||||||
import { ConfigModule } from '@nestjs/config';
|
import { ConfigModule } from '@nestjs/config';
|
||||||
|
import { ScheduleModule } from '@nestjs/schedule';
|
||||||
import configuration from './config/configuration';
|
import configuration from './config/configuration';
|
||||||
import { PrismaModule } from './prisma/prisma.module';
|
import { PrismaModule } from './prisma/prisma.module';
|
||||||
import { AppController } from './app.controller';
|
import { AppController } from './app.controller';
|
||||||
@@ -30,6 +31,7 @@ import { SettingsModule } from './settings/settings.module';
|
|||||||
load: [configuration],
|
load: [configuration],
|
||||||
envFilePath: ['../../.env', '.env'],
|
envFilePath: ['../../.env', '.env'],
|
||||||
}),
|
}),
|
||||||
|
ScheduleModule.forRoot(),
|
||||||
PrismaModule,
|
PrismaModule,
|
||||||
RedisModule,
|
RedisModule,
|
||||||
StorageModule,
|
StorageModule,
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ import { Body, Controller, Delete, Get, Param, ParseIntPipe, Post, Put, Query }
|
|||||||
import { ApiBearerAuth, ApiOperation, ApiTags } from '@nestjs/swagger';
|
import { ApiBearerAuth, ApiOperation, ApiTags } from '@nestjs/swagger';
|
||||||
import { RoleType } from '@artveris/shared';
|
import { RoleType } from '@artveris/shared';
|
||||||
import { ArtworkService } from './artwork.service';
|
import { ArtworkService } from './artwork.service';
|
||||||
import { CreateArtworkDto, QueryArtworkDto, UpdateArtworkDto } from './dto/artwork.dto';
|
import { AuditArtworkDto, CreateArtworkDto, QueryArtworkDto, UpdateArtworkDto } from './dto/artwork.dto';
|
||||||
import { Roles } from '../common/decorators/roles.decorator';
|
import { Roles } from '../common/decorators/roles.decorator';
|
||||||
import { CurrentUser, AuthUser } from '../common/decorators/current-user.decorator';
|
import { CurrentUser, AuthUser } from '../common/decorators/current-user.decorator';
|
||||||
|
|
||||||
@@ -38,6 +38,17 @@ export class ArtworkController {
|
|||||||
return this.artworkService.update(id, dto);
|
return this.artworkService.update(id, dto);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Post(':id/audit')
|
||||||
|
@Roles(RoleType.AUDITOR)
|
||||||
|
@ApiOperation({ summary: '审核艺术品(通过/驳回,审核员)' })
|
||||||
|
audit(
|
||||||
|
@Param('id', ParseIntPipe) id: number,
|
||||||
|
@Body() dto: AuditArtworkDto,
|
||||||
|
@CurrentUser() user: AuthUser,
|
||||||
|
) {
|
||||||
|
return this.artworkService.audit(id, dto, user.id);
|
||||||
|
}
|
||||||
|
|
||||||
@Delete(':id')
|
@Delete(':id')
|
||||||
@Roles(RoleType.OPERATOR)
|
@Roles(RoleType.OPERATOR)
|
||||||
@ApiOperation({ summary: '停用/删除艺术品(软删除)' })
|
@ApiOperation({ summary: '停用/删除艺术品(软删除)' })
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
import { Injectable } from '@nestjs/common';
|
import { Injectable } from '@nestjs/common';
|
||||||
import { Prisma } from '@prisma/client';
|
import { Prisma } from '@prisma/client';
|
||||||
import { ArtworkStatus, ErrorCode } from '@artveris/shared';
|
import { AuditStatus, ErrorCode } from '@artveris/shared';
|
||||||
import { PrismaService } from '../prisma/prisma.service';
|
import { PrismaService } from '../prisma/prisma.service';
|
||||||
import { StorageService } from '../storage/storage.service';
|
import { StorageService } from '../storage/storage.service';
|
||||||
import { BusinessException } from '../common/exceptions/business.exception';
|
import { BusinessException } from '../common/exceptions/business.exception';
|
||||||
import { buildPage } from '../common/utils/pagination.util';
|
import { buildPage } from '../common/utils/pagination.util';
|
||||||
import { CreateArtworkDto, QueryArtworkDto, UpdateArtworkDto } from './dto/artwork.dto';
|
import { AuditArtworkDto, CreateArtworkDto, QueryArtworkDto, UpdateArtworkDto } from './dto/artwork.dto';
|
||||||
|
|
||||||
interface MediaItem {
|
interface MediaItem {
|
||||||
key: string;
|
key: string;
|
||||||
@@ -54,6 +54,7 @@ export class ArtworkService {
|
|||||||
];
|
];
|
||||||
}
|
}
|
||||||
if (query.status) where.status = query.status;
|
if (query.status) where.status = query.status;
|
||||||
|
if (query.auditStatus) where.auditStatus = query.auditStatus;
|
||||||
if (query.templateId) where.templateId = query.templateId;
|
if (query.templateId) where.templateId = query.templateId;
|
||||||
|
|
||||||
const [rows, total] = await this.prisma.$transaction([
|
const [rows, total] = await this.prisma.$transaction([
|
||||||
@@ -105,6 +106,11 @@ export class ArtworkService {
|
|||||||
title: dto.title,
|
title: dto.title,
|
||||||
artist: dto.artist,
|
artist: dto.artist,
|
||||||
status: dto.status,
|
status: dto.status,
|
||||||
|
// 内容变更需重新审核:编辑后回到待审核
|
||||||
|
auditStatus: AuditStatus.PENDING,
|
||||||
|
auditRemark: null,
|
||||||
|
auditedBy: null,
|
||||||
|
auditedAt: null,
|
||||||
};
|
};
|
||||||
if (dto.dynamicFields !== undefined) {
|
if (dto.dynamicFields !== undefined) {
|
||||||
data.dynamicFields = dto.dynamicFields as Prisma.InputJsonValue;
|
data.dynamicFields = dto.dynamicFields as Prisma.InputJsonValue;
|
||||||
@@ -116,6 +122,21 @@ export class ArtworkService {
|
|||||||
return this.get(id);
|
return this.get(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 审核:通过 / 驳回(审核员或超管)
|
||||||
|
async audit(id: number, dto: AuditArtworkDto, auditorId: number) {
|
||||||
|
await this.ensureExists(id);
|
||||||
|
await this.prisma.artwork.update({
|
||||||
|
where: { id },
|
||||||
|
data: {
|
||||||
|
auditStatus: dto.approved ? AuditStatus.APPROVED : AuditStatus.REJECTED,
|
||||||
|
auditRemark: dto.remark ?? null,
|
||||||
|
auditedBy: auditorId,
|
||||||
|
auditedAt: new Date(),
|
||||||
|
},
|
||||||
|
});
|
||||||
|
return this.get(id);
|
||||||
|
}
|
||||||
|
|
||||||
async remove(id: number) {
|
async remove(id: number) {
|
||||||
await this.ensureExists(id);
|
await this.ensureExists(id);
|
||||||
await this.prisma.artwork.update({ where: { id }, data: { deletedAt: new Date() } });
|
await this.prisma.artwork.update({ where: { id }, data: { deletedAt: new Date() } });
|
||||||
|
|||||||
@@ -11,7 +11,8 @@ import {
|
|||||||
MaxLength,
|
MaxLength,
|
||||||
ValidateNested,
|
ValidateNested,
|
||||||
} from 'class-validator';
|
} from 'class-validator';
|
||||||
import { ArtworkStatus } from '@artveris/shared';
|
import { IsBoolean } from 'class-validator';
|
||||||
|
import { ArtworkStatus, AuditStatus } from '@artveris/shared';
|
||||||
import { PaginationDto } from '../../common/dto/pagination.dto';
|
import { PaginationDto } from '../../common/dto/pagination.dto';
|
||||||
|
|
||||||
export class MediaItemDto {
|
export class MediaItemDto {
|
||||||
@@ -104,9 +105,26 @@ export class QueryArtworkDto extends PaginationDto {
|
|||||||
@IsEnum(ArtworkStatus)
|
@IsEnum(ArtworkStatus)
|
||||||
status?: ArtworkStatus;
|
status?: ArtworkStatus;
|
||||||
|
|
||||||
|
@ApiPropertyOptional({ description: '审核状态', enum: AuditStatus })
|
||||||
|
@IsOptional()
|
||||||
|
@IsEnum(AuditStatus)
|
||||||
|
auditStatus?: AuditStatus;
|
||||||
|
|
||||||
@ApiPropertyOptional({ description: '模板 ID' })
|
@ApiPropertyOptional({ description: '模板 ID' })
|
||||||
@IsOptional()
|
@IsOptional()
|
||||||
@Type(() => Number)
|
@Type(() => Number)
|
||||||
@IsInt()
|
@IsInt()
|
||||||
templateId?: number;
|
templateId?: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export class AuditArtworkDto {
|
||||||
|
@ApiProperty({ description: '是否通过' })
|
||||||
|
@IsBoolean()
|
||||||
|
approved!: boolean;
|
||||||
|
|
||||||
|
@ApiPropertyOptional({ description: '审核意见(驳回建议填写)' })
|
||||||
|
@IsOptional()
|
||||||
|
@IsString()
|
||||||
|
@MaxLength(255)
|
||||||
|
remark?: string;
|
||||||
|
}
|
||||||
|
|||||||
@@ -1,11 +1,12 @@
|
|||||||
export interface DeviceInfo {
|
export interface DeviceInfo {
|
||||||
deviceType: string; // Mobile | Tablet | PC
|
deviceType: string; // Mobile | Tablet | PC
|
||||||
os: string;
|
os: string;
|
||||||
|
browser: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 轻量 User-Agent 解析,用于查询日志风控统计。
|
// 轻量 User-Agent 解析,用于查询日志风控统计。
|
||||||
export function parseUserAgent(ua?: string): DeviceInfo {
|
export function parseUserAgent(ua?: string): DeviceInfo {
|
||||||
if (!ua) return { deviceType: 'Unknown', os: 'Unknown' };
|
if (!ua) return { deviceType: 'Unknown', os: 'Unknown', browser: 'Unknown' };
|
||||||
const s = ua.toLowerCase();
|
const s = ua.toLowerCase();
|
||||||
let deviceType = 'PC';
|
let deviceType = 'PC';
|
||||||
if (/ipad|tablet/.test(s)) deviceType = 'Tablet';
|
if (/ipad|tablet/.test(s)) deviceType = 'Tablet';
|
||||||
@@ -18,7 +19,16 @@ export function parseUserAgent(ua?: string): DeviceInfo {
|
|||||||
else if (/mac os|macintosh/.test(s)) os = 'macOS';
|
else if (/mac os|macintosh/.test(s)) os = 'macOS';
|
||||||
else if (/linux/.test(s)) os = 'Linux';
|
else if (/linux/.test(s)) os = 'Linux';
|
||||||
|
|
||||||
return { deviceType, os };
|
// 浏览器/客户端识别(顺序敏感:微信/Edge 需在通用 Chrome 之前判断)
|
||||||
|
let browser = 'Unknown';
|
||||||
|
if (/micromessenger/.test(s)) browser = 'WeChat';
|
||||||
|
else if (/edg/.test(s)) browser = 'Edge';
|
||||||
|
else if (/opr|opera/.test(s)) browser = 'Opera';
|
||||||
|
else if (/firefox|fxios/.test(s)) browser = 'Firefox';
|
||||||
|
else if (/chrome|crios/.test(s)) browser = 'Chrome';
|
||||||
|
else if (/safari/.test(s)) browser = 'Safari';
|
||||||
|
|
||||||
|
return { deviceType, os, browser };
|
||||||
}
|
}
|
||||||
|
|
||||||
// 从请求中提取真实客户端 IP(兼容反向代理)。
|
// 从请求中提取真实客户端 IP(兼容反向代理)。
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
import { ApiPropertyOptional } from '@nestjs/swagger';
|
import { ApiPropertyOptional } from '@nestjs/swagger';
|
||||||
import { IsDateString, IsOptional, IsString, MaxLength } from 'class-validator';
|
import { Type } from 'class-transformer';
|
||||||
|
import { IsDateString, IsInt, IsOptional, IsString, MaxLength, Min } from 'class-validator';
|
||||||
|
|
||||||
export class OutboundDto {
|
export class OutboundDto {
|
||||||
@ApiPropertyOptional({ description: 'SKU' })
|
@ApiPropertyOptional({ description: 'SKU' })
|
||||||
@@ -24,6 +25,24 @@ export class OutboundDto {
|
|||||||
@IsString()
|
@IsString()
|
||||||
outImageKey?: string;
|
outImageKey?: string;
|
||||||
|
|
||||||
|
@ApiPropertyOptional({ description: '上链哈希值(填写则记录上链结果)' })
|
||||||
|
@IsOptional()
|
||||||
|
@IsString()
|
||||||
|
@MaxLength(255)
|
||||||
|
txHash?: string;
|
||||||
|
|
||||||
|
@ApiPropertyOptional({ description: '上链时间' })
|
||||||
|
@IsOptional()
|
||||||
|
@IsDateString()
|
||||||
|
onchainAt?: string;
|
||||||
|
|
||||||
|
@ApiPropertyOptional({ description: '区块高度' })
|
||||||
|
@IsOptional()
|
||||||
|
@Type(() => Number)
|
||||||
|
@IsInt()
|
||||||
|
@Min(0)
|
||||||
|
blockHeight?: number;
|
||||||
|
|
||||||
@ApiPropertyOptional({ description: '备注' })
|
@ApiPropertyOptional({ description: '备注' })
|
||||||
@IsOptional()
|
@IsOptional()
|
||||||
@IsString()
|
@IsString()
|
||||||
|
|||||||
@@ -1,12 +1,34 @@
|
|||||||
import { Processor, WorkerHost } from '@nestjs/bullmq';
|
import { Processor, WorkerHost } from '@nestjs/bullmq';
|
||||||
import { Logger } from '@nestjs/common';
|
import { Logger } from '@nestjs/common';
|
||||||
import { Job } from 'bullmq';
|
import { Job } from 'bullmq';
|
||||||
|
import { createHash } from 'crypto';
|
||||||
import * as ExcelJS from 'exceljs';
|
import * as ExcelJS from 'exceljs';
|
||||||
import { JobStatus, OUTBOUND_IMPORT_COLUMNS, QUEUE_NAMES } from '@artveris/shared';
|
import { JobStatus, OUTBOUND_IMPORT_COLUMNS, ProofStatus, QUEUE_NAMES } from '@artveris/shared';
|
||||||
import { PrismaService } from '../prisma/prisma.service';
|
import { PrismaService } from '../prisma/prisma.service';
|
||||||
import { StorageService } from '../storage/storage.service';
|
import { StorageService } from '../storage/storage.service';
|
||||||
import { JobsService } from '../jobs/jobs.service';
|
import { JobsService } from '../jobs/jobs.service';
|
||||||
|
|
||||||
|
// 将 ExcelJS 单元格值规整为字符串(兼容 Date / 富文本 / 公式结果 / 超链接 / 数字)
|
||||||
|
function cellToString(v: unknown): string {
|
||||||
|
if (v === null || v === undefined) return '';
|
||||||
|
if (v instanceof Date) return v.toISOString();
|
||||||
|
if (typeof v === 'object') {
|
||||||
|
const o = v as Record<string, unknown>;
|
||||||
|
if (typeof o.text === 'string') return o.text.trim();
|
||||||
|
if (o.result !== undefined && o.result !== null) return String(o.result).trim();
|
||||||
|
if (Array.isArray(o.richText)) return o.richText.map((r: any) => r.text).join('').trim();
|
||||||
|
if (o.hyperlink) return String(o.hyperlink).trim();
|
||||||
|
}
|
||||||
|
return String(v).trim();
|
||||||
|
}
|
||||||
|
|
||||||
|
// 校验并解析日期,非法返回 null(区分 undefined=未填)
|
||||||
|
function parseDate(v?: string): Date | undefined | null {
|
||||||
|
if (!v) return undefined;
|
||||||
|
const d = new Date(v);
|
||||||
|
return isNaN(d.getTime()) ? null : d;
|
||||||
|
}
|
||||||
|
|
||||||
interface ImportJobData {
|
interface ImportJobData {
|
||||||
jobId: string;
|
jobId: string;
|
||||||
fileKey: string;
|
fileKey: string;
|
||||||
@@ -55,8 +77,7 @@ export class ImportProcessor extends WorkerHost {
|
|||||||
const values: Record<string, string> = {};
|
const values: Record<string, string> = {};
|
||||||
let empty = true;
|
let empty = true;
|
||||||
colToKey.forEach((key, col) => {
|
colToKey.forEach((key, col) => {
|
||||||
const v = row.getCell(col).value;
|
const text = cellToString(row.getCell(col).value);
|
||||||
const text = v === null || v === undefined ? '' : String(v).trim();
|
|
||||||
if (text) empty = false;
|
if (text) empty = false;
|
||||||
values[key] = text;
|
values[key] = text;
|
||||||
});
|
});
|
||||||
@@ -74,22 +95,76 @@ export class ImportProcessor extends WorkerHost {
|
|||||||
fail++;
|
fail++;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
const code = await this.prisma.traceCode.findUnique({ where: { shortCode } });
|
const code = await this.prisma.traceCode.findUnique({
|
||||||
|
where: { shortCode },
|
||||||
|
include: { batch: true },
|
||||||
|
});
|
||||||
if (!code) {
|
if (!code) {
|
||||||
row.reason = '短码不存在';
|
row.reason = '短码不存在';
|
||||||
fail++;
|
fail++;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
// 批次编号核对:填写则必须与该码实际批次一致
|
||||||
|
if (row.values.batchNo && row.values.batchNo !== (code.batch?.batchNo ?? '')) {
|
||||||
|
row.reason = `批次编号与该码实际批次不符(实际:${code.batch?.batchNo ?? '无'})`;
|
||||||
|
fail++;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
// 字段格式校验
|
||||||
|
const outTime = parseDate(row.values.outTime);
|
||||||
|
if (outTime === null) {
|
||||||
|
row.reason = '出库时间格式不正确(应为 YYYY-MM-DD HH:mm)';
|
||||||
|
fail++;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
const onchainAt = parseDate(row.values.onchainAt);
|
||||||
|
if (onchainAt === null) {
|
||||||
|
row.reason = '上链时间格式不正确(应为 YYYY-MM-DD HH:mm)';
|
||||||
|
fail++;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
let blockHeight: bigint | undefined;
|
||||||
|
if (row.values.blockHeight) {
|
||||||
|
if (!/^\d+$/.test(row.values.blockHeight)) {
|
||||||
|
row.reason = '区块高度应为整数';
|
||||||
|
fail++;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
blockHeight = BigInt(row.values.blockHeight);
|
||||||
|
}
|
||||||
try {
|
try {
|
||||||
await this.prisma.traceCode.update({
|
await this.prisma.traceCode.update({
|
||||||
where: { id: code.id },
|
where: { id: code.id },
|
||||||
data: {
|
data: {
|
||||||
sku: row.values.sku || undefined,
|
sku: row.values.sku || undefined,
|
||||||
archiveNo: row.values.archiveNo || undefined,
|
archiveNo: row.values.archiveNo || undefined,
|
||||||
outTime: row.values.outTime ? new Date(row.values.outTime) : undefined,
|
outTime: outTime ?? undefined,
|
||||||
|
outImage: row.values.outImage || undefined,
|
||||||
remark: row.values.remark || undefined,
|
remark: row.values.remark || undefined,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
// 录入上链哈希则登记一条已上链存证(同码同哈希去重,避免重复导入污染)
|
||||||
|
if (row.values.txHash) {
|
||||||
|
const dup = await this.prisma.blockchainProof.findFirst({
|
||||||
|
where: { traceCodeId: code.id, txHash: row.values.txHash },
|
||||||
|
});
|
||||||
|
if (!dup) {
|
||||||
|
const dataHash =
|
||||||
|
'0x' + createHash('sha256').update(`${code.code}:${row.values.txHash}`).digest('hex');
|
||||||
|
await this.prisma.blockchainProof.create({
|
||||||
|
data: {
|
||||||
|
traceCodeId: code.id,
|
||||||
|
dataHash,
|
||||||
|
txHash: row.values.txHash,
|
||||||
|
blockHeight: blockHeight ?? null,
|
||||||
|
chainName: '手工登记',
|
||||||
|
onchainAt: onchainAt ?? new Date(),
|
||||||
|
status: ProofStatus.ONCHAIN,
|
||||||
|
rawResponse: { source: 'import' },
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
row.ok = true;
|
row.ok = true;
|
||||||
success++;
|
success++;
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
|||||||
@@ -2,14 +2,27 @@ import { Injectable } from '@nestjs/common';
|
|||||||
import { InjectQueue } from '@nestjs/bullmq';
|
import { InjectQueue } from '@nestjs/bullmq';
|
||||||
import { Queue } from 'bullmq';
|
import { Queue } from 'bullmq';
|
||||||
import { Response } from 'express';
|
import { Response } from 'express';
|
||||||
|
import { createHash } from 'crypto';
|
||||||
import * as ExcelJS from 'exceljs';
|
import * as ExcelJS from 'exceljs';
|
||||||
import { ErrorCode, JobType, OUTBOUND_IMPORT_COLUMNS, QUEUE_NAMES } from '@artveris/shared';
|
import {
|
||||||
|
ErrorCode,
|
||||||
|
JobType,
|
||||||
|
OUTBOUND_IMPORT_COLUMNS,
|
||||||
|
ProofStatus,
|
||||||
|
QUEUE_NAMES,
|
||||||
|
} from '@artveris/shared';
|
||||||
import { PrismaService } from '../prisma/prisma.service';
|
import { PrismaService } from '../prisma/prisma.service';
|
||||||
import { StorageService } from '../storage/storage.service';
|
import { StorageService } from '../storage/storage.service';
|
||||||
import { JobsService } from '../jobs/jobs.service';
|
import { JobsService } from '../jobs/jobs.service';
|
||||||
import { BusinessException } from '../common/exceptions/business.exception';
|
import { BusinessException } from '../common/exceptions/business.exception';
|
||||||
import { OutboundDto } from './dto/outbound.dto';
|
import { OutboundDto } from './dto/outbound.dto';
|
||||||
|
|
||||||
|
const XLSX_MIME_TYPES = [
|
||||||
|
'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
|
||||||
|
'application/vnd.ms-excel',
|
||||||
|
'application/octet-stream', // 某些浏览器对 .xlsx 的兜底类型
|
||||||
|
];
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class OutboundService {
|
export class OutboundService {
|
||||||
constructor(
|
constructor(
|
||||||
@@ -22,7 +35,7 @@ export class OutboundService {
|
|||||||
async updateSingle(traceCodeId: bigint, dto: OutboundDto) {
|
async updateSingle(traceCodeId: bigint, dto: OutboundDto) {
|
||||||
const code = await this.prisma.traceCode.findUnique({ where: { id: traceCodeId } });
|
const code = await this.prisma.traceCode.findUnique({ where: { id: traceCodeId } });
|
||||||
if (!code) throw new BusinessException(ErrorCode.TRACE_CODE_NOT_FOUND, '追溯码不存在', 404);
|
if (!code) throw new BusinessException(ErrorCode.TRACE_CODE_NOT_FOUND, '追溯码不存在', 404);
|
||||||
return this.prisma.traceCode.update({
|
const updated = await this.prisma.traceCode.update({
|
||||||
where: { id: traceCodeId },
|
where: { id: traceCodeId },
|
||||||
data: {
|
data: {
|
||||||
sku: dto.sku,
|
sku: dto.sku,
|
||||||
@@ -32,6 +45,42 @@ export class OutboundService {
|
|||||||
remark: dto.remark,
|
remark: dto.remark,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
// 录入了上链哈希则记录一条已上链存证(手工登记,不触发 Mock 链)
|
||||||
|
if (dto.txHash) {
|
||||||
|
await this.recordProof(traceCodeId, code.code, {
|
||||||
|
txHash: dto.txHash,
|
||||||
|
onchainAt: dto.onchainAt ? new Date(dto.onchainAt) : new Date(),
|
||||||
|
blockHeight: dto.blockHeight,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
return updated;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 手工登记上链结果:写入一条 ONCHAIN 存证(数据哈希由 code+txHash 派生)
|
||||||
|
// 同码同哈希去重:重复保存不会产生多条存证
|
||||||
|
private async recordProof(
|
||||||
|
traceCodeId: bigint,
|
||||||
|
code: string,
|
||||||
|
p: { txHash: string; onchainAt: Date; blockHeight?: number },
|
||||||
|
) {
|
||||||
|
const dup = await this.prisma.blockchainProof.findFirst({
|
||||||
|
where: { traceCodeId, txHash: p.txHash },
|
||||||
|
});
|
||||||
|
if (dup) return;
|
||||||
|
const dataHash =
|
||||||
|
'0x' + createHash('sha256').update(`${code}:${p.txHash}`).digest('hex');
|
||||||
|
await this.prisma.blockchainProof.create({
|
||||||
|
data: {
|
||||||
|
traceCodeId,
|
||||||
|
dataHash,
|
||||||
|
txHash: p.txHash,
|
||||||
|
blockHeight: p.blockHeight !== undefined ? BigInt(p.blockHeight) : null,
|
||||||
|
chainName: '手工登记',
|
||||||
|
onchainAt: p.onchainAt,
|
||||||
|
status: ProofStatus.ONCHAIN,
|
||||||
|
rawResponse: { source: 'manual' },
|
||||||
|
},
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
async generateTemplate(res: Response): Promise<void> {
|
async generateTemplate(res: Response): Promise<void> {
|
||||||
@@ -65,6 +114,11 @@ export class OutboundService {
|
|||||||
|
|
||||||
async startImport(file: Express.Multer.File, userId: number) {
|
async startImport(file: Express.Multer.File, userId: number) {
|
||||||
if (!file) throw new BusinessException(ErrorCode.BAD_REQUEST, '请上传导入文件');
|
if (!file) throw new BusinessException(ErrorCode.BAD_REQUEST, '请上传导入文件');
|
||||||
|
const name = (file.originalname || '').toLowerCase();
|
||||||
|
const okType = XLSX_MIME_TYPES.includes(file.mimetype) || name.endsWith('.xlsx') || name.endsWith('.xls');
|
||||||
|
if (!okType) {
|
||||||
|
throw new BusinessException(ErrorCode.FILE_TYPE_NOT_ALLOWED, '仅支持 Excel(.xlsx/.xls)文件导入');
|
||||||
|
}
|
||||||
const saved = await this.storage.save(file.buffer, file.originalname || 'import.xlsx', file.mimetype);
|
const saved = await this.storage.save(file.buffer, file.originalname || 'import.xlsx', file.mimetype);
|
||||||
const job = await this.jobs.create(JobType.IMPORT_OUTBOUND, 0, userId, { fileKey: saved.key });
|
const job = await this.jobs.create(JobType.IMPORT_OUTBOUND, 0, userId, { fileKey: saved.key });
|
||||||
await this.queue.add('import', { jobId: job.id, fileKey: saved.key });
|
await this.queue.add('import', { jobId: job.id, fileKey: saved.key });
|
||||||
|
|||||||
@@ -1,12 +1,15 @@
|
|||||||
import { Inject, Injectable, Logger } from '@nestjs/common';
|
import { Inject, Injectable, Logger } from '@nestjs/common';
|
||||||
import type Redis from 'ioredis';
|
import type Redis from 'ioredis';
|
||||||
import { ArtworkStatus, QueryResult, ProofStatus, TraceCodeStatus } from '@artveris/shared';
|
import { Prisma } from '@prisma/client';
|
||||||
|
import { ArtworkStatus, AuditStatus, QueryResult, ProofStatus, TraceCodeStatus } from '@artveris/shared';
|
||||||
import { PrismaService } from '../prisma/prisma.service';
|
import { PrismaService } from '../prisma/prisma.service';
|
||||||
import { StorageService } from '../storage/storage.service';
|
import { StorageService } from '../storage/storage.service';
|
||||||
import { GeoService } from '../geo/geo.service';
|
import { GeoService } from '../geo/geo.service';
|
||||||
import { REDIS_CLIENT } from '../redis/redis.module';
|
import { REDIS_CLIENT } from '../redis/redis.module';
|
||||||
import { parseUserAgent } from '../common/utils/ua.util';
|
import { parseUserAgent } from '../common/utils/ua.util';
|
||||||
|
|
||||||
|
type TraceCodeWithBatch = Prisma.TraceCodeGetPayload<{ include: { batch: true } }>;
|
||||||
|
|
||||||
export interface TraceContext {
|
export interface TraceContext {
|
||||||
ip: string;
|
ip: string;
|
||||||
userAgent?: string;
|
userAgent?: string;
|
||||||
@@ -52,17 +55,17 @@ export class PublicTraceService {
|
|||||||
return { status: 'INVALID' as const };
|
return { status: 'INVALID' as const };
|
||||||
}
|
}
|
||||||
|
|
||||||
const code = await this.prisma.traceCode.findUnique({ where: { id } });
|
const code = await this.prisma.traceCode.findUnique({ where: { id }, include: { batch: true } });
|
||||||
if (!code || !code.artworkId || code.status === TraceCodeStatus.UNBOUND) {
|
if (!code || !code.artworkId || code.status === TraceCodeStatus.UNBOUND) {
|
||||||
await this.writeLog(id, null, shortCode, QueryResult.INVALID, ctx);
|
await this.writeLog(id, null, shortCode, QueryResult.INVALID, ctx, code ?? undefined);
|
||||||
return { status: 'INVALID' as const };
|
return { status: 'INVALID' as const };
|
||||||
}
|
}
|
||||||
if (code.status === TraceCodeStatus.DISABLED) {
|
if (code.status === TraceCodeStatus.DISABLED) {
|
||||||
await this.writeLog(id, code.artworkId, shortCode, QueryResult.DISABLED, ctx);
|
await this.writeLog(id, code.artworkId, shortCode, QueryResult.DISABLED, ctx, code);
|
||||||
return { status: 'DISABLED' as const };
|
return { status: 'DISABLED' as const };
|
||||||
}
|
}
|
||||||
if (code.status === TraceCodeStatus.ABNORMAL) {
|
if (code.status === TraceCodeStatus.ABNORMAL) {
|
||||||
await this.writeLog(id, code.artworkId, shortCode, QueryResult.ABNORMAL, ctx);
|
await this.writeLog(id, code.artworkId, shortCode, QueryResult.ABNORMAL, ctx, code);
|
||||||
return { status: 'ABNORMAL' as const };
|
return { status: 'ABNORMAL' as const };
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -74,8 +77,13 @@ export class PublicTraceService {
|
|||||||
certificates: { orderBy: { id: 'asc' } },
|
certificates: { orderBy: { id: 'asc' } },
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
if (!artwork || artwork.status === ArtworkStatus.DISABLED) {
|
// 仅展示「未停用」且「审核通过」的作品,否则视为无效,避免未审核数据外泄
|
||||||
await this.writeLog(id, code.artworkId, shortCode, QueryResult.INVALID, ctx);
|
if (
|
||||||
|
!artwork ||
|
||||||
|
artwork.status === ArtworkStatus.DISABLED ||
|
||||||
|
artwork.auditStatus !== AuditStatus.APPROVED
|
||||||
|
) {
|
||||||
|
await this.writeLog(id, code.artworkId, shortCode, QueryResult.INVALID, ctx, code);
|
||||||
return { status: 'INVALID' as const };
|
return { status: 'INVALID' as const };
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -107,10 +115,12 @@ export class PublicTraceService {
|
|||||||
});
|
});
|
||||||
|
|
||||||
const result = firstActivate ? QueryResult.FIRST_ACTIVATE : QueryResult.REPEAT;
|
const result = firstActivate ? QueryResult.FIRST_ACTIVATE : QueryResult.REPEAT;
|
||||||
await this.writeLog(id, artwork.id, shortCode, result, ctx);
|
await this.writeLog(id, artwork.id, shortCode, result, ctx, { ...code, ...updated });
|
||||||
|
|
||||||
return {
|
return {
|
||||||
status: 'OK' as const,
|
status: 'OK' as const,
|
||||||
|
code: code.code,
|
||||||
|
queriedAt: now,
|
||||||
antiCounterfeit: {
|
antiCounterfeit: {
|
||||||
firstQuery: firstActivate,
|
firstQuery: firstActivate,
|
||||||
queryCount: updated.queryCount,
|
queryCount: updated.queryCount,
|
||||||
@@ -157,7 +167,19 @@ export class PublicTraceService {
|
|||||||
) {
|
) {
|
||||||
const data = (dynamic as Record<string, unknown>) || {};
|
const data = (dynamic as Record<string, unknown>) || {};
|
||||||
return fields
|
return fields
|
||||||
.map((f) => ({ label: f.label, type: f.type, value: data[f.fieldKey] }))
|
.map((f) => {
|
||||||
|
let value = data[f.fieldKey];
|
||||||
|
// 图片/文件字段:若存的是存储 key(非绝对/Data URL),转为可访问 URL,避免 C 端 404
|
||||||
|
if (
|
||||||
|
(f.type === 'IMAGE' || f.type === 'FILE') &&
|
||||||
|
typeof value === 'string' &&
|
||||||
|
value &&
|
||||||
|
!/^(https?:|data:|\/)/i.test(value)
|
||||||
|
) {
|
||||||
|
value = this.storage.getUrl(value);
|
||||||
|
}
|
||||||
|
return { label: f.label, type: f.type, value };
|
||||||
|
})
|
||||||
.filter((f) => f.value !== undefined && f.value !== null && f.value !== '');
|
.filter((f) => f.value !== undefined && f.value !== null && f.value !== '');
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -167,6 +189,7 @@ export class PublicTraceService {
|
|||||||
shortCode: string,
|
shortCode: string,
|
||||||
result: QueryResult,
|
result: QueryResult,
|
||||||
ctx: TraceContext,
|
ctx: TraceContext,
|
||||||
|
code?: Partial<TraceCodeWithBatch>,
|
||||||
): Promise<void> {
|
): Promise<void> {
|
||||||
try {
|
try {
|
||||||
const device = parseUserAgent(ctx.userAgent);
|
const device = parseUserAgent(ctx.userAgent);
|
||||||
@@ -175,11 +198,19 @@ export class PublicTraceService {
|
|||||||
traceCodeId: traceCodeId ?? undefined,
|
traceCodeId: traceCodeId ?? undefined,
|
||||||
artworkId: artworkId ?? undefined,
|
artworkId: artworkId ?? undefined,
|
||||||
shortCode,
|
shortCode,
|
||||||
|
code: code?.code ?? undefined,
|
||||||
|
sku: code?.sku ?? undefined,
|
||||||
|
archiveNo: code?.archiveNo ?? undefined,
|
||||||
|
batchNo: code?.batch?.batchNo ?? undefined,
|
||||||
|
queryCount: code?.queryCount ?? undefined,
|
||||||
|
firstActivatedAt: code?.firstActivatedAt ?? undefined,
|
||||||
queryResult: result,
|
queryResult: result,
|
||||||
ip: ctx.ip,
|
ip: ctx.ip,
|
||||||
region: this.geo.resolveRegion(ctx.ip),
|
region: this.geo.resolveRegion(ctx.ip),
|
||||||
userAgent: ctx.userAgent,
|
userAgent: ctx.userAgent,
|
||||||
deviceType: device.deviceType,
|
deviceType: device.deviceType,
|
||||||
|
browser: device.browser,
|
||||||
|
os: device.os,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
|||||||
@@ -0,0 +1,37 @@
|
|||||||
|
import { Injectable, Logger } from '@nestjs/common';
|
||||||
|
import { Cron, CronExpression } from '@nestjs/schedule';
|
||||||
|
import { PrismaService } from '../prisma/prisma.service';
|
||||||
|
import { SettingsService } from '../settings/settings.service';
|
||||||
|
|
||||||
|
// 查询日志保留周期清理:每天凌晨执行,删除超过保留天数的日志。
|
||||||
|
// 保留天数取系统设置 logRetentionDays(后台可配置),<=0 表示长期保留、不清理。
|
||||||
|
@Injectable()
|
||||||
|
export class LogRetentionService {
|
||||||
|
private readonly logger = new Logger(LogRetentionService.name);
|
||||||
|
|
||||||
|
constructor(
|
||||||
|
private readonly prisma: PrismaService,
|
||||||
|
private readonly settings: SettingsService,
|
||||||
|
) {}
|
||||||
|
|
||||||
|
@Cron(CronExpression.EVERY_DAY_AT_3AM)
|
||||||
|
async cleanup(): Promise<void> {
|
||||||
|
const days = await this.resolveRetentionDays();
|
||||||
|
if (!days || days <= 0) {
|
||||||
|
this.logger.log('日志保留周期为长期保留,跳过清理');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const cutoff = new Date(Date.now() - days * 24 * 60 * 60 * 1000);
|
||||||
|
const { count } = await this.prisma.queryLog.deleteMany({
|
||||||
|
where: { queriedAt: { lt: cutoff } },
|
||||||
|
});
|
||||||
|
this.logger.log(`查询日志清理完成:删除 ${count} 条(保留 ${days} 天,截止 ${cutoff.toISOString()})`);
|
||||||
|
}
|
||||||
|
|
||||||
|
private async resolveRetentionDays(): Promise<number> {
|
||||||
|
const raw = await this.settings.get('logRetentionDays');
|
||||||
|
const n = Number(raw);
|
||||||
|
if (raw !== null && !Number.isNaN(n)) return n;
|
||||||
|
return 365;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -8,11 +8,21 @@ import { buildPage } from '../common/utils/pagination.util';
|
|||||||
import { PaginationDto } from '../common/dto/pagination.dto';
|
import { PaginationDto } from '../common/dto/pagination.dto';
|
||||||
|
|
||||||
class QueryLogQueryDto extends PaginationDto {
|
class QueryLogQueryDto extends PaginationDto {
|
||||||
@ApiPropertyOptional({ description: '关键词(短码)' })
|
@ApiPropertyOptional({ description: '关键词(短码 / 追溯码 / SKU / 档案编号)' })
|
||||||
@IsOptional()
|
@IsOptional()
|
||||||
@IsString()
|
@IsString()
|
||||||
keyword?: string;
|
keyword?: string;
|
||||||
|
|
||||||
|
@ApiPropertyOptional({ description: 'SKU' })
|
||||||
|
@IsOptional()
|
||||||
|
@IsString()
|
||||||
|
sku?: string;
|
||||||
|
|
||||||
|
@ApiPropertyOptional({ description: '批次编号' })
|
||||||
|
@IsOptional()
|
||||||
|
@IsString()
|
||||||
|
batchNo?: string;
|
||||||
|
|
||||||
@ApiPropertyOptional({ description: '查询结果', enum: QueryResult })
|
@ApiPropertyOptional({ description: '查询结果', enum: QueryResult })
|
||||||
@IsOptional()
|
@IsOptional()
|
||||||
@IsEnum(QueryResult)
|
@IsEnum(QueryResult)
|
||||||
@@ -39,7 +49,16 @@ export class QueryLogController {
|
|||||||
@ApiOperation({ summary: '查询日志列表' })
|
@ApiOperation({ summary: '查询日志列表' })
|
||||||
async list(@Query() query: QueryLogQueryDto) {
|
async list(@Query() query: QueryLogQueryDto) {
|
||||||
const where: Prisma.QueryLogWhereInput = {};
|
const where: Prisma.QueryLogWhereInput = {};
|
||||||
if (query.keyword) where.shortCode = { contains: query.keyword };
|
if (query.keyword) {
|
||||||
|
where.OR = [
|
||||||
|
{ shortCode: { contains: query.keyword } },
|
||||||
|
{ code: { contains: query.keyword } },
|
||||||
|
{ sku: { contains: query.keyword } },
|
||||||
|
{ archiveNo: { contains: query.keyword } },
|
||||||
|
];
|
||||||
|
}
|
||||||
|
if (query.sku) where.sku = { contains: query.sku };
|
||||||
|
if (query.batchNo) where.batchNo = { contains: query.batchNo };
|
||||||
if (query.result) where.queryResult = query.result;
|
if (query.result) where.queryResult = query.result;
|
||||||
if (query.startTime || query.endTime) {
|
if (query.startTime || query.endTime) {
|
||||||
where.queriedAt = {};
|
where.queriedAt = {};
|
||||||
|
|||||||
@@ -1,7 +1,9 @@
|
|||||||
import { Module } from '@nestjs/common';
|
import { Module } from '@nestjs/common';
|
||||||
import { QueryLogController } from './query-log.controller';
|
import { QueryLogController } from './query-log.controller';
|
||||||
|
import { LogRetentionService } from './log-retention.service';
|
||||||
|
|
||||||
@Module({
|
@Module({
|
||||||
controllers: [QueryLogController],
|
controllers: [QueryLogController],
|
||||||
|
providers: [LogRetentionService],
|
||||||
})
|
})
|
||||||
export class QueryLogModule {}
|
export class QueryLogModule {}
|
||||||
|
|||||||
@@ -98,6 +98,11 @@ export class BatchStatusDto {
|
|||||||
@ApiProperty({ description: 'true 停用,false 启用' })
|
@ApiProperty({ description: 'true 停用,false 启用' })
|
||||||
@IsBoolean()
|
@IsBoolean()
|
||||||
disabled!: boolean;
|
disabled!: boolean;
|
||||||
|
|
||||||
|
@ApiPropertyOptional({ description: 'true 标记为异常(优先级高于 disabled)' })
|
||||||
|
@IsOptional()
|
||||||
|
@IsBoolean()
|
||||||
|
abnormal?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
export class BindArtworkDto {
|
export class BindArtworkDto {
|
||||||
|
|||||||
@@ -101,7 +101,13 @@ export class TraceCodeService {
|
|||||||
|
|
||||||
async batchSetStatus(dto: BatchStatusDto) {
|
async batchSetStatus(dto: BatchStatusDto) {
|
||||||
const ids = dto.ids.map((i) => BigInt(i));
|
const ids = dto.ids.map((i) => BigInt(i));
|
||||||
if (dto.disabled) {
|
if (dto.abnormal) {
|
||||||
|
// 标记异常:用于运营人为标注疑似被复制/盗用的码
|
||||||
|
await this.prisma.traceCode.updateMany({
|
||||||
|
where: { id: { in: ids } },
|
||||||
|
data: { status: TraceCodeStatus.ABNORMAL },
|
||||||
|
});
|
||||||
|
} else if (dto.disabled) {
|
||||||
await this.prisma.traceCode.updateMany({
|
await this.prisma.traceCode.updateMany({
|
||||||
where: { id: { in: ids } },
|
where: { id: { in: ids } },
|
||||||
data: { status: TraceCodeStatus.DISABLED },
|
data: { status: TraceCodeStatus.DISABLED },
|
||||||
|
|||||||
@@ -15,9 +15,11 @@ import {
|
|||||||
MAX_FILE_SIZE,
|
MAX_FILE_SIZE,
|
||||||
MAX_IMAGE_SIZE,
|
MAX_IMAGE_SIZE,
|
||||||
MAX_VIDEO_SIZE,
|
MAX_VIDEO_SIZE,
|
||||||
|
RoleType,
|
||||||
} from '@artveris/shared';
|
} from '@artveris/shared';
|
||||||
import { StorageService } from '../storage/storage.service';
|
import { StorageService } from '../storage/storage.service';
|
||||||
import { BusinessException } from '../common/exceptions/business.exception';
|
import { BusinessException } from '../common/exceptions/business.exception';
|
||||||
|
import { Roles } from '../common/decorators/roles.decorator';
|
||||||
|
|
||||||
type UploadType = 'image' | 'video' | 'file';
|
type UploadType = 'image' | 'video' | 'file';
|
||||||
|
|
||||||
@@ -34,6 +36,7 @@ export class UploadController {
|
|||||||
constructor(private readonly storage: StorageService) {}
|
constructor(private readonly storage: StorageService) {}
|
||||||
|
|
||||||
@Post()
|
@Post()
|
||||||
|
@Roles(RoleType.OPERATOR)
|
||||||
@ApiOperation({ summary: '上传文件(图片/视频/文档)' })
|
@ApiOperation({ summary: '上传文件(图片/视频/文档)' })
|
||||||
@ApiConsumes('multipart/form-data')
|
@ApiConsumes('multipart/form-data')
|
||||||
@ApiQuery({ name: 'type', enum: ['image', 'video', 'file'], required: false })
|
@ApiQuery({ name: 'type', enum: ['image', 'video', 'file'], required: false })
|
||||||
|
|||||||
@@ -7,22 +7,39 @@
|
|||||||
"firstDesc": "This is the first query of the code. The artwork is genuine.",
|
"firstDesc": "This is the first query of the code. The artwork is genuine.",
|
||||||
"repeatDesc": "This code has been activated. Please note the query count.",
|
"repeatDesc": "This code has been activated. Please note the query count.",
|
||||||
"queryCount": "Queried {n} times",
|
"queryCount": "Queried {n} times",
|
||||||
"firstActivatedAt": "First activated: {t}"
|
"firstActivatedAt": "First activated: {t}",
|
||||||
|
"queriedAt": "This query: {t}",
|
||||||
|
"code": "Trace Code"
|
||||||
},
|
},
|
||||||
"section": {
|
"section": {
|
||||||
"basic": "Basic Info",
|
"basic": "Basic Info",
|
||||||
"timeline": "Provenance Timeline",
|
"timeline": "Provenance Timeline",
|
||||||
"cert": "Certificates",
|
"cert": "Certificates",
|
||||||
"chain": "Blockchain Attestation"
|
"chain": "Digital Identity & Blockchain"
|
||||||
},
|
},
|
||||||
"chain": {
|
"chain": {
|
||||||
|
"code": "Trace Code",
|
||||||
"hash": "Tx Hash",
|
"hash": "Tx Hash",
|
||||||
"dataHash": "Data Hash",
|
"dataHash": "Data Hash",
|
||||||
"blockHeight": "Block Height",
|
"blockHeight": "Block Height",
|
||||||
"onchainAt": "On-chain Time",
|
"onchainAt": "On-chain Time",
|
||||||
"explorer": "View Proof",
|
"explorer": "View Proof",
|
||||||
"copy": "Copy",
|
"copy": "Copy",
|
||||||
"copied": "Copied"
|
"copied": "Copied",
|
||||||
|
"notOnchain": "This artwork has not been recorded on-chain yet."
|
||||||
|
},
|
||||||
|
"cert": {
|
||||||
|
"type": {
|
||||||
|
"PHOTO": "Photo with Author",
|
||||||
|
"CERT": "Certificate",
|
||||||
|
"APPRAISAL": "Appraisal"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"field": {
|
||||||
|
"viewFile": "View file"
|
||||||
|
},
|
||||||
|
"privacy": {
|
||||||
|
"note": "Privacy: for anti-counterfeit risk control and query statistics, this visit's necessary info (time, IP, region and device) is recorded."
|
||||||
},
|
},
|
||||||
"state": {
|
"state": {
|
||||||
"loading": "Loading…",
|
"loading": "Loading…",
|
||||||
|
|||||||
@@ -7,22 +7,39 @@
|
|||||||
"firstDesc": "该防伪码为首次查询,本作品为正品。",
|
"firstDesc": "该防伪码为首次查询,本作品为正品。",
|
||||||
"repeatDesc": "该防伪码已激活,请留意查询次数是否异常。",
|
"repeatDesc": "该防伪码已激活,请留意查询次数是否异常。",
|
||||||
"queryCount": "累计查询 {n} 次",
|
"queryCount": "累计查询 {n} 次",
|
||||||
"firstActivatedAt": "首次激活:{t}"
|
"firstActivatedAt": "首次激活:{t}",
|
||||||
|
"queriedAt": "本次查询:{t}",
|
||||||
|
"code": "唯一追溯码"
|
||||||
},
|
},
|
||||||
"section": {
|
"section": {
|
||||||
"basic": "基础信息",
|
"basic": "基础信息",
|
||||||
"timeline": "溯源时间轴",
|
"timeline": "溯源时间轴",
|
||||||
"cert": "认证文件",
|
"cert": "认证文件",
|
||||||
"chain": "区块链存证"
|
"chain": "数字身份与区块链存证"
|
||||||
},
|
},
|
||||||
"chain": {
|
"chain": {
|
||||||
|
"code": "唯一追溯码",
|
||||||
"hash": "交易哈希",
|
"hash": "交易哈希",
|
||||||
"dataHash": "数据哈希",
|
"dataHash": "数据哈希",
|
||||||
"blockHeight": "区块高度",
|
"blockHeight": "区块高度",
|
||||||
"onchainAt": "上链时间",
|
"onchainAt": "上链时间",
|
||||||
"explorer": "查看存证",
|
"explorer": "查看存证",
|
||||||
"copy": "复制",
|
"copy": "复制",
|
||||||
"copied": "已复制"
|
"copied": "已复制",
|
||||||
|
"notOnchain": "该作品暂未上链存证。"
|
||||||
|
},
|
||||||
|
"cert": {
|
||||||
|
"type": {
|
||||||
|
"PHOTO": "作者合照",
|
||||||
|
"CERT": "证书",
|
||||||
|
"APPRAISAL": "鉴定意见"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"field": {
|
||||||
|
"viewFile": "查看文件"
|
||||||
|
},
|
||||||
|
"privacy": {
|
||||||
|
"note": "隐私说明:为防伪风控与查询统计,系统会记录本次访问的必要信息(如访问时间、IP、地区与设备信息)。"
|
||||||
},
|
},
|
||||||
"state": {
|
"state": {
|
||||||
"loading": "正在查询…",
|
"loading": "正在查询…",
|
||||||
|
|||||||
+99
-19
@@ -33,6 +33,8 @@
|
|||||||
· {{ t('anti.firstActivatedAt', { t: fmt(data.antiCounterfeit.firstActivatedAt) }) }}
|
· {{ t('anti.firstActivatedAt', { t: fmt(data.antiCounterfeit.firstActivatedAt) }) }}
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
|
<div v-if="data.queriedAt" class="anti-meta">{{ t('anti.queriedAt', { t: fmt(data.queriedAt) }) }}</div>
|
||||||
|
<div v-if="data.code" class="anti-code">{{ t('anti.code') }}:<span class="mono">{{ data.code }}</span></div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -69,7 +71,19 @@
|
|||||||
<div class="fields">
|
<div class="fields">
|
||||||
<div v-for="(f, i) in data.artwork.fields" :key="i" class="field">
|
<div v-for="(f, i) in data.artwork.fields" :key="i" class="field">
|
||||||
<span class="field-label">{{ f.label }}</span>
|
<span class="field-label">{{ f.label }}</span>
|
||||||
<span class="field-value">{{ f.value }}</span>
|
<span class="field-value">
|
||||||
|
<img
|
||||||
|
v-if="f.type === 'IMAGE' && f.value"
|
||||||
|
:src="f.value"
|
||||||
|
class="field-img"
|
||||||
|
loading="lazy"
|
||||||
|
@click="openViewer([{ url: f.value, type: 'image', name: f.label }], 0)"
|
||||||
|
/>
|
||||||
|
<a v-else-if="(f.type === 'LINK' || f.type === 'FILE') && safeUrl(f.value)" :href="safeUrl(f.value)" target="_blank" rel="noopener" class="field-link">
|
||||||
|
{{ f.type === 'FILE' ? t('field.viewFile') : f.value }}
|
||||||
|
</a>
|
||||||
|
<template v-else>{{ f.value }}</template>
|
||||||
|
</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
@@ -108,33 +122,52 @@
|
|||||||
<div class="cert-grid">
|
<div class="cert-grid">
|
||||||
<div v-for="(c, i) in data.certificates" :key="i" class="cert">
|
<div v-for="(c, i) in data.certificates" :key="i" class="cert">
|
||||||
<img v-if="c.url" :src="c.url" loading="lazy" @click="openViewer([{ url: c.url, name: c.name, type: 'image' }], 0)" />
|
<img v-if="c.url" :src="c.url" loading="lazy" @click="openViewer([{ url: c.url, name: c.name, type: 'image' }], 0)" />
|
||||||
<div class="cert-name text-ellipsis">{{ c.name }}</div>
|
<div class="cert-head">
|
||||||
|
<span class="cert-name text-ellipsis">{{ c.name }}</span>
|
||||||
|
<span v-if="c.type" class="cert-type">{{ t(`cert.type.${c.type}`) }}</span>
|
||||||
|
</div>
|
||||||
<div v-if="c.issuer" class="muted cert-issuer text-ellipsis">{{ c.issuer }}</div>
|
<div v-if="c.issuer" class="muted cert-issuer text-ellipsis">{{ c.issuer }}</div>
|
||||||
|
<div v-if="c.issuedAt" class="muted cert-issuer">{{ fmtDate(c.issuedAt) }}</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
<!-- 区块链存证 -->
|
<!-- 数字身份与区块链存证 -->
|
||||||
<section v-if="data.blockchain" class="card">
|
<section class="card">
|
||||||
<h2 class="section-title">{{ t('section.chain') }}</h2>
|
<h2 class="section-title">{{ t('section.chain') }}</h2>
|
||||||
<div class="chain-row">
|
<div class="chain-row">
|
||||||
<span class="chain-k">{{ t('chain.hash') }}</span>
|
<span class="chain-k">{{ t('chain.code') }}</span>
|
||||||
<span class="chain-v mono">{{ ellipsis(data.blockchain.txHash) }}</span>
|
<span class="chain-v mono">{{ data.code || '-' }}</span>
|
||||||
<button class="copy" @click="copy(data.blockchain.txHash)">{{ t('chain.copy') }}</button>
|
|
||||||
</div>
|
</div>
|
||||||
<div class="chain-row">
|
<template v-if="data.blockchain">
|
||||||
<span class="chain-k">{{ t('chain.blockHeight') }}</span>
|
<div class="chain-row">
|
||||||
<span class="chain-v">{{ data.blockchain.blockHeight }}</span>
|
<span class="chain-k">{{ t('chain.hash') }}</span>
|
||||||
</div>
|
<span class="chain-v mono">{{ ellipsis(data.blockchain.txHash) }}</span>
|
||||||
<div class="chain-row">
|
<button class="copy" @click="copy(data.blockchain.txHash)">{{ t('chain.copy') }}</button>
|
||||||
<span class="chain-k">{{ t('chain.onchainAt') }}</span>
|
</div>
|
||||||
<span class="chain-v">{{ fmt(data.blockchain.onchainAt) }}</span>
|
<div v-if="data.blockchain.dataHash" class="chain-row">
|
||||||
</div>
|
<span class="chain-k">{{ t('chain.dataHash') }}</span>
|
||||||
<a v-if="data.blockchain.explorerUrl" class="chain-link" :href="data.blockchain.explorerUrl" target="_blank">
|
<span class="chain-v mono">{{ ellipsis(data.blockchain.dataHash) }}</span>
|
||||||
{{ t('chain.explorer') }} →
|
<button class="copy" @click="copy(data.blockchain.dataHash)">{{ t('chain.copy') }}</button>
|
||||||
</a>
|
</div>
|
||||||
|
<div class="chain-row">
|
||||||
|
<span class="chain-k">{{ t('chain.blockHeight') }}</span>
|
||||||
|
<span class="chain-v">{{ data.blockchain.blockHeight ?? '-' }}</span>
|
||||||
|
</div>
|
||||||
|
<div class="chain-row">
|
||||||
|
<span class="chain-k">{{ t('chain.onchainAt') }}</span>
|
||||||
|
<span class="chain-v">{{ fmt(data.blockchain.onchainAt) }}</span>
|
||||||
|
</div>
|
||||||
|
<a v-if="data.blockchain.explorerUrl" class="chain-link" :href="data.blockchain.explorerUrl" target="_blank">
|
||||||
|
{{ t('chain.explorer') }} →
|
||||||
|
</a>
|
||||||
|
</template>
|
||||||
|
<div v-else class="chain-empty muted">{{ t('chain.notOnchain') }}</div>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
|
<!-- 隐私说明 -->
|
||||||
|
<p class="privacy muted">{{ t('privacy.note') }}</p>
|
||||||
|
|
||||||
<footer class="footer muted">{{ appName }}</footer>
|
<footer class="footer muted">{{ appName }}</footer>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@@ -190,6 +223,11 @@ function ellipsis(s?: string) {
|
|||||||
function isVideo(m: { type?: string; url?: string }) {
|
function isVideo(m: { type?: string; url?: string }) {
|
||||||
return m.type === 'video' || /\.(mp4|webm|mov|m4v|ogg)$/i.test(m.url || '');
|
return m.type === 'video' || /\.(mp4|webm|mov|m4v|ogg)$/i.test(m.url || '');
|
||||||
}
|
}
|
||||||
|
// 仅允许 http(s) 或站内相对路径作为外链,过滤 javascript:/data: 等危险协议
|
||||||
|
function safeUrl(v?: string): string {
|
||||||
|
if (!v) return '';
|
||||||
|
return /^(https?:\/\/|\/)/i.test(v) ? v : '';
|
||||||
|
}
|
||||||
function openViewer(items: any[], index: number) {
|
function openViewer(items: any[], index: number) {
|
||||||
viewerItems.value = items || [];
|
viewerItems.value = items || [];
|
||||||
viewerStart.value = index;
|
viewerStart.value = index;
|
||||||
@@ -340,6 +378,12 @@ watch(
|
|||||||
font-size: 12px;
|
font-size: 12px;
|
||||||
opacity: 0.85;
|
opacity: 0.85;
|
||||||
}
|
}
|
||||||
|
.anti-code {
|
||||||
|
font-size: 12px;
|
||||||
|
opacity: 0.85;
|
||||||
|
margin-top: 2px;
|
||||||
|
word-break: break-all;
|
||||||
|
}
|
||||||
.carousel {
|
.carousel {
|
||||||
display: flex;
|
display: flex;
|
||||||
gap: 8px;
|
gap: 8px;
|
||||||
@@ -403,6 +447,18 @@ watch(
|
|||||||
flex: 1;
|
flex: 1;
|
||||||
color: var(--text);
|
color: var(--text);
|
||||||
}
|
}
|
||||||
|
.field-img {
|
||||||
|
width: 96px;
|
||||||
|
height: 96px;
|
||||||
|
object-fit: cover;
|
||||||
|
border-radius: 8px;
|
||||||
|
cursor: pointer;
|
||||||
|
background: #e7ecf3;
|
||||||
|
}
|
||||||
|
.field-link {
|
||||||
|
color: var(--brand-2);
|
||||||
|
word-break: break-all;
|
||||||
|
}
|
||||||
.timeline {
|
.timeline {
|
||||||
position: relative;
|
position: relative;
|
||||||
}
|
}
|
||||||
@@ -472,10 +528,24 @@ watch(
|
|||||||
border-radius: 10px;
|
border-radius: 10px;
|
||||||
background: #e7ecf3;
|
background: #e7ecf3;
|
||||||
}
|
}
|
||||||
|
.cert-head {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 6px;
|
||||||
|
margin-top: 6px;
|
||||||
|
}
|
||||||
.cert-name {
|
.cert-name {
|
||||||
font-size: 13px;
|
font-size: 13px;
|
||||||
font-weight: 600;
|
font-weight: 600;
|
||||||
margin-top: 6px;
|
flex: 1;
|
||||||
|
}
|
||||||
|
.cert-type {
|
||||||
|
font-size: 11px;
|
||||||
|
color: var(--brand-2);
|
||||||
|
background: rgba(19, 138, 114, 0.12);
|
||||||
|
border-radius: 4px;
|
||||||
|
padding: 1px 6px;
|
||||||
|
flex-shrink: 0;
|
||||||
}
|
}
|
||||||
.cert-issuer {
|
.cert-issuer {
|
||||||
font-size: 12px;
|
font-size: 12px;
|
||||||
@@ -515,6 +585,16 @@ watch(
|
|||||||
font-size: 14px;
|
font-size: 14px;
|
||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
}
|
}
|
||||||
|
.chain-empty {
|
||||||
|
font-size: 13px;
|
||||||
|
padding: 8px 0;
|
||||||
|
}
|
||||||
|
.privacy {
|
||||||
|
font-size: 12px;
|
||||||
|
line-height: 1.6;
|
||||||
|
padding: 0 16px;
|
||||||
|
margin: 16px 0 0;
|
||||||
|
}
|
||||||
.footer {
|
.footer {
|
||||||
text-align: center;
|
text-align: center;
|
||||||
font-size: 12px;
|
font-size: 12px;
|
||||||
|
|||||||
@@ -31,6 +31,11 @@ export const OUTBOUND_IMPORT_COLUMNS: ImportColumn[] = [
|
|||||||
{ key: 'shortCode', header: '短码', required: true, note: '必填,生码导出文件中的随机短码', example: 'a8K3pQ9x2M' },
|
{ key: 'shortCode', header: '短码', required: true, note: '必填,生码导出文件中的随机短码', example: 'a8K3pQ9x2M' },
|
||||||
{ key: 'sku', header: 'SKU', required: false, note: '选填,产品 SKU', example: 'SKU-2024-001' },
|
{ key: 'sku', header: 'SKU', required: false, note: '选填,产品 SKU', example: 'SKU-2024-001' },
|
||||||
{ key: 'archiveNo', header: '档案编号', required: false, note: '选填,本件档案编号', example: 'AW-0001' },
|
{ key: 'archiveNo', header: '档案编号', required: false, note: '选填,本件档案编号', example: 'AW-0001' },
|
||||||
|
{ key: 'batchNo', header: '批次编号', required: false, note: '选填,仅作核对,留空忽略', example: 'B20240601' },
|
||||||
{ key: 'outTime', header: '出库时间', required: false, note: '选填,格式 YYYY-MM-DD HH:mm', example: '2024-06-01 10:00' },
|
{ key: 'outTime', header: '出库时间', required: false, note: '选填,格式 YYYY-MM-DD HH:mm', example: '2024-06-01 10:00' },
|
||||||
|
{ key: 'outImage', header: '出库实况图', required: false, note: '选填,已上传图片的存储 key 或 URL', example: 'uploads/2024/out-001.jpg' },
|
||||||
|
{ key: 'txHash', header: '上链哈希值', required: false, note: '选填,链上交易/存证哈希,填写则记录上链结果', example: '0xabc123...' },
|
||||||
|
{ key: 'onchainAt', header: '上链时间', required: false, note: '选填,格式 YYYY-MM-DD HH:mm', example: '2024-06-02 09:30' },
|
||||||
|
{ key: 'blockHeight', header: '区块高度', required: false, note: '选填,整数', example: '8500001' },
|
||||||
{ key: 'remark', header: '备注', required: false, note: '选填', example: '' },
|
{ key: 'remark', header: '备注', required: false, note: '选填', example: '' },
|
||||||
];
|
];
|
||||||
|
|||||||
@@ -18,6 +18,12 @@ export enum ArtworkStatus {
|
|||||||
DISABLED = 'DISABLED',
|
DISABLED = 'DISABLED',
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export enum AuditStatus {
|
||||||
|
PENDING = 'PENDING',
|
||||||
|
APPROVED = 'APPROVED',
|
||||||
|
REJECTED = 'REJECTED',
|
||||||
|
}
|
||||||
|
|
||||||
export enum TraceCodeStatus {
|
export enum TraceCodeStatus {
|
||||||
UNBOUND = 'UNBOUND',
|
UNBOUND = 'UNBOUND',
|
||||||
INACTIVE = 'INACTIVE',
|
INACTIVE = 'INACTIVE',
|
||||||
|
|||||||
Generated
+29
@@ -83,6 +83,9 @@ importers:
|
|||||||
'@nestjs/platform-express':
|
'@nestjs/platform-express':
|
||||||
specifier: ^10.4.15
|
specifier: ^10.4.15
|
||||||
version: 10.4.22(@nestjs/common@10.4.22(class-transformer@0.5.1)(class-validator@0.14.4)(reflect-metadata@0.2.2)(rxjs@7.8.2))(@nestjs/core@10.4.22)
|
version: 10.4.22(@nestjs/common@10.4.22(class-transformer@0.5.1)(class-validator@0.14.4)(reflect-metadata@0.2.2)(rxjs@7.8.2))(@nestjs/core@10.4.22)
|
||||||
|
'@nestjs/schedule':
|
||||||
|
specifier: ^6.1.3
|
||||||
|
version: 6.1.3(@nestjs/common@10.4.22(class-transformer@0.5.1)(class-validator@0.14.4)(reflect-metadata@0.2.2)(rxjs@7.8.2))(@nestjs/core@10.4.22)
|
||||||
'@nestjs/serve-static':
|
'@nestjs/serve-static':
|
||||||
specifier: ^4.0.2
|
specifier: ^4.0.2
|
||||||
version: 4.0.2(@nestjs/common@10.4.22(class-transformer@0.5.1)(class-validator@0.14.4)(reflect-metadata@0.2.2)(rxjs@7.8.2))(@nestjs/core@10.4.22)(express@4.22.1)
|
version: 4.0.2(@nestjs/common@10.4.22(class-transformer@0.5.1)(class-validator@0.14.4)(reflect-metadata@0.2.2)(rxjs@7.8.2))(@nestjs/core@10.4.22)(express@4.22.1)
|
||||||
@@ -1028,6 +1031,12 @@ packages:
|
|||||||
'@nestjs/common': ^10.0.0
|
'@nestjs/common': ^10.0.0
|
||||||
'@nestjs/core': ^10.0.0
|
'@nestjs/core': ^10.0.0
|
||||||
|
|
||||||
|
'@nestjs/schedule@6.1.3':
|
||||||
|
resolution: {integrity: sha512-RflMFOpR16Dwd1jAUbeB4mfGTCh65fvEdL4mSjQPJChpkRGRjIXjb+6YQcK2faQrVT60c9DmLmoVR7/ONCtuYQ==}
|
||||||
|
peerDependencies:
|
||||||
|
'@nestjs/common': ^10.0.0 || ^11.0.0
|
||||||
|
'@nestjs/core': ^10.0.0 || ^11.0.0
|
||||||
|
|
||||||
'@nestjs/schematics@10.2.3':
|
'@nestjs/schematics@10.2.3':
|
||||||
resolution: {integrity: sha512-4e8gxaCk7DhBxVUly2PjYL4xC2ifDFexCqq1/u4TtivLGXotVk0wHdYuPYe1tHTHuR1lsOkRbfOCpkdTnigLVg==}
|
resolution: {integrity: sha512-4e8gxaCk7DhBxVUly2PjYL4xC2ifDFexCqq1/u4TtivLGXotVk0wHdYuPYe1tHTHuR1lsOkRbfOCpkdTnigLVg==}
|
||||||
peerDependencies:
|
peerDependencies:
|
||||||
@@ -1370,6 +1379,9 @@ packages:
|
|||||||
'@types/lodash@4.17.24':
|
'@types/lodash@4.17.24':
|
||||||
resolution: {integrity: sha512-gIW7lQLZbue7lRSWEFql49QJJWThrTFFeIMJdp3eH4tKoxm1OvEPg02rm4wCCSHS0cL3/Fizimb35b7k8atwsQ==}
|
resolution: {integrity: sha512-gIW7lQLZbue7lRSWEFql49QJJWThrTFFeIMJdp3eH4tKoxm1OvEPg02rm4wCCSHS0cL3/Fizimb35b7k8atwsQ==}
|
||||||
|
|
||||||
|
'@types/luxon@3.7.2':
|
||||||
|
resolution: {integrity: sha512-gW+Oib+vUtGJBtNC8V9Reww0oIpusw+4m81uncg9REGZAJfqOQHfo/nkabnc7w0QReXyPqjrbWMJk6NuAkiX3Q==}
|
||||||
|
|
||||||
'@types/mime@1.3.5':
|
'@types/mime@1.3.5':
|
||||||
resolution: {integrity: sha512-/pyBZWSLD2n0dcHE3hq8s8ZvcETHtEuF+3E7XVt0Ig2nvsVQXdghHVcEkIWjy9A0wKfTn97a/PSDYohKIlnP/w==}
|
resolution: {integrity: sha512-/pyBZWSLD2n0dcHE3hq8s8ZvcETHtEuF+3E7XVt0Ig2nvsVQXdghHVcEkIWjy9A0wKfTn97a/PSDYohKIlnP/w==}
|
||||||
|
|
||||||
@@ -1955,6 +1967,10 @@ packages:
|
|||||||
resolution: {integrity: sha512-p0SaNjrHOnQeR8/VnfGbmg9te2kfyYSQ7Sc/j/6DtPL3JQvKxmjO9TSjNFpujqV3vEYYBvNNvXSxzyksBWAx1Q==}
|
resolution: {integrity: sha512-p0SaNjrHOnQeR8/VnfGbmg9te2kfyYSQ7Sc/j/6DtPL3JQvKxmjO9TSjNFpujqV3vEYYBvNNvXSxzyksBWAx1Q==}
|
||||||
engines: {node: '>=12.0.0'}
|
engines: {node: '>=12.0.0'}
|
||||||
|
|
||||||
|
cron@4.4.0:
|
||||||
|
resolution: {integrity: sha512-fkdfq+b+AHI4cKdhZlppHveI/mgz2qpiYxcm+t5E5TsxX7QrLS1VE0+7GENEk9z0EeGPcpSciGv6ez24duWhwQ==}
|
||||||
|
engines: {node: '>=18.x'}
|
||||||
|
|
||||||
cross-spawn@7.0.6:
|
cross-spawn@7.0.6:
|
||||||
resolution: {integrity: sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA==}
|
resolution: {integrity: sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA==}
|
||||||
engines: {node: '>= 8'}
|
engines: {node: '>= 8'}
|
||||||
@@ -4951,6 +4967,12 @@ snapshots:
|
|||||||
transitivePeerDependencies:
|
transitivePeerDependencies:
|
||||||
- supports-color
|
- supports-color
|
||||||
|
|
||||||
|
'@nestjs/schedule@6.1.3(@nestjs/common@10.4.22(class-transformer@0.5.1)(class-validator@0.14.4)(reflect-metadata@0.2.2)(rxjs@7.8.2))(@nestjs/core@10.4.22)':
|
||||||
|
dependencies:
|
||||||
|
'@nestjs/common': 10.4.22(class-transformer@0.5.1)(class-validator@0.14.4)(reflect-metadata@0.2.2)(rxjs@7.8.2)
|
||||||
|
'@nestjs/core': 10.4.22(@nestjs/common@10.4.22(class-transformer@0.5.1)(class-validator@0.14.4)(reflect-metadata@0.2.2)(rxjs@7.8.2))(@nestjs/platform-express@10.4.22)(reflect-metadata@0.2.2)(rxjs@7.8.2)
|
||||||
|
cron: 4.4.0
|
||||||
|
|
||||||
'@nestjs/schematics@10.2.3(chokidar@3.6.0)(typescript@5.7.2)':
|
'@nestjs/schematics@10.2.3(chokidar@3.6.0)(typescript@5.7.2)':
|
||||||
dependencies:
|
dependencies:
|
||||||
'@angular-devkit/core': 17.3.11(chokidar@3.6.0)
|
'@angular-devkit/core': 17.3.11(chokidar@3.6.0)
|
||||||
@@ -5284,6 +5306,8 @@ snapshots:
|
|||||||
|
|
||||||
'@types/lodash@4.17.24': {}
|
'@types/lodash@4.17.24': {}
|
||||||
|
|
||||||
|
'@types/luxon@3.7.2': {}
|
||||||
|
|
||||||
'@types/mime@1.3.5': {}
|
'@types/mime@1.3.5': {}
|
||||||
|
|
||||||
'@types/multer@1.4.13':
|
'@types/multer@1.4.13':
|
||||||
@@ -5986,6 +6010,11 @@ snapshots:
|
|||||||
dependencies:
|
dependencies:
|
||||||
luxon: 3.7.2
|
luxon: 3.7.2
|
||||||
|
|
||||||
|
cron@4.4.0:
|
||||||
|
dependencies:
|
||||||
|
'@types/luxon': 3.7.2
|
||||||
|
luxon: 3.7.2
|
||||||
|
|
||||||
cross-spawn@7.0.6:
|
cross-spawn@7.0.6:
|
||||||
dependencies:
|
dependencies:
|
||||||
path-key: 3.1.1
|
path-key: 3.1.1
|
||||||
|
|||||||
Reference in New Issue
Block a user