feat: 添加订单相关字段和自动生成规则,包括订单商品数量和支付状态;更新文档和迁移脚本

This commit is contained in:
2026-04-11 17:36:16 +08:00
parent ec6b59b4fa
commit c7681e50fe
9 changed files with 739 additions and 16 deletions

View File

@@ -232,6 +232,74 @@ paths:
application/json:
schema:
$ref: '#/components/schemas/PocketBaseNativeError'
/pb/api/batch:
post:
operationId: postPocketBaseCartBatchUpdate
tags: [购物车]
summary: 批量更新购物车记录
description: |
使用 PocketBase 原生 batch 接口批量更新 `tbl_cart` 记录。
说明:
- 这是 PocketBase 原生批处理接口,不是 hooks。
- 单次请求可提交多条 `PATCH /api/collections/tbl_cart/records/{recordId}` 子请求。
- 每条子请求仍按原生 collection rule 校验权限。
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/PocketBaseCartBatchRequest'
example:
requests:
- method: PATCH|string
url: /api/collections/tbl_cart/records/PocketBase记录主键|string
headers:
Content-Type: application/json|string
body:
cart_number: 购物车名称或分组号|string
cart_product_quantity: 产品数量|integer
cart_status: 购物车状态|string
cart_at_price: 加入购物车时价格|number
cart_remark: 备注|string
- method: PATCH|string
url: /api/collections/tbl_cart/records/PocketBase记录主键|string
headers:
Content-Type: application/json|string
body:
cart_status: 购物车状态|string
cart_remark: 备注|string
responses:
'200':
description: 批量处理成功
content:
application/json:
schema:
$ref: '#/components/schemas/PocketBaseBatchResponse'
'400':
description: 批处理参数错误
content:
application/json:
schema:
$ref: '#/components/schemas/PocketBaseNativeError'
'401':
description: token 无效或已过期
content:
application/json:
schema:
$ref: '#/components/schemas/PocketBaseNativeError'
'403':
description: 无权访问其中一条或多条记录
content:
application/json:
schema:
$ref: '#/components/schemas/PocketBaseNativeError'
'500':
description: 服务端错误
content:
application/json:
schema:
$ref: '#/components/schemas/PocketBaseNativeError'
components:
schemas:
PocketBaseNativeError:
@@ -397,6 +465,57 @@ components:
type: array
items:
$ref: '#/components/schemas/PocketBaseCartRecord'
PocketBaseCartBatchItem:
type: object
required: [method, url, body]
properties:
method:
type: string
description: HTTP 方法
example: PATCH|string
url:
type: string
description: PocketBase 子请求路径
example: /api/collections/tbl_cart/records/PocketBase记录主键|string
headers:
type: object
description: 子请求头
additionalProperties:
type: string
example:
Content-Type: application/json|string
body:
$ref: '#/components/schemas/PocketBaseCartUpdateRequest'
PocketBaseCartBatchRequest:
type: object
required: [requests]
properties:
requests:
type: array
description: 批量子请求列表
items:
$ref: '#/components/schemas/PocketBaseCartBatchItem'
PocketBaseBatchResponseItem:
type: object
properties:
status:
type: [integer, string]
description: 子请求响应状态码
example: 子请求状态码|integer
body:
type: object
description: 子请求响应体
additionalProperties: true
example:
字段名|string: 字段值|string
PocketBaseBatchResponse:
type: object
properties:
items:
type: array
description: 批处理结果列表
items:
$ref: '#/components/schemas/PocketBaseBatchResponseItem'
PocketBaseProductListExpand:
type: object
description: tbl_product_list 关联展开后的记录对象(示例字段)