feat: 添加 PocketBase 管理端与自定义 hooks 的 API 文档
- 新增 openapi.yaml 文件,定义管理端与自定义 hooks 的接口文档,包括系统、微信认证、平台认证、字典管理、附件管理、文档管理、购物车和订单等接口。 - 新增 order.yaml 文件,定义订单相关的接口,包括查询订单列表、查询订单详情、新增订单记录、修改订单记录和删除订单记录的请求和响应结构。 - 新增 openapi-wx/openapi.yaml 文件,定义 PocketBase 原生 API 文档,包含企业信息、附件信息、产品信息、文档信息、购物车和订单的接口。 - 新增 pocketbase.scheme.js 文件,包含 PocketBase 集合的创建和更新逻辑,定义了多个集合的字段、索引和权限规则。
This commit is contained in:
372
pocket-base/spec/openapi-manage/cart.yaml
Normal file
372
pocket-base/spec/openapi-manage/cart.yaml
Normal file
@@ -0,0 +1,372 @@
|
||||
paths:
|
||||
cartList:
|
||||
post:
|
||||
tags: [购物车]
|
||||
summary: 查询购物车列表
|
||||
description: |
|
||||
调用自定义 hooks API 查询当前登录用户的购物车列表。
|
||||
请求头请自行携带 `Authorization: Bearer <token>`。
|
||||
requestBody:
|
||||
required: false
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/CartListRequest'
|
||||
example:
|
||||
keyword: 模糊搜索关键字|string
|
||||
cart_status: 购物车状态|string
|
||||
cart_number: 购物车名称或分组号|string
|
||||
responses:
|
||||
'200':
|
||||
description: 查询成功
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/CartListResponse'
|
||||
'400':
|
||||
description: 参数错误
|
||||
'401':
|
||||
description: token 无效或已过期
|
||||
'415':
|
||||
description: 请求体必须为 application/json
|
||||
'500':
|
||||
description: 服务端错误
|
||||
cartDetail:
|
||||
post:
|
||||
tags: [购物车]
|
||||
summary: 查询购物车详情
|
||||
description: |
|
||||
调用自定义 hooks API 按 `cart_id` 查询单条购物车记录。
|
||||
请求头请自行携带 `Authorization: Bearer <token>`。
|
||||
requestBody:
|
||||
required: true
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/CartDetailRequest'
|
||||
example:
|
||||
cart_id: 购物车业务ID|string
|
||||
responses:
|
||||
'200':
|
||||
description: 查询成功
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/CartRecord'
|
||||
'400':
|
||||
description: 参数错误
|
||||
'401':
|
||||
description: token 无效或已过期
|
||||
'403':
|
||||
description: 无权访问该购物车记录
|
||||
'404':
|
||||
description: 未找到对应购物车记录
|
||||
'415':
|
||||
description: 请求体必须为 application/json
|
||||
'500':
|
||||
description: 服务端错误
|
||||
cartCreate:
|
||||
post:
|
||||
tags: [购物车]
|
||||
summary: 新增购物车记录
|
||||
description: |
|
||||
调用自定义 hooks API 新增购物车记录。
|
||||
服务端会基于当前 token 自动写入 `cart_owner` 并生成 `cart_id`。
|
||||
requestBody:
|
||||
required: true
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/CartCreateRequest'
|
||||
example:
|
||||
cart_number: 可选;未传时服务端自动生成|string
|
||||
cart_product_id: tbl_product_list 的 PocketBase recordId|string
|
||||
cart_product_quantity: 产品数量|integer
|
||||
cart_status: 购物车状态|string
|
||||
cart_at_price: 加入购物车时价格|integer
|
||||
cart_remark: 备注|string
|
||||
responses:
|
||||
'200':
|
||||
description: 创建成功
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/CartRecord'
|
||||
'400':
|
||||
description: 参数错误或创建失败
|
||||
'401':
|
||||
description: token 无效或已过期
|
||||
'415':
|
||||
description: 请求体必须为 application/json
|
||||
'429':
|
||||
description: 重复请求过于频繁
|
||||
'500':
|
||||
description: 服务端错误
|
||||
cartUpdate:
|
||||
post:
|
||||
tags: [购物车]
|
||||
summary: 修改购物车记录
|
||||
description: |
|
||||
调用自定义 hooks API 按 `cart_id` 更新购物车记录。
|
||||
请求头请自行携带 `Authorization: Bearer <token>`。
|
||||
requestBody:
|
||||
required: true
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/CartUpdateRequest'
|
||||
example:
|
||||
cart_id: 购物车业务ID|string
|
||||
cart_number: 购物车名称或分组号|string
|
||||
cart_product_id: tbl_product_list 的 PocketBase recordId|string
|
||||
cart_product_quantity: 产品数量|integer
|
||||
cart_status: 购物车状态|string
|
||||
cart_at_price: 加入购物车时价格|integer
|
||||
cart_remark: 备注|string
|
||||
responses:
|
||||
'200':
|
||||
description: 更新成功
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/CartRecord'
|
||||
'400':
|
||||
description: 参数错误或更新失败
|
||||
'401':
|
||||
description: token 无效或已过期
|
||||
'403':
|
||||
description: 无权访问该购物车记录
|
||||
'404':
|
||||
description: 未找到待修改记录
|
||||
'415':
|
||||
description: 请求体必须为 application/json
|
||||
'429':
|
||||
description: 重复请求过于频繁
|
||||
'500':
|
||||
description: 服务端错误
|
||||
cartDelete:
|
||||
post:
|
||||
tags: [购物车]
|
||||
summary: 删除购物车记录
|
||||
description: |
|
||||
调用自定义 hooks API 按 `cart_id` 删除购物车记录。
|
||||
当前后端实现以实际 hooks 逻辑为准。
|
||||
requestBody:
|
||||
required: true
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/CartDeleteRequest'
|
||||
example:
|
||||
cart_id: 购物车业务ID|string
|
||||
responses:
|
||||
'200':
|
||||
description: 删除成功
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/CartDeleteResponse'
|
||||
'400':
|
||||
description: 参数错误或删除失败
|
||||
'401':
|
||||
description: token 无效或已过期
|
||||
'403':
|
||||
description: 无权访问该购物车记录
|
||||
'404':
|
||||
description: 未找到待删除记录
|
||||
'415':
|
||||
description: 请求体必须为 application/json
|
||||
'429':
|
||||
description: 重复请求过于频繁
|
||||
'500':
|
||||
description: 服务端错误
|
||||
components:
|
||||
schemas:
|
||||
CartRecord:
|
||||
type: object
|
||||
properties:
|
||||
pb_id:
|
||||
type: string
|
||||
description: PocketBase记录主键id
|
||||
created:
|
||||
type: string
|
||||
description: PocketBase系统创建时间
|
||||
updated:
|
||||
type: string
|
||||
description: PocketBase系统更新时间
|
||||
cart_id:
|
||||
type: string
|
||||
description: 购物车业务ID
|
||||
cart_number:
|
||||
type: string
|
||||
description: 购物车名称或分组号
|
||||
cart_create:
|
||||
type: string
|
||||
description: 购物车项创建时间
|
||||
cart_owner:
|
||||
type: string
|
||||
description: 购物车所有者openid
|
||||
cart_product_id:
|
||||
type: string
|
||||
description: 关联产品的 PocketBase recordId
|
||||
cart_product_business_id:
|
||||
type: string
|
||||
description: 关联产品的业务 ID(即 prod_list_id),用于展示
|
||||
cart_product_quantity:
|
||||
type: [integer, number]
|
||||
description: 产品数量
|
||||
cart_status:
|
||||
type: string
|
||||
description: 购物车状态
|
||||
cart_at_price:
|
||||
type: [integer, number]
|
||||
description: 加入购物车时价格
|
||||
cart_remark:
|
||||
type: string
|
||||
description: 备注
|
||||
is_delete:
|
||||
type: [integer, number]
|
||||
description: 删除标记
|
||||
product_name:
|
||||
type: string
|
||||
description: 产品名称
|
||||
product_modelnumber:
|
||||
type: string
|
||||
description: 产品型号
|
||||
product_basic_price:
|
||||
type: [integer, number, 'null']
|
||||
description: 产品基础价格
|
||||
example:
|
||||
pb_id: PocketBase记录主键id|string
|
||||
created: PocketBase系统创建时间|string
|
||||
updated: PocketBase系统更新时间|string
|
||||
cart_id: 购物车业务ID|string
|
||||
cart_number: 购物车名称或分组号|string
|
||||
cart_create: 购物车项创建时间|string
|
||||
cart_owner: 购物车所有者openid|string
|
||||
cart_product_id: tbl_product_list 的 PocketBase recordId|string
|
||||
cart_product_business_id: 产品业务ID|string
|
||||
cart_product_quantity: 产品数量|integer
|
||||
cart_status: 购物车状态|string
|
||||
cart_at_price: 加入购物车时价格|integer
|
||||
cart_remark: 备注|string
|
||||
is_delete: 删除标记|integer
|
||||
product_name: 产品名称|string
|
||||
product_modelnumber: 产品型号|string
|
||||
product_basic_price: 产品基础价格|integer
|
||||
CartListRequest:
|
||||
type: object
|
||||
properties:
|
||||
keyword:
|
||||
type: string
|
||||
description: 模糊搜索关键字
|
||||
cart_status:
|
||||
type: string
|
||||
description: 购物车状态
|
||||
cart_number:
|
||||
type: string
|
||||
description: 购物车名称或分组号
|
||||
example:
|
||||
keyword: 模糊搜索关键字|string
|
||||
cart_status: 购物车状态|string
|
||||
cart_number: 购物车名称或分组号|string
|
||||
CartDetailRequest:
|
||||
type: object
|
||||
required: [cart_id]
|
||||
properties:
|
||||
cart_id:
|
||||
type: string
|
||||
description: 购物车业务ID
|
||||
example:
|
||||
cart_id: 购物车业务ID|string
|
||||
CartCreateRequest:
|
||||
type: object
|
||||
required: [cart_product_id, cart_product_quantity, cart_at_price]
|
||||
properties:
|
||||
cart_number:
|
||||
type: string
|
||||
cart_product_id:
|
||||
type: string
|
||||
description: tbl_product_list 的 PocketBase recordId
|
||||
cart_product_quantity:
|
||||
type: [integer, number]
|
||||
cart_status:
|
||||
type: string
|
||||
cart_at_price:
|
||||
type: [integer, number]
|
||||
cart_remark:
|
||||
type: string
|
||||
example:
|
||||
cart_number: 可选;未传时服务端自动生成|string
|
||||
cart_product_id: tbl_product_list 的 PocketBase recordId|string
|
||||
cart_product_quantity: 产品数量|integer
|
||||
cart_status: 购物车状态|string
|
||||
cart_at_price: 加入购物车时价格|integer
|
||||
cart_remark: 备注|string
|
||||
CartUpdateRequest:
|
||||
type: object
|
||||
required: [cart_id]
|
||||
properties:
|
||||
cart_id:
|
||||
type: string
|
||||
cart_number:
|
||||
type: string
|
||||
cart_product_id:
|
||||
type: string
|
||||
description: tbl_product_list 的 PocketBase recordId
|
||||
cart_product_quantity:
|
||||
type: [integer, number]
|
||||
cart_status:
|
||||
type: string
|
||||
cart_at_price:
|
||||
type: [integer, number]
|
||||
cart_remark:
|
||||
type: string
|
||||
example:
|
||||
cart_id: 购物车业务ID|string
|
||||
cart_number: 购物车名称或分组号|string
|
||||
cart_product_id: tbl_product_list 的 PocketBase recordId|string
|
||||
cart_product_quantity: 产品数量|integer
|
||||
cart_status: 购物车状态|string
|
||||
cart_at_price: 加入购物车时价格|integer
|
||||
cart_remark: 备注|string
|
||||
CartDeleteRequest:
|
||||
type: object
|
||||
required: [cart_id]
|
||||
properties:
|
||||
cart_id:
|
||||
type: string
|
||||
example:
|
||||
cart_id: 购物车业务ID|string
|
||||
CartListResponse:
|
||||
type: object
|
||||
properties:
|
||||
items:
|
||||
type: array
|
||||
items:
|
||||
$ref: '#/components/schemas/CartRecord'
|
||||
example:
|
||||
items:
|
||||
- pb_id: PocketBase记录主键id|string
|
||||
created: PocketBase系统创建时间|string
|
||||
updated: PocketBase系统更新时间|string
|
||||
cart_id: 购物车业务ID|string
|
||||
cart_number: 购物车名称或分组号|string
|
||||
cart_create: 购物车项创建时间|string
|
||||
cart_owner: 购物车所有者openid|string
|
||||
cart_product_id: tbl_product_list 的 PocketBase recordId|string
|
||||
cart_product_business_id: 产品业务ID|string
|
||||
cart_product_quantity: 产品数量|integer
|
||||
cart_status: 购物车状态|string
|
||||
cart_at_price: 加入购物车时价格|integer
|
||||
cart_remark: 备注|string
|
||||
CartDeleteResponse:
|
||||
type: object
|
||||
properties:
|
||||
cart_id:
|
||||
type: string
|
||||
is_delete:
|
||||
type: [integer, number]
|
||||
example:
|
||||
cart_id: 购物车业务ID|string
|
||||
is_delete: 删除标记|integer
|
||||
103
pocket-base/spec/openapi-manage/openapi.yaml
Normal file
103
pocket-base/spec/openapi-manage/openapi.yaml
Normal file
@@ -0,0 +1,103 @@
|
||||
openapi: 3.1.0
|
||||
info:
|
||||
title: BAI PocketBase Manage Hooks API
|
||||
version: 1.0.0-manage-folder
|
||||
description: |
|
||||
面向管理端与自定义 hooks 的接口文档。
|
||||
本目录仅收敛自定义 hooks API,不包含 PocketBase 原生 records API。
|
||||
|
||||
文档约定:
|
||||
- 不单独配置鉴权组件;如接口需要登录,请直接在说明中关注 `Authorization: Bearer <token>`
|
||||
- 示例字段值统一使用 `<字段说明>|<类型>` 风格
|
||||
- 当前 `tbl_auth_users.openid` 为全平台统一身份锚点
|
||||
servers:
|
||||
- url: https://bai-api.blv-oa.com
|
||||
description: 生产环境
|
||||
- url: http://localhost:8090
|
||||
description: PocketBase 本地环境
|
||||
tags:
|
||||
- name: 系统
|
||||
description: hooks 系统基础接口
|
||||
- name: 微信认证
|
||||
description: hooks 微信认证与资料接口
|
||||
- name: 平台认证
|
||||
description: hooks 平台用户认证接口
|
||||
- name: 字典管理
|
||||
description: hooks 字典管理接口
|
||||
- name: 附件管理
|
||||
description: hooks 附件管理接口
|
||||
- name: 文档管理
|
||||
description: hooks 文档管理接口
|
||||
- name: 文档历史
|
||||
description: hooks 文档历史接口
|
||||
- name: 购物车
|
||||
description: hooks 购物车接口
|
||||
- name: 订单
|
||||
description: hooks 订单接口
|
||||
paths:
|
||||
/pb/api/system/test-helloworld:
|
||||
$ref: '../openapi-manage.yaml#/paths/~1pb~1api~1system~1test-helloworld'
|
||||
/pb/api/system/health:
|
||||
$ref: '../openapi-manage.yaml#/paths/~1pb~1api~1system~1health'
|
||||
/pb/api/system/users-count:
|
||||
$ref: '../openapi-manage.yaml#/paths/~1pb~1api~1system~1users-count'
|
||||
/pb/api/system/refresh-token:
|
||||
$ref: '../openapi.yaml#/paths/~1pb~1api~1system~1refresh-token'
|
||||
/pb/api/wechat/login:
|
||||
$ref: '../openapi.yaml#/paths/~1pb~1api~1wechat~1login'
|
||||
/pb/api/wechat/profile:
|
||||
$ref: '../openapi.yaml#/paths/~1pb~1api~1wechat~1profile'
|
||||
/pb/api/platform/register:
|
||||
$ref: '../openapi-manage.yaml#/paths/~1pb~1api~1platform~1register'
|
||||
/pb/api/platform/login:
|
||||
$ref: '../openapi-manage.yaml#/paths/~1pb~1api~1platform~1login'
|
||||
/pb/api/dictionary/list:
|
||||
$ref: '../openapi-manage.yaml#/paths/~1pb~1api~1dictionary~1list'
|
||||
/pb/api/dictionary/detail:
|
||||
$ref: '../openapi-manage.yaml#/paths/~1pb~1api~1dictionary~1detail'
|
||||
/pb/api/dictionary/create:
|
||||
$ref: '../openapi-manage.yaml#/paths/~1pb~1api~1dictionary~1create'
|
||||
/pb/api/dictionary/update:
|
||||
$ref: '../openapi-manage.yaml#/paths/~1pb~1api~1dictionary~1update'
|
||||
/pb/api/dictionary/delete:
|
||||
$ref: '../openapi-manage.yaml#/paths/~1pb~1api~1dictionary~1delete'
|
||||
/pb/api/attachment/list:
|
||||
$ref: '../openapi-manage.yaml#/paths/~1pb~1api~1attachment~1list'
|
||||
/pb/api/attachment/detail:
|
||||
$ref: '../openapi-manage.yaml#/paths/~1pb~1api~1attachment~1detail'
|
||||
/pb/api/attachment/upload:
|
||||
$ref: '../openapi-manage.yaml#/paths/~1pb~1api~1attachment~1upload'
|
||||
/pb/api/attachment/delete:
|
||||
$ref: '../openapi-manage.yaml#/paths/~1pb~1api~1attachment~1delete'
|
||||
/pb/api/document/list:
|
||||
$ref: '../openapi-manage.yaml#/paths/~1pb~1api~1document~1list'
|
||||
/pb/api/document/detail:
|
||||
$ref: '../openapi-manage.yaml#/paths/~1pb~1api~1document~1detail'
|
||||
/pb/api/document/create:
|
||||
$ref: '../openapi-manage.yaml#/paths/~1pb~1api~1document~1create'
|
||||
/pb/api/document/update:
|
||||
$ref: '../openapi-manage.yaml#/paths/~1pb~1api~1document~1update'
|
||||
/pb/api/document/delete:
|
||||
$ref: '../openapi-manage.yaml#/paths/~1pb~1api~1document~1delete'
|
||||
/pb/api/document-history/list:
|
||||
$ref: '../openapi-manage.yaml#/paths/~1pb~1api~1document-history~1list'
|
||||
/pb/api/cart/list:
|
||||
$ref: './cart.yaml#/paths/cartList'
|
||||
/pb/api/cart/detail:
|
||||
$ref: './cart.yaml#/paths/cartDetail'
|
||||
/pb/api/cart/create:
|
||||
$ref: './cart.yaml#/paths/cartCreate'
|
||||
/pb/api/cart/update:
|
||||
$ref: './cart.yaml#/paths/cartUpdate'
|
||||
/pb/api/cart/delete:
|
||||
$ref: './cart.yaml#/paths/cartDelete'
|
||||
/pb/api/order/list:
|
||||
$ref: './order.yaml#/paths/orderList'
|
||||
/pb/api/order/detail:
|
||||
$ref: './order.yaml#/paths/orderDetail'
|
||||
/pb/api/order/create:
|
||||
$ref: './order.yaml#/paths/orderCreate'
|
||||
/pb/api/order/update:
|
||||
$ref: './order.yaml#/paths/orderUpdate'
|
||||
/pb/api/order/delete:
|
||||
$ref: './order.yaml#/paths/orderDelete'
|
||||
371
pocket-base/spec/openapi-manage/order.yaml
Normal file
371
pocket-base/spec/openapi-manage/order.yaml
Normal file
@@ -0,0 +1,371 @@
|
||||
paths:
|
||||
orderList:
|
||||
post:
|
||||
tags: [订单]
|
||||
summary: 查询订单列表
|
||||
description: |
|
||||
调用自定义 hooks API 查询当前登录用户的订单列表。
|
||||
请求头请自行携带 `Authorization: Bearer <token>`。
|
||||
requestBody:
|
||||
required: false
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/OrderListRequest'
|
||||
example:
|
||||
keyword: 模糊搜索关键字|string
|
||||
order_status: 订单状态|string
|
||||
order_source: 订单来源|string
|
||||
responses:
|
||||
'200':
|
||||
description: 查询成功
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/OrderListResponse'
|
||||
'400':
|
||||
description: 参数错误
|
||||
'401':
|
||||
description: token 无效或已过期
|
||||
'415':
|
||||
description: 请求体必须为 application/json
|
||||
'500':
|
||||
description: 服务端错误
|
||||
orderDetail:
|
||||
post:
|
||||
tags: [订单]
|
||||
summary: 查询订单详情
|
||||
description: |
|
||||
调用自定义 hooks API 按 `order_id` 查询单条订单记录。
|
||||
请求头请自行携带 `Authorization: Bearer <token>`。
|
||||
requestBody:
|
||||
required: true
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/OrderDetailRequest'
|
||||
example:
|
||||
order_id: 订单业务ID|string
|
||||
responses:
|
||||
'200':
|
||||
description: 查询成功
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/OrderRecord'
|
||||
'400':
|
||||
description: 参数错误
|
||||
'401':
|
||||
description: token 无效或已过期
|
||||
'403':
|
||||
description: 无权访问该订单记录
|
||||
'404':
|
||||
description: 未找到对应订单记录
|
||||
'415':
|
||||
description: 请求体必须为 application/json
|
||||
'500':
|
||||
description: 服务端错误
|
||||
orderCreate:
|
||||
post:
|
||||
tags: [订单]
|
||||
summary: 新增订单记录
|
||||
description: |
|
||||
调用自定义 hooks API 新增订单记录。
|
||||
服务端会基于当前 token 自动写入 `order_owner` 并生成 `order_id`。
|
||||
requestBody:
|
||||
required: true
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/OrderCreateRequest'
|
||||
example:
|
||||
order_number: 可选;未传时服务端自动生成|string
|
||||
order_source: 订单来源|string
|
||||
order_status: 订单状态|string
|
||||
order_source_id: 来源关联业务ID|string
|
||||
order_snap:
|
||||
字段名|string: 字段值|string
|
||||
order_amount: 订单金额|integer
|
||||
order_remark: 备注|string
|
||||
responses:
|
||||
'200':
|
||||
description: 创建成功
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/OrderRecord'
|
||||
'400':
|
||||
description: 参数错误或创建失败
|
||||
'401':
|
||||
description: token 无效或已过期
|
||||
'415':
|
||||
description: 请求体必须为 application/json
|
||||
'429':
|
||||
description: 重复请求过于频繁
|
||||
'500':
|
||||
description: 服务端错误
|
||||
orderUpdate:
|
||||
post:
|
||||
tags: [订单]
|
||||
summary: 修改订单记录
|
||||
description: |
|
||||
调用自定义 hooks API 按 `order_id` 更新订单记录。
|
||||
请求头请自行携带 `Authorization: Bearer <token>`。
|
||||
requestBody:
|
||||
required: true
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/OrderUpdateRequest'
|
||||
example:
|
||||
order_id: 订单业务ID|string
|
||||
order_number: 订单编号|string
|
||||
order_source: 订单来源|string
|
||||
order_status: 订单状态|string
|
||||
order_source_id: 来源关联业务ID|string
|
||||
order_snap:
|
||||
字段名|string: 字段值|string
|
||||
order_amount: 订单金额|integer
|
||||
order_remark: 备注|string
|
||||
responses:
|
||||
'200':
|
||||
description: 更新成功
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/OrderRecord'
|
||||
'400':
|
||||
description: 参数错误或更新失败
|
||||
'401':
|
||||
description: token 无效或已过期
|
||||
'403':
|
||||
description: 无权访问该订单记录
|
||||
'404':
|
||||
description: 未找到待修改记录
|
||||
'415':
|
||||
description: 请求体必须为 application/json
|
||||
'429':
|
||||
description: 重复请求过于频繁
|
||||
'500':
|
||||
description: 服务端错误
|
||||
orderDelete:
|
||||
post:
|
||||
tags: [订单]
|
||||
summary: 删除订单记录
|
||||
description: |
|
||||
调用自定义 hooks API 按 `order_id` 删除订单记录。
|
||||
当前后端实现以实际 hooks 逻辑为准。
|
||||
requestBody:
|
||||
required: true
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/OrderDeleteRequest'
|
||||
example:
|
||||
order_id: 订单业务ID|string
|
||||
responses:
|
||||
'200':
|
||||
description: 删除成功
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/OrderDeleteResponse'
|
||||
'400':
|
||||
description: 参数错误或删除失败
|
||||
'401':
|
||||
description: token 无效或已过期
|
||||
'403':
|
||||
description: 无权访问该订单记录
|
||||
'404':
|
||||
description: 未找到待删除记录
|
||||
'415':
|
||||
description: 请求体必须为 application/json
|
||||
'429':
|
||||
description: 重复请求过于频繁
|
||||
'500':
|
||||
description: 服务端错误
|
||||
components:
|
||||
schemas:
|
||||
OrderRecord:
|
||||
type: object
|
||||
properties:
|
||||
pb_id:
|
||||
type: string
|
||||
description: PocketBase记录主键id
|
||||
created:
|
||||
type: string
|
||||
description: PocketBase系统创建时间
|
||||
updated:
|
||||
type: string
|
||||
description: PocketBase系统更新时间
|
||||
order_id:
|
||||
type: string
|
||||
description: 订单业务ID
|
||||
order_number:
|
||||
type: string
|
||||
description: 订单编号
|
||||
order_create:
|
||||
type: string
|
||||
description: 订单创建时间
|
||||
order_owner:
|
||||
type: string
|
||||
description: 订单所有者openid
|
||||
order_source:
|
||||
type: string
|
||||
description: 订单来源
|
||||
order_status:
|
||||
type: string
|
||||
description: 订单状态
|
||||
order_source_id:
|
||||
type: string
|
||||
description: 来源关联业务ID
|
||||
order_snap:
|
||||
type: object
|
||||
additionalProperties: true
|
||||
description: 订单快照
|
||||
order_amount:
|
||||
type: [integer, number]
|
||||
description: 订单金额
|
||||
order_remark:
|
||||
type: string
|
||||
description: 备注
|
||||
is_delete:
|
||||
type: [integer, number]
|
||||
description: 删除标记
|
||||
example:
|
||||
pb_id: PocketBase记录主键id|string
|
||||
created: PocketBase系统创建时间|string
|
||||
updated: PocketBase系统更新时间|string
|
||||
order_id: 订单业务ID|string
|
||||
order_number: 订单编号|string
|
||||
order_create: 订单创建时间|string
|
||||
order_owner: 订单所有者openid|string
|
||||
order_source: 订单来源|string
|
||||
order_status: 订单状态|string
|
||||
order_source_id: 来源关联业务ID|string
|
||||
order_snap:
|
||||
字段名|string: 字段值|string
|
||||
order_amount: 订单金额|integer
|
||||
order_remark: 备注|string
|
||||
is_delete: 删除标记|integer
|
||||
OrderListRequest:
|
||||
type: object
|
||||
properties:
|
||||
keyword:
|
||||
type: string
|
||||
order_status:
|
||||
type: string
|
||||
order_source:
|
||||
type: string
|
||||
example:
|
||||
keyword: 模糊搜索关键字|string
|
||||
order_status: 订单状态|string
|
||||
order_source: 订单来源|string
|
||||
OrderDetailRequest:
|
||||
type: object
|
||||
required: [order_id]
|
||||
properties:
|
||||
order_id:
|
||||
type: string
|
||||
example:
|
||||
order_id: 订单业务ID|string
|
||||
OrderCreateRequest:
|
||||
type: object
|
||||
required: [order_source, order_source_id, order_snap, order_amount]
|
||||
properties:
|
||||
order_number:
|
||||
type: string
|
||||
order_source:
|
||||
type: string
|
||||
order_status:
|
||||
type: string
|
||||
order_source_id:
|
||||
type: string
|
||||
order_snap:
|
||||
type: object
|
||||
additionalProperties: true
|
||||
order_amount:
|
||||
type: [integer, number]
|
||||
order_remark:
|
||||
type: string
|
||||
example:
|
||||
order_number: 可选;未传时服务端自动生成|string
|
||||
order_source: 订单来源|string
|
||||
order_status: 订单状态|string
|
||||
order_source_id: 来源关联业务ID|string
|
||||
order_snap:
|
||||
字段名|string: 字段值|string
|
||||
order_amount: 订单金额|integer
|
||||
order_remark: 备注|string
|
||||
OrderUpdateRequest:
|
||||
type: object
|
||||
required: [order_id]
|
||||
properties:
|
||||
order_id:
|
||||
type: string
|
||||
order_number:
|
||||
type: string
|
||||
order_source:
|
||||
type: string
|
||||
order_status:
|
||||
type: string
|
||||
order_source_id:
|
||||
type: string
|
||||
order_snap:
|
||||
type: object
|
||||
additionalProperties: true
|
||||
order_amount:
|
||||
type: [integer, number]
|
||||
order_remark:
|
||||
type: string
|
||||
example:
|
||||
order_id: 订单业务ID|string
|
||||
order_number: 订单编号|string
|
||||
order_source: 订单来源|string
|
||||
order_status: 订单状态|string
|
||||
order_source_id: 来源关联业务ID|string
|
||||
order_snap:
|
||||
字段名|string: 字段值|string
|
||||
order_amount: 订单金额|integer
|
||||
order_remark: 备注|string
|
||||
OrderDeleteRequest:
|
||||
type: object
|
||||
required: [order_id]
|
||||
properties:
|
||||
order_id:
|
||||
type: string
|
||||
example:
|
||||
order_id: 订单业务ID|string
|
||||
OrderListResponse:
|
||||
type: object
|
||||
properties:
|
||||
items:
|
||||
type: array
|
||||
items:
|
||||
$ref: '#/components/schemas/OrderRecord'
|
||||
example:
|
||||
items:
|
||||
- pb_id: PocketBase记录主键id|string
|
||||
created: PocketBase系统创建时间|string
|
||||
updated: PocketBase系统更新时间|string
|
||||
order_id: 订单业务ID|string
|
||||
order_number: 订单编号|string
|
||||
order_create: 订单创建时间|string
|
||||
order_owner: 订单所有者openid|string
|
||||
order_source: 订单来源|string
|
||||
order_status: 订单状态|string
|
||||
order_source_id: 来源关联业务ID|string
|
||||
order_snap:
|
||||
字段名|string: 字段值|string
|
||||
order_amount: 订单金额|integer
|
||||
order_remark: 备注|string
|
||||
OrderDeleteResponse:
|
||||
type: object
|
||||
properties:
|
||||
order_id:
|
||||
type: string
|
||||
is_delete:
|
||||
type: [integer, number]
|
||||
example:
|
||||
order_id: 订单业务ID|string
|
||||
is_delete: 删除标记|integer
|
||||
@@ -1,54 +1,29 @@
|
||||
openapi: 3.1.0
|
||||
info:
|
||||
title: BAI PocketBase WeChat API
|
||||
title: BAI PocketBase Native API
|
||||
version: 1.0.0-wx
|
||||
description: |
|
||||
面向微信端的小程序接口文档。
|
||||
本文档包含微信登录、微信资料完善,以及微信小程序侧会直接调用的业务接口。
|
||||
|
||||
微信小程序调用适配说明:
|
||||
- 除 `/pb/api/wechat/login` 外,调用购物车 / 订单的 PocketBase 原生 records API 时都需要在请求头中携带 `Authorization: Bearer <token>`
|
||||
- `token` 取自 `/pb/api/wechat/login` 成功返回的认证 token
|
||||
- 小程序端应统一使用 HTTPS,不依赖 Cookie / Session
|
||||
- 购物车与订单同时提供两套调用说明:`/pb/api/cart/*`、`/pb/api/order/*` 为自定义 hooks API;`/pb/api/collections/.../records` 为 PocketBase 原生 records API
|
||||
- 按当前 collection 规则,创建 `tbl_cart` / `tbl_order` 原生 records 时,客户端必须显式提交 owner 字段,且值必须等于当前 token 对应的 `openid`
|
||||
- 当前仓库中 `DELETE` 对应的 hooks 实现仍是物理删除;若要满足“仅将 `is_delete` 标记为 `1`”的软删除契约,需同步调整后端服务实现
|
||||
- 当前仓库中购物车 / 订单 hooks 列表与详情接口尚未显式按 `is_delete = 0` 过滤;若要完全满足软删除检索约束,需同步调整后端服务实现
|
||||
license:
|
||||
name: Proprietary
|
||||
identifier: LicenseRef-Proprietary
|
||||
顶层兼容入口。
|
||||
当前原生 API 文档已整理到 `spec/openapi-wx/` 目录下;本文件保留为兼容总入口。
|
||||
servers:
|
||||
- url: https://bai-api.blv-oa.com
|
||||
description: 生产环境
|
||||
- url: http://127.0.0.1:8090
|
||||
description: PocketBase 本地环境
|
||||
tags:
|
||||
- name: 系统
|
||||
description: 微信端共用系统接口
|
||||
- name: 微信认证
|
||||
description: 微信登录、资料完善与 token 刷新接口
|
||||
- name: 企业信息
|
||||
description: 通过 PocketBase 原生 records API 访问 `tbl_company`
|
||||
description: PocketBase 原生公司记录接口
|
||||
- name: 附件信息
|
||||
description: 通过 PocketBase 原生 records API 访问 `tbl_attachments`
|
||||
description: PocketBase 原生附件记录接口
|
||||
- name: 产品信息
|
||||
description: 通过 PocketBase 原生 records API 访问 `tbl_product_list`
|
||||
description: PocketBase 原生产品记录接口
|
||||
- name: 文档信息
|
||||
description: 通过 PocketBase 原生 records API 访问 `tbl_document`
|
||||
description: PocketBase 原生文档记录接口
|
||||
- name: 购物车
|
||||
description: 微信小程序侧购物车 CRUD 接口
|
||||
description: PocketBase 原生购物车记录接口
|
||||
- name: 订单
|
||||
description: 微信小程序侧订单 CRUD 接口
|
||||
security: []
|
||||
description: PocketBase 原生订单记录接口
|
||||
paths:
|
||||
/pb/api/system/users-count:
|
||||
$ref: './openapi-wx/system.yaml#/paths/usersCount'
|
||||
/pb/api/system/refresh-token:
|
||||
$ref: './openapi-wx/system.yaml#/paths/refreshToken'
|
||||
/pb/api/wechat/login:
|
||||
$ref: './openapi-wx/wechat-auth.yaml#/paths/wechatLogin'
|
||||
/pb/api/wechat/profile:
|
||||
$ref: './openapi-wx/wechat-auth.yaml#/paths/wechatProfile'
|
||||
/pb/api/collections/tbl_company/records:
|
||||
$ref: './openapi-wx/company.yaml#/paths/companyRecords'
|
||||
/pb/api/collections/tbl_company/records/{recordId}:
|
||||
@@ -59,150 +34,11 @@ paths:
|
||||
$ref: './openapi-wx/products.yaml#/paths/productRecords'
|
||||
/pb/api/collections/tbl_document/records:
|
||||
$ref: './openapi-wx/documents.yaml#/paths/documentRecords'
|
||||
/pb/api/cart/list:
|
||||
$ref: './openapi-wx/cart.yaml#/paths/cartList'
|
||||
/pb/api/cart/detail:
|
||||
$ref: './openapi-wx/cart.yaml#/paths/cartDetail'
|
||||
/pb/api/cart/create:
|
||||
$ref: './openapi-wx/cart.yaml#/paths/cartCreate'
|
||||
/pb/api/cart/update:
|
||||
$ref: './openapi-wx/cart.yaml#/paths/cartUpdate'
|
||||
/pb/api/cart/delete:
|
||||
$ref: './openapi-wx/cart.yaml#/paths/cartDelete'
|
||||
/pb/api/collections/tbl_cart/records:
|
||||
$ref: './openapi-wx/cart.yaml#/paths/cartRecords'
|
||||
/pb/api/collections/tbl_cart/records/{recordId}:
|
||||
$ref: './openapi-wx/cart.yaml#/paths/cartRecordById'
|
||||
/pb/api/order/list:
|
||||
$ref: './openapi-wx/order.yaml#/paths/orderList'
|
||||
/pb/api/order/detail:
|
||||
$ref: './openapi-wx/order.yaml#/paths/orderDetail'
|
||||
/pb/api/order/create:
|
||||
$ref: './openapi-wx/order.yaml#/paths/orderCreate'
|
||||
/pb/api/order/update:
|
||||
$ref: './openapi-wx/order.yaml#/paths/orderUpdate'
|
||||
/pb/api/order/delete:
|
||||
$ref: './openapi-wx/order.yaml#/paths/orderDelete'
|
||||
/pb/api/collections/tbl_order/records:
|
||||
$ref: './openapi-wx/order.yaml#/paths/orderRecords'
|
||||
/pb/api/collections/tbl_order/records/{recordId}:
|
||||
$ref: './openapi-wx/order.yaml#/paths/orderRecordById'
|
||||
components:
|
||||
securitySchemes:
|
||||
BearerAuth:
|
||||
type: http
|
||||
scheme: bearer
|
||||
bearerFormat: JWT
|
||||
schemas:
|
||||
ApiResponseBase:
|
||||
$ref: './openapi-wx/system.yaml#/components/schemas/ApiResponseBase'
|
||||
ErrorResponse:
|
||||
$ref: './openapi-wx/system.yaml#/components/schemas/ErrorResponse'
|
||||
SystemRefreshTokenRequest:
|
||||
$ref: './openapi-wx/system.yaml#/components/schemas/SystemRefreshTokenRequest'
|
||||
RefreshTokenResponse:
|
||||
$ref: './openapi-wx/system.yaml#/components/schemas/RefreshTokenResponse'
|
||||
UsersCountData:
|
||||
$ref: './openapi-wx/system.yaml#/components/schemas/UsersCountData'
|
||||
UsersCountResponse:
|
||||
$ref: './openapi-wx/system.yaml#/components/schemas/UsersCountResponse'
|
||||
UserInfo:
|
||||
$ref: './openapi-wx/wechat-auth.yaml#/components/schemas/UserInfo'
|
||||
WechatLoginRequest:
|
||||
$ref: './openapi-wx/wechat-auth.yaml#/components/schemas/WechatLoginRequest'
|
||||
WechatProfileRequest:
|
||||
$ref: './openapi-wx/wechat-auth.yaml#/components/schemas/WechatProfileRequest'
|
||||
AuthSuccessData:
|
||||
$ref: './openapi-wx/wechat-auth.yaml#/components/schemas/AuthSuccessData'
|
||||
AuthSuccessResponse:
|
||||
$ref: './openapi-wx/wechat-auth.yaml#/components/schemas/AuthSuccessResponse'
|
||||
WechatProfileResponseData:
|
||||
$ref: './openapi-wx/wechat-auth.yaml#/components/schemas/WechatProfileResponseData'
|
||||
WechatProfileResponse:
|
||||
$ref: './openapi-wx/wechat-auth.yaml#/components/schemas/WechatProfileResponse'
|
||||
CompanyInfo:
|
||||
$ref: './openapi-wx/wechat-auth.yaml#/components/schemas/CompanyInfo'
|
||||
PocketBaseNativeError:
|
||||
$ref: './openapi-wx/company.yaml#/components/schemas/PocketBaseNativeError'
|
||||
PocketBaseRecordBase:
|
||||
$ref: './openapi-wx/company.yaml#/components/schemas/PocketBaseRecordBase'
|
||||
PocketBaseCompanyFields:
|
||||
$ref: './openapi-wx/company.yaml#/components/schemas/PocketBaseCompanyFields'
|
||||
PocketBaseCompanyRecord:
|
||||
$ref: './openapi-wx/company.yaml#/components/schemas/PocketBaseCompanyRecord'
|
||||
PocketBaseCompanyCreateRequest:
|
||||
$ref: './openapi-wx/company.yaml#/components/schemas/PocketBaseCompanyCreateRequest'
|
||||
PocketBaseCompanyUpdateRequest:
|
||||
$ref: './openapi-wx/company.yaml#/components/schemas/PocketBaseCompanyUpdateRequest'
|
||||
PocketBaseCompanyListResponse:
|
||||
$ref: './openapi-wx/company.yaml#/components/schemas/PocketBaseCompanyListResponse'
|
||||
PocketBaseAttachmentRecord:
|
||||
$ref: './openapi-wx/attachments.yaml#/components/schemas/PocketBaseAttachmentRecord'
|
||||
PocketBaseAttachmentListResponse:
|
||||
$ref: './openapi-wx/attachments.yaml#/components/schemas/PocketBaseAttachmentListResponse'
|
||||
PocketBaseProductListFields:
|
||||
$ref: './openapi-wx/products.yaml#/components/schemas/PocketBaseProductListFields'
|
||||
PocketBaseProductListRecord:
|
||||
$ref: './openapi-wx/products.yaml#/components/schemas/PocketBaseProductListRecord'
|
||||
PocketBaseProductListListResponse:
|
||||
$ref: './openapi-wx/products.yaml#/components/schemas/PocketBaseProductListListResponse'
|
||||
PocketBaseDocumentFields:
|
||||
$ref: './openapi-wx/documents.yaml#/components/schemas/PocketBaseDocumentFields'
|
||||
PocketBaseDocumentRecord:
|
||||
$ref: './openapi-wx/documents.yaml#/components/schemas/PocketBaseDocumentRecord'
|
||||
PocketBaseDocumentListResponse:
|
||||
$ref: './openapi-wx/documents.yaml#/components/schemas/PocketBaseDocumentListResponse'
|
||||
HookRecordBase:
|
||||
$ref: './openapi-wx/cart.yaml#/components/schemas/HookRecordBase'
|
||||
CartRecord:
|
||||
$ref: './openapi-wx/cart.yaml#/components/schemas/CartRecord'
|
||||
CartListRequest:
|
||||
$ref: './openapi-wx/cart.yaml#/components/schemas/CartListRequest'
|
||||
CartDetailRequest:
|
||||
$ref: './openapi-wx/cart.yaml#/components/schemas/CartDetailRequest'
|
||||
CartCreateRequest:
|
||||
$ref: './openapi-wx/cart.yaml#/components/schemas/CartCreateRequest'
|
||||
CartUpdateRequest:
|
||||
$ref: './openapi-wx/cart.yaml#/components/schemas/CartUpdateRequest'
|
||||
CartDeleteRequest:
|
||||
$ref: './openapi-wx/cart.yaml#/components/schemas/CartDeleteRequest'
|
||||
CartListResponse:
|
||||
$ref: './openapi-wx/cart.yaml#/components/schemas/CartListResponse'
|
||||
CartDeleteResponse:
|
||||
$ref: './openapi-wx/cart.yaml#/components/schemas/CartDeleteResponse'
|
||||
PocketBaseCartFields:
|
||||
$ref: './openapi-wx/cart.yaml#/components/schemas/PocketBaseCartFields'
|
||||
PocketBaseCartRecord:
|
||||
$ref: './openapi-wx/cart.yaml#/components/schemas/PocketBaseCartRecord'
|
||||
PocketBaseCartCreateRequest:
|
||||
$ref: './openapi-wx/cart.yaml#/components/schemas/PocketBaseCartCreateRequest'
|
||||
PocketBaseCartUpdateRequest:
|
||||
$ref: './openapi-wx/cart.yaml#/components/schemas/PocketBaseCartUpdateRequest'
|
||||
PocketBaseCartListResponse:
|
||||
$ref: './openapi-wx/cart.yaml#/components/schemas/PocketBaseCartListResponse'
|
||||
OrderRecord:
|
||||
$ref: './openapi-wx/order.yaml#/components/schemas/OrderRecord'
|
||||
OrderListRequest:
|
||||
$ref: './openapi-wx/order.yaml#/components/schemas/OrderListRequest'
|
||||
OrderDetailRequest:
|
||||
$ref: './openapi-wx/order.yaml#/components/schemas/OrderDetailRequest'
|
||||
OrderCreateRequest:
|
||||
$ref: './openapi-wx/order.yaml#/components/schemas/OrderCreateRequest'
|
||||
OrderUpdateRequest:
|
||||
$ref: './openapi-wx/order.yaml#/components/schemas/OrderUpdateRequest'
|
||||
OrderDeleteRequest:
|
||||
$ref: './openapi-wx/order.yaml#/components/schemas/OrderDeleteRequest'
|
||||
OrderListResponse:
|
||||
$ref: './openapi-wx/order.yaml#/components/schemas/OrderListResponse'
|
||||
OrderDeleteResponse:
|
||||
$ref: './openapi-wx/order.yaml#/components/schemas/OrderDeleteResponse'
|
||||
PocketBaseOrderFields:
|
||||
$ref: './openapi-wx/order.yaml#/components/schemas/PocketBaseOrderFields'
|
||||
PocketBaseOrderRecord:
|
||||
$ref: './openapi-wx/order.yaml#/components/schemas/PocketBaseOrderRecord'
|
||||
PocketBaseOrderCreateRequest:
|
||||
$ref: './openapi-wx/order.yaml#/components/schemas/PocketBaseOrderCreateRequest'
|
||||
PocketBaseOrderUpdateRequest:
|
||||
$ref: './openapi-wx/order.yaml#/components/schemas/PocketBaseOrderUpdateRequest'
|
||||
PocketBaseOrderListResponse:
|
||||
$ref: './openapi-wx/order.yaml#/components/schemas/PocketBaseOrderListResponse'
|
||||
|
||||
@@ -1,157 +1,155 @@
|
||||
paths:
|
||||
cartList:
|
||||
post:
|
||||
operationId: postCartList
|
||||
tags:
|
||||
- 购物车
|
||||
summary: 按索引字段模糊查询购物车列表
|
||||
cartRecords:
|
||||
get:
|
||||
tags: [购物车]
|
||||
summary: 查询购物车记录列表
|
||||
description: |
|
||||
调用自定义 hooks API 查询当前登录用户的购物车列表。
|
||||
|
||||
查询规则:
|
||||
- 仅允许查询当前 `Authorization` 对应用户自己的购物车记录
|
||||
- 支持通过 `keyword` 对多个索引相关字段做统一模糊搜索,当前实现覆盖:
|
||||
- `cart_id`
|
||||
- `cart_number`
|
||||
- `cart_product_id`
|
||||
- `product_name`
|
||||
- 支持按 `cart_status` 精确过滤
|
||||
- 支持按 `cart_number` 精确过滤
|
||||
|
||||
目标软删除契约:
|
||||
- 目标行为应仅返回 `is_delete = 0` 的记录
|
||||
- 当前仓库实现尚未显式追加 `is_delete = 0` 过滤,请以实际后端代码为准
|
||||
security:
|
||||
- BearerAuth: []
|
||||
requestBody:
|
||||
required: false
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: ../openapi-wx.yaml#/components/schemas/CartListRequest
|
||||
example:
|
||||
keyword: 对 cart_id、cart_number、cart_product_id 等索引相关字段的统一模糊搜索关键字|string
|
||||
cart_status: 购物车状态精确过滤|string
|
||||
cart_number: 购物车名称或分组号精确过滤|string
|
||||
使用 PocketBase 原生 records list 接口查询 `tbl_cart`。
|
||||
如需鉴权,请自行在请求头中携带 `Authorization: Bearer <token>`。
|
||||
parameters:
|
||||
- name: filter
|
||||
in: query
|
||||
required: false
|
||||
schema:
|
||||
type: string
|
||||
description: PocketBase 原生过滤表达式
|
||||
example: cart_id="购物车业务ID|string"
|
||||
- name: page
|
||||
in: query
|
||||
required: false
|
||||
schema:
|
||||
type: integer
|
||||
minimum: 1
|
||||
default: 1
|
||||
- name: perPage
|
||||
in: query
|
||||
required: false
|
||||
schema:
|
||||
type: integer
|
||||
minimum: 1
|
||||
default: 20
|
||||
- name: sort
|
||||
in: query
|
||||
required: false
|
||||
schema:
|
||||
type: string
|
||||
example: -cart_create
|
||||
responses:
|
||||
"200":
|
||||
'200':
|
||||
description: 查询成功
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: ../openapi-wx.yaml#/components/schemas/CartListResponse
|
||||
example:
|
||||
items:
|
||||
- pb_id: PocketBase 记录主键 id|string
|
||||
created: PocketBase 系统创建时间|string
|
||||
updated: PocketBase 系统更新时间|string
|
||||
cart_id: 购物车业务 ID|string
|
||||
cart_number: 购物车名称或分组号|string
|
||||
cart_create: 购物车项创建时间,由数据库自动生成|string
|
||||
cart_owner: 购物车所有者 openid|string
|
||||
cart_product_id: 产品业务 ID|string
|
||||
cart_product_quantity: 产品数量|integer
|
||||
cart_status: 购物车状态|string
|
||||
cart_at_price: 加入购物车时价格|integer
|
||||
cart_remark: 备注|string
|
||||
is_delete: 软删除标记;目标契约字段,当前 hooks 响应可能尚未显式透出|integer
|
||||
product_name: 产品名称(服务端联动补充)|string
|
||||
product_modelnumber: 产品型号(服务端联动补充)|string
|
||||
product_basic_price: 产品基础价格(服务端联动补充)|integer
|
||||
"400":
|
||||
description: 参数错误
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: ../openapi-wx.yaml#/components/schemas/ErrorResponse
|
||||
example:
|
||||
statusCode: 业务状态码|integer
|
||||
errMsg: 业务提示信息|string
|
||||
data:
|
||||
业务响应数据字段|string: 业务响应数据值|string
|
||||
"401":
|
||||
description: token 缺失、无效或已过期
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: ../openapi-wx.yaml#/components/schemas/ErrorResponse
|
||||
example:
|
||||
statusCode: 业务状态码|integer
|
||||
errMsg: 业务提示信息|string
|
||||
data:
|
||||
业务响应数据字段|string: 业务响应数据值|string
|
||||
"415":
|
||||
description: 请求体必须为 application/json
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: ../openapi-wx.yaml#/components/schemas/ErrorResponse
|
||||
example:
|
||||
statusCode: 业务状态码|integer
|
||||
errMsg: 业务提示信息|string
|
||||
data:
|
||||
业务响应数据字段|string: 业务响应数据值|string
|
||||
"500":
|
||||
$ref: '#/components/schemas/PocketBaseCartListResponse'
|
||||
'400':
|
||||
description: 查询参数错误
|
||||
'401':
|
||||
description: token 无效或已过期
|
||||
'403':
|
||||
description: 无权访问
|
||||
'500':
|
||||
description: 服务端错误
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: ../openapi-wx.yaml#/components/schemas/ErrorResponse
|
||||
example:
|
||||
statusCode: 业务状态码|integer
|
||||
errMsg: 业务提示信息|string
|
||||
data:
|
||||
业务响应数据字段|string: 业务响应数据值|string
|
||||
cartDetail:
|
||||
post:
|
||||
operationId: postCartDetail
|
||||
tags:
|
||||
- 购物车
|
||||
summary: 按 cart_id 精确查询购物车详情
|
||||
tags: [购物车]
|
||||
summary: 创建购物车记录
|
||||
description: |
|
||||
调用自定义 hooks API 按 `cart_id` 查询单条购物车记录。
|
||||
|
||||
查询规则:
|
||||
- 仅允许访问当前 `Authorization` 对应用户自己的购物车记录
|
||||
- 查询键为业务 ID `cart_id`,不是 PocketBase 原生 `recordId`
|
||||
|
||||
目标软删除契约:
|
||||
- 目标行为应仅允许查询 `is_delete = 0` 的记录
|
||||
- 当前仓库实现尚未显式追加 `is_delete = 0` 过滤,请以实际后端代码为准
|
||||
security:
|
||||
- BearerAuth: []
|
||||
使用 PocketBase 原生 records create 接口向 `tbl_cart` 新增记录。
|
||||
如集合规则要求 `cart_owner` 与当前用户一致,请客户端显式提交。
|
||||
requestBody:
|
||||
required: true
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: ../openapi-wx.yaml#/components/schemas/CartDetailRequest
|
||||
$ref: '#/components/schemas/PocketBaseCartCreateRequest'
|
||||
example:
|
||||
cart_id: 购物车业务 ID|string
|
||||
cart_id: 购物车业务ID|string
|
||||
cart_number: 购物车名称或分组号|string
|
||||
cart_owner: 购物车所有者openid|string
|
||||
cart_product_id: tbl_product_list 的 PocketBase recordId|string
|
||||
cart_product_quantity: 产品数量|integer
|
||||
cart_status: 购物车状态|string
|
||||
cart_at_price: 加入购物车时价格|number
|
||||
cart_remark: 备注|string
|
||||
responses:
|
||||
"200":
|
||||
description: 查询成功
|
||||
'200':
|
||||
description: 创建成功
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: ../openapi-wx.yaml#/components/schemas/CartRecord
|
||||
example:
|
||||
pb_id: PocketBase 记录主键 id|string
|
||||
created: PocketBase 系统创建时间|string
|
||||
updated: PocketBase 系统更新时间|string
|
||||
cart_id: 购物车业务 ID|string
|
||||
cart_number: 购物车名称或分组号|string
|
||||
cart_create: 购物车项创建时间,由数据库自动生成|string
|
||||
cart_owner: 购物车所有者 openid|string
|
||||
cart_product_id: 产品业务 ID|string
|
||||
cart_product_quantity: 产品数量|integer
|
||||
cart_status: 购物车状态|string
|
||||
cart_at_price: 加入购物车时价格|integer
|
||||
cart_remark: 备注|string
|
||||
is_delete: 软删除标记;目标契约字段,当前 hooks 响应可能尚未显式透出|integer
|
||||
product_name: 产品名称(服务端联动补充)|string
|
||||
product_modelnumber: 产品型号(服务端联动补充)|string
|
||||
product_basic_price: 产品基础价格(服务端联动补充)|integer
|
||||
$ref: '#/components/schemas/PocketBaseCartRecord'
|
||||
'400':
|
||||
description: 参数错误或违反集合规则
|
||||
'401':
|
||||
description: token 无效或已过期
|
||||
'403':
|
||||
description: 无权访问
|
||||
'500':
|
||||
description: 服务端错误
|
||||
cartRecordById:
|
||||
patch:
|
||||
tags: [购物车]
|
||||
summary: 更新购物车记录
|
||||
description: |
|
||||
使用 PocketBase 原生 records update 接口更新 `tbl_cart`。
|
||||
路径参数使用 PocketBase 原生 `recordId`。
|
||||
parameters:
|
||||
- name: recordId
|
||||
in: path
|
||||
required: true
|
||||
schema:
|
||||
type: string
|
||||
example: PocketBase记录主键|string
|
||||
requestBody:
|
||||
required: true
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/PocketBaseCartUpdateRequest'
|
||||
example:
|
||||
cart_number: 购物车名称或分组号|string
|
||||
cart_owner: 购物车所有者openid|string
|
||||
cart_product_id: tbl_product_list 的 PocketBase recordId|string
|
||||
cart_product_quantity: 产品数量|integer
|
||||
cart_status: 购物车状态|string
|
||||
cart_at_price: 加入购物车时价格|number
|
||||
cart_remark: 备注|string
|
||||
responses:
|
||||
'200':
|
||||
description: 更新成功
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/PocketBaseCartRecord'
|
||||
'400':
|
||||
description: 参数错误
|
||||
'401':
|
||||
description: token 无效或已过期
|
||||
'404':
|
||||
description: 记录不存在
|
||||
'500':
|
||||
description: 服务端错误
|
||||
delete:
|
||||
tags: [购物车]
|
||||
summary: 删除购物车记录
|
||||
description: |
|
||||
使用 PocketBase 原生 records delete 接口删除 `tbl_cart`。
|
||||
路径参数使用 PocketBase 原生 `recordId`。
|
||||
parameters:
|
||||
- name: recordId
|
||||
in: path
|
||||
required: true
|
||||
schema:
|
||||
type: string
|
||||
example: PocketBase记录主键|string
|
||||
responses:
|
||||
'204':
|
||||
description: 删除成功
|
||||
'401':
|
||||
description: token 无效或已过期
|
||||
'404':
|
||||
description: 记录不存在
|
||||
'500':
|
||||
description: 服务端错误
|
||||
"400":
|
||||
description: 参数错误
|
||||
content:
|
||||
@@ -231,7 +229,8 @@ paths:
|
||||
- 服务端自动根据当前 token 写入 `cart_owner`
|
||||
- 服务端自动生成 `cart_id`
|
||||
- 若未传 `cart_number`,服务端会自动生成展示编号
|
||||
- `cart_product_id`、`cart_product_quantity`、`cart_at_price` 为必填
|
||||
- `cart_product_id` 为必填;当前 hooks 与库结构保持一致,必须传 `tbl_product_list` 的 `recordId`
|
||||
- `cart_product_quantity`、`cart_at_price` 为必填
|
||||
|
||||
目标软删除契约:
|
||||
- 新建记录应默认为 `is_delete = 0`
|
||||
@@ -246,7 +245,7 @@ paths:
|
||||
$ref: ../openapi-wx.yaml#/components/schemas/CartCreateRequest
|
||||
example:
|
||||
cart_number: 可选;未传时服务端自动生成|string
|
||||
cart_product_id: 产品业务 ID|string
|
||||
cart_product_id: tbl_product_list 的 PocketBase recordId|string
|
||||
cart_product_quantity: 产品数量,需为正整数|integer
|
||||
cart_status: 可选;未传时默认 有效|string
|
||||
cart_at_price: 加入购物车时价格|integer
|
||||
@@ -266,7 +265,8 @@ paths:
|
||||
cart_number: 购物车名称或分组号|string
|
||||
cart_create: 购物车项创建时间,由数据库自动生成|string
|
||||
cart_owner: 购物车所有者 openid|string
|
||||
cart_product_id: 产品业务 ID|string
|
||||
cart_product_id: 关联产品的 PocketBase recordId|string
|
||||
cart_product_business_id: 产品业务 ID|string
|
||||
cart_product_quantity: 产品数量|integer
|
||||
cart_status: 购物车状态|string
|
||||
cart_at_price: 加入购物车时价格|integer
|
||||
@@ -354,7 +354,7 @@ paths:
|
||||
example:
|
||||
cart_id: 购物车业务 ID|string
|
||||
cart_number: cart_number|string
|
||||
cart_product_id: cart_product_id|string
|
||||
cart_product_id: tbl_product_list 的 PocketBase recordId|string
|
||||
cart_product_quantity: cart_product_quantity|integer
|
||||
cart_status: cart_status|string
|
||||
cart_at_price: cart_at_price|integer
|
||||
@@ -374,7 +374,8 @@ paths:
|
||||
cart_number: 购物车名称或分组号|string
|
||||
cart_create: 购物车项创建时间,由数据库自动生成|string
|
||||
cart_owner: 购物车所有者 openid|string
|
||||
cart_product_id: 产品业务 ID|string
|
||||
cart_product_id: 关联产品的 PocketBase recordId|string
|
||||
cart_product_business_id: 产品业务 ID|string
|
||||
cart_product_quantity: 产品数量|integer
|
||||
cart_status: 购物车状态|string
|
||||
cart_at_price: 加入购物车时价格|integer
|
||||
@@ -710,8 +711,9 @@ paths:
|
||||
使用 PocketBase 原生 records create 接口向 `tbl_cart` 新增记录。
|
||||
|
||||
当前线上权限规则:
|
||||
- `createRule = @request.auth.id != "" && @request.body.cart_owner = @request.auth.openid`
|
||||
- 因此客户端创建时必须显式提交 `cart_owner`,并且值必须等于当前 token 对应的 `openid`
|
||||
- `createRule = @request.body.cart_owner != ""`
|
||||
- 因此客户端创建时必须显式提交非空 `cart_owner`
|
||||
- `cart_product_id` 当前为 relation 字段,必须传 `tbl_product_list` 的 PocketBase `recordId`
|
||||
|
||||
这意味着:
|
||||
- 不能依赖服务端自动补 owner
|
||||
@@ -728,11 +730,11 @@ paths:
|
||||
example:
|
||||
cart_id: cart_id|string
|
||||
cart_number: cart_number|string
|
||||
cart_owner: 必须显式提交,且值必须等于当前 token 对应 openid|string
|
||||
cart_product_id: cart_product_id|string
|
||||
cart_product_quantity: cart_product_quantity|integer
|
||||
cart_status: cart_status|string
|
||||
cart_at_price: cart_at_price|number
|
||||
cart_owner: 必须显式提交非空 owner|string
|
||||
cart_product_id: tbl_product_list 的 PocketBase recordId|string
|
||||
cart_product_quantity: cart_product_quantity|integer,可为空
|
||||
cart_status: cart_status|string,可为空
|
||||
cart_at_price: cart_at_price|number,可为空
|
||||
cart_remark: cart_remark|string
|
||||
responses:
|
||||
"200":
|
||||
@@ -751,7 +753,7 @@ paths:
|
||||
cart_number: 购物车名称或分组号|string
|
||||
cart_create: 购物车项创建时间,由数据库自动生成|string
|
||||
cart_owner: 购物车所有者 openid|string
|
||||
cart_product_id: 产品业务 ID|string
|
||||
cart_product_id: 关联产品的 PocketBase recordId|string
|
||||
cart_product_quantity: 产品数量|integer
|
||||
cart_status: 购物车状态|string
|
||||
cart_at_price: 加入购物车时价格|number
|
||||
@@ -963,77 +965,6 @@ paths:
|
||||
业务响应数据字段|string: 业务响应数据值|string
|
||||
components:
|
||||
schemas:
|
||||
ApiResponseBase:
|
||||
type: object
|
||||
required:
|
||||
- statusCode
|
||||
- errMsg
|
||||
- data
|
||||
properties:
|
||||
statusCode:
|
||||
type:
|
||||
- integer
|
||||
- string
|
||||
description: 业务状态码
|
||||
example: 业务状态码 | integer
|
||||
errMsg:
|
||||
type: string
|
||||
description: 业务提示信息
|
||||
example: 业务提示信息 | string
|
||||
data:
|
||||
description: 业务响应数据
|
||||
type: object
|
||||
additionalProperties: true
|
||||
example:
|
||||
statusCode: 业务状态码|integer
|
||||
errMsg: 业务提示信息|string
|
||||
data:
|
||||
业务响应数据字段|string: 业务响应数据值|string
|
||||
ErrorResponse:
|
||||
type: object
|
||||
required:
|
||||
- statusCode
|
||||
- errMsg
|
||||
- data
|
||||
properties:
|
||||
statusCode:
|
||||
type:
|
||||
- integer
|
||||
- string
|
||||
description: 业务状态码
|
||||
example: 业务状态码 | integer
|
||||
errMsg:
|
||||
type: string
|
||||
description: 业务提示信息
|
||||
example: 失败原因提示 | string
|
||||
data:
|
||||
description: 业务响应数据
|
||||
type: object
|
||||
additionalProperties: true
|
||||
example:
|
||||
statusCode: 业务状态码|integer
|
||||
errMsg: 业务提示信息|string
|
||||
data:
|
||||
业务响应数据字段|string: 业务响应数据值|string
|
||||
HookRecordBase:
|
||||
type: object
|
||||
properties:
|
||||
pb_id:
|
||||
type: string
|
||||
description: PocketBase 记录主键 id
|
||||
example: l2r3nq7rqhuob0h
|
||||
created:
|
||||
type: string
|
||||
description: PocketBase 系统创建时间
|
||||
example: 2026-04-03 15:30:00.000Z
|
||||
updated:
|
||||
type: string
|
||||
description: PocketBase 系统更新时间
|
||||
example: 2026-04-03 15:35:00.000Z
|
||||
example:
|
||||
pb_id: PocketBase 记录主键 id|string
|
||||
created: PocketBase 系统创建时间|string
|
||||
updated: PocketBase 系统更新时间|string
|
||||
PocketBaseNativeError:
|
||||
type: object
|
||||
properties:
|
||||
@@ -1041,13 +972,14 @@ components:
|
||||
type:
|
||||
- integer
|
||||
- string
|
||||
description: 业务状态码
|
||||
description: PocketBase错误码
|
||||
example: 错误状态码 | integer
|
||||
message:
|
||||
type: string
|
||||
description: PocketBase错误信息
|
||||
example: PocketBase原生错误信息 | string
|
||||
data:
|
||||
description: 业务响应数据
|
||||
description: PocketBase错误数据
|
||||
type: object
|
||||
additionalProperties: true
|
||||
example:
|
||||
@@ -1088,245 +1020,6 @@ components:
|
||||
collectionName: collectionName|string
|
||||
created: 记录创建时间|string
|
||||
updated: 记录更新时间|string
|
||||
CartRecord:
|
||||
allOf:
|
||||
- $ref: ../openapi-wx.yaml#/components/schemas/HookRecordBase
|
||||
- type: object
|
||||
properties:
|
||||
cart_id:
|
||||
type: string
|
||||
description: 购物车业务 ID
|
||||
example: CART-1770000000000-abc123
|
||||
cart_number:
|
||||
type: string
|
||||
description: 购物车名称或分组号
|
||||
example: wx-user-20260403153000
|
||||
cart_create:
|
||||
type: string
|
||||
description: 购物车项创建时间,由数据库自动生成
|
||||
example: 2026-04-03 15:30:00.000Z
|
||||
cart_owner:
|
||||
type: string
|
||||
description: 购物车所有者 openid
|
||||
example: wx-openid-user-001
|
||||
cart_product_id:
|
||||
type: string
|
||||
description: 产品业务 ID
|
||||
example: PROD-1770000000000-abcd12
|
||||
cart_product_quantity:
|
||||
type:
|
||||
- integer
|
||||
- number
|
||||
description: 产品数量
|
||||
example: 2
|
||||
cart_status:
|
||||
type: string
|
||||
description: 购物车状态
|
||||
example: 有效
|
||||
cart_at_price:
|
||||
type:
|
||||
- integer
|
||||
- number
|
||||
description: 加入购物车时价格
|
||||
example: 1999
|
||||
cart_remark:
|
||||
type: string
|
||||
description: 备注
|
||||
example: 小程序加入购物车示例
|
||||
is_delete:
|
||||
type:
|
||||
- integer
|
||||
- number
|
||||
description: 软删除标记;目标契约字段,当前 hooks 响应可能尚未显式透出
|
||||
example: 0
|
||||
product_name:
|
||||
type: string
|
||||
description: 产品名称(服务端联动补充)
|
||||
example: BAI 智能主机
|
||||
product_modelnumber:
|
||||
type: string
|
||||
description: 产品型号(服务端联动补充)
|
||||
example: BAI-HOST-01
|
||||
product_basic_price:
|
||||
type:
|
||||
- integer
|
||||
- number
|
||||
- "null"
|
||||
description: 产品基础价格(服务端联动补充)
|
||||
example: 1999
|
||||
example:
|
||||
pb_id: PocketBase 记录主键 id|string
|
||||
created: PocketBase 系统创建时间|string
|
||||
updated: PocketBase 系统更新时间|string
|
||||
cart_id: 购物车业务 ID|string
|
||||
cart_number: 购物车名称或分组号|string
|
||||
cart_create: 购物车项创建时间,由数据库自动生成|string
|
||||
cart_owner: 购物车所有者 openid|string
|
||||
cart_product_id: 产品业务 ID|string
|
||||
cart_product_quantity: 产品数量|integer
|
||||
cart_status: 购物车状态|string
|
||||
cart_at_price: 加入购物车时价格|integer
|
||||
cart_remark: 备注|string
|
||||
is_delete: 软删除标记;目标契约字段,当前 hooks 响应可能尚未显式透出|integer
|
||||
product_name: 产品名称(服务端联动补充)|string
|
||||
product_modelnumber: 产品型号(服务端联动补充)|string
|
||||
product_basic_price: 产品基础价格(服务端联动补充)|integer
|
||||
CartListRequest:
|
||||
type: object
|
||||
properties:
|
||||
keyword:
|
||||
type: string
|
||||
description: 对 `cart_id`、`cart_number`、`cart_product_id` 等索引相关字段的统一模糊搜索关键字
|
||||
example: CART-1770
|
||||
cart_status:
|
||||
type: string
|
||||
description: 购物车状态精确过滤
|
||||
example: 有效
|
||||
cart_number:
|
||||
type: string
|
||||
description: 购物车名称或分组号精确过滤
|
||||
example: wx-user-20260403153000
|
||||
example:
|
||||
keyword: 对 cart_id、cart_number、cart_product_id 等索引相关字段的统一模糊搜索关键字|string
|
||||
cart_status: 购物车状态精确过滤|string
|
||||
cart_number: 购物车名称或分组号精确过滤|string
|
||||
CartDetailRequest:
|
||||
type: object
|
||||
required:
|
||||
- cart_id
|
||||
properties:
|
||||
cart_id:
|
||||
type: string
|
||||
description: 购物车业务 ID
|
||||
example: CART-1770000000000-abc123
|
||||
example:
|
||||
cart_id: 购物车业务 ID|string
|
||||
CartCreateRequest:
|
||||
type: object
|
||||
required:
|
||||
- cart_product_id
|
||||
- cart_product_quantity
|
||||
- cart_at_price
|
||||
properties:
|
||||
cart_number:
|
||||
type: string
|
||||
description: 可选;未传时服务端自动生成
|
||||
cart_product_id:
|
||||
type: string
|
||||
description: 产品业务 ID
|
||||
example: PROD-1770000000000-abcd12
|
||||
cart_product_quantity:
|
||||
type:
|
||||
- integer
|
||||
- number
|
||||
description: 产品数量,需为正整数
|
||||
example: 2
|
||||
cart_status:
|
||||
type: string
|
||||
description: 可选;未传时默认 `有效`
|
||||
example: 有效
|
||||
cart_at_price:
|
||||
type:
|
||||
- integer
|
||||
- number
|
||||
description: 加入购物车时价格
|
||||
example: 1999
|
||||
cart_remark:
|
||||
type: string
|
||||
description: 备注
|
||||
example: 小程序加入购物车示例
|
||||
example:
|
||||
cart_number: 可选;未传时服务端自动生成|string
|
||||
cart_product_id: 产品业务 ID|string
|
||||
cart_product_quantity: 产品数量,需为正整数|integer
|
||||
cart_status: 可选;未传时默认 有效|string
|
||||
cart_at_price: 加入购物车时价格|integer
|
||||
cart_remark: 备注|string
|
||||
CartUpdateRequest:
|
||||
type: object
|
||||
required:
|
||||
- cart_id
|
||||
properties:
|
||||
cart_id:
|
||||
type: string
|
||||
description: 购物车业务 ID
|
||||
example: CART-1770000000000-abc123
|
||||
cart_number:
|
||||
type: string
|
||||
cart_product_id:
|
||||
type: string
|
||||
cart_product_quantity:
|
||||
type:
|
||||
- integer
|
||||
- number
|
||||
cart_status:
|
||||
type: string
|
||||
cart_at_price:
|
||||
type:
|
||||
- integer
|
||||
- number
|
||||
cart_remark:
|
||||
type: string
|
||||
example:
|
||||
cart_id: 购物车业务 ID|string
|
||||
cart_number: cart_number|string
|
||||
cart_product_id: cart_product_id|string
|
||||
cart_product_quantity: cart_product_quantity|integer
|
||||
cart_status: cart_status|string
|
||||
cart_at_price: cart_at_price|integer
|
||||
cart_remark: cart_remark|string
|
||||
CartDeleteRequest:
|
||||
type: object
|
||||
required:
|
||||
- cart_id
|
||||
properties:
|
||||
cart_id:
|
||||
type: string
|
||||
description: 购物车业务 ID
|
||||
example: CART-1770000000000-abc123
|
||||
example:
|
||||
cart_id: 购物车业务 ID|string
|
||||
CartListResponse:
|
||||
type: object
|
||||
properties:
|
||||
items:
|
||||
type: array
|
||||
items:
|
||||
$ref: ../openapi-wx.yaml#/components/schemas/CartRecord
|
||||
example:
|
||||
items:
|
||||
- pb_id: PocketBase 记录主键 id|string
|
||||
created: PocketBase 系统创建时间|string
|
||||
updated: PocketBase 系统更新时间|string
|
||||
cart_id: 购物车业务 ID|string
|
||||
cart_number: 购物车名称或分组号|string
|
||||
cart_create: 购物车项创建时间,由数据库自动生成|string
|
||||
cart_owner: 购物车所有者 openid|string
|
||||
cart_product_id: 产品业务 ID|string
|
||||
cart_product_quantity: 产品数量|integer
|
||||
cart_status: 购物车状态|string
|
||||
cart_at_price: 加入购物车时价格|integer
|
||||
cart_remark: 备注|string
|
||||
is_delete: 软删除标记;目标契约字段,当前 hooks 响应可能尚未显式透出|integer
|
||||
product_name: 产品名称(服务端联动补充)|string
|
||||
product_modelnumber: 产品型号(服务端联动补充)|string
|
||||
product_basic_price: 产品基础价格(服务端联动补充)|integer
|
||||
CartDeleteResponse:
|
||||
type: object
|
||||
properties:
|
||||
cart_id:
|
||||
type: string
|
||||
description: 购物车业务 ID
|
||||
example: CART-1770000000000-abc123
|
||||
is_delete:
|
||||
type:
|
||||
- integer
|
||||
- number
|
||||
description: 目标软删除标记值;当前实现可能仍返回物理删除结果
|
||||
example: 1
|
||||
example:
|
||||
cart_id: 购物车业务 ID|string
|
||||
is_delete: 目标软删除标记值;当前实现可能仍返回物理删除结果|integer
|
||||
PocketBaseCartFields:
|
||||
type: object
|
||||
properties:
|
||||
@@ -1348,7 +1041,11 @@ components:
|
||||
example: wx-openid-user-001
|
||||
cart_product_id:
|
||||
type: string
|
||||
description: 产品业务 ID
|
||||
description: 关联产品的 PocketBase recordId
|
||||
example: pbc_product_record_id|string
|
||||
cart_product_business_id:
|
||||
type: string
|
||||
description: 关联产品的业务 ID(prod_list_id),用于展示
|
||||
example: PROD-1770000000000-abcd12
|
||||
cart_product_quantity:
|
||||
type:
|
||||
@@ -1375,7 +1072,8 @@ components:
|
||||
cart_number: 购物车名称或分组号|string
|
||||
cart_create: 购物车项创建时间,由数据库自动生成|string
|
||||
cart_owner: 购物车所有者 openid|string
|
||||
cart_product_id: 产品业务 ID|string
|
||||
cart_product_id: tbl_product_list 的 PocketBase recordId|string
|
||||
cart_product_business_id: 产品业务 ID|string
|
||||
cart_product_quantity: 产品数量|integer
|
||||
cart_status: 购物车状态|string
|
||||
cart_at_price: 加入购物车时价格|number
|
||||
@@ -1402,13 +1100,8 @@ components:
|
||||
PocketBaseCartCreateRequest:
|
||||
type: object
|
||||
required:
|
||||
- cart_id
|
||||
- cart_number
|
||||
- cart_owner
|
||||
- cart_product_id
|
||||
- cart_product_quantity
|
||||
- cart_status
|
||||
- cart_at_price
|
||||
properties:
|
||||
cart_id:
|
||||
type: string
|
||||
@@ -1416,9 +1109,10 @@ components:
|
||||
type: string
|
||||
cart_owner:
|
||||
type: string
|
||||
description: 必须显式提交,且值必须等于当前 token 对应 openid
|
||||
description: 必须显式提交非空 owner
|
||||
cart_product_id:
|
||||
type: string
|
||||
description: tbl_product_list 的 PocketBase recordId
|
||||
cart_product_quantity:
|
||||
type:
|
||||
- integer
|
||||
@@ -1432,13 +1126,11 @@ components:
|
||||
cart_remark:
|
||||
type: string
|
||||
example:
|
||||
cart_id: cart_id|string
|
||||
cart_number: cart_number|string
|
||||
cart_owner: 必须显式提交,且值必须等于当前 token 对应 openid|string
|
||||
cart_product_id: cart_product_id|string
|
||||
cart_product_quantity: cart_product_quantity|integer
|
||||
cart_status: cart_status|string
|
||||
cart_at_price: cart_at_price|number
|
||||
cart_owner: 必须显式提交非空 owner|string
|
||||
cart_product_id: tbl_product_list 的 PocketBase recordId|string
|
||||
cart_product_quantity: cart_product_quantity|integer,可为空
|
||||
cart_status: cart_status|string,可为空
|
||||
cart_at_price: cart_at_price|number,可为空
|
||||
cart_remark: cart_remark|string
|
||||
PocketBaseCartUpdateRequest:
|
||||
type: object
|
||||
@@ -1447,9 +1139,10 @@ components:
|
||||
type: string
|
||||
cart_owner:
|
||||
type: string
|
||||
description: 若提交,必须仍等于当前 token 对应 openid
|
||||
description: 若提交,必须仍为非空 owner
|
||||
cart_product_id:
|
||||
type: string
|
||||
description: tbl_product_list 的 PocketBase recordId
|
||||
cart_product_quantity:
|
||||
type:
|
||||
- integer
|
||||
@@ -1464,8 +1157,8 @@ components:
|
||||
type: string
|
||||
example:
|
||||
cart_number: cart_number|string
|
||||
cart_owner: 若提交,必须仍等于当前 token 对应 openid|string
|
||||
cart_product_id: cart_product_id|string
|
||||
cart_owner: 若提交,必须仍为非空 owner|string
|
||||
cart_product_id: tbl_product_list 的 PocketBase recordId|string
|
||||
cart_product_quantity: cart_product_quantity|integer
|
||||
cart_status: cart_status|string
|
||||
cart_at_price: cart_at_price|number
|
||||
|
||||
48
pocket-base/spec/openapi-wx/openapi.yaml
Normal file
48
pocket-base/spec/openapi-wx/openapi.yaml
Normal file
@@ -0,0 +1,48 @@
|
||||
openapi: 3.1.0
|
||||
info:
|
||||
title: BAI PocketBase Native API
|
||||
version: 1.0.0-wx-folder
|
||||
description: |
|
||||
本目录仅收敛 PocketBase 原生 API 文档,不包含自定义 hooks API。
|
||||
|
||||
文档约定:
|
||||
- 不单独配置鉴权组件;如接口需要登录,请直接在说明中关注 `Authorization: Bearer <token>`
|
||||
- 示例字段值统一使用 `<字段说明>|<类型>` 风格
|
||||
- 原生接口返回 PocketBase 标准 records 结构,不使用 hooks 统一响应信封
|
||||
servers:
|
||||
- url: https://bai-api.blv-oa.com
|
||||
description: 生产环境
|
||||
- url: http://127.0.0.1:8090
|
||||
description: PocketBase 本地环境
|
||||
tags:
|
||||
- name: 企业信息
|
||||
description: PocketBase 原生公司记录接口
|
||||
- name: 附件信息
|
||||
description: PocketBase 原生附件记录接口
|
||||
- name: 产品信息
|
||||
description: PocketBase 原生产品记录接口
|
||||
- name: 文档信息
|
||||
description: PocketBase 原生文档记录接口
|
||||
- name: 购物车
|
||||
description: PocketBase 原生购物车记录接口
|
||||
- name: 订单
|
||||
description: PocketBase 原生订单记录接口
|
||||
paths:
|
||||
/pb/api/collections/tbl_company/records:
|
||||
$ref: './company.yaml#/paths/companyRecords'
|
||||
/pb/api/collections/tbl_company/records/{recordId}:
|
||||
$ref: './company.yaml#/paths/companyRecordById'
|
||||
/pb/api/collections/tbl_attachments/records:
|
||||
$ref: './attachments.yaml#/paths/attachmentRecords'
|
||||
/pb/api/collections/tbl_product_list/records:
|
||||
$ref: './products.yaml#/paths/productRecords'
|
||||
/pb/api/collections/tbl_document/records:
|
||||
$ref: './documents.yaml#/paths/documentRecords'
|
||||
/pb/api/collections/tbl_cart/records:
|
||||
$ref: './cart.yaml#/paths/cartRecords'
|
||||
/pb/api/collections/tbl_cart/records/{recordId}:
|
||||
$ref: './cart.yaml#/paths/cartRecordById'
|
||||
/pb/api/collections/tbl_order/records:
|
||||
$ref: './order.yaml#/paths/orderRecords'
|
||||
/pb/api/collections/tbl_order/records/{recordId}:
|
||||
$ref: './order.yaml#/paths/orderRecordById'
|
||||
@@ -1,229 +1,163 @@
|
||||
paths:
|
||||
orderList:
|
||||
post:
|
||||
operationId: postOrderList
|
||||
tags:
|
||||
- 订单
|
||||
summary: 按索引字段模糊查询订单列表
|
||||
orderRecords:
|
||||
get:
|
||||
tags: [订单]
|
||||
summary: 查询订单记录列表
|
||||
description: |
|
||||
调用自定义 hooks API 查询当前登录用户的订单列表。
|
||||
|
||||
查询规则:
|
||||
- 仅允许查询当前 `Authorization` 对应用户自己的订单记录
|
||||
- 支持通过 `keyword` 对多个索引相关字段做统一模糊搜索,当前实现覆盖:
|
||||
- `order_id`
|
||||
- `order_number`
|
||||
- `order_source_id`
|
||||
- 支持按 `order_status` 精确过滤
|
||||
- 支持按 `order_source` 精确过滤
|
||||
|
||||
目标软删除契约:
|
||||
- 目标行为应仅返回 `is_delete = 0` 的记录
|
||||
- 当前仓库实现尚未显式追加 `is_delete = 0` 过滤,请以实际后端代码为准
|
||||
security:
|
||||
- BearerAuth: []
|
||||
requestBody:
|
||||
required: false
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: ../openapi-wx.yaml#/components/schemas/OrderListRequest
|
||||
example:
|
||||
keyword: 对 order_id、order_number、order_source_id 等索引相关字段的统一模糊搜索关键字|string
|
||||
order_status: 订单状态精确过滤|string
|
||||
order_source: 订单来源精确过滤|string
|
||||
使用 PocketBase 原生 records list 接口查询 `tbl_order`。
|
||||
如需鉴权,请自行在请求头中携带 `Authorization: Bearer <token>`。
|
||||
parameters:
|
||||
- name: filter
|
||||
in: query
|
||||
required: false
|
||||
schema:
|
||||
type: string
|
||||
description: PocketBase 原生过滤表达式
|
||||
example: order_id="订单业务ID|string"
|
||||
- name: page
|
||||
in: query
|
||||
required: false
|
||||
schema:
|
||||
type: integer
|
||||
minimum: 1
|
||||
default: 1
|
||||
- name: perPage
|
||||
in: query
|
||||
required: false
|
||||
schema:
|
||||
type: integer
|
||||
minimum: 1
|
||||
default: 20
|
||||
- name: sort
|
||||
in: query
|
||||
required: false
|
||||
schema:
|
||||
type: string
|
||||
example: -order_create
|
||||
responses:
|
||||
"200":
|
||||
'200':
|
||||
description: 查询成功
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: ../openapi-wx.yaml#/components/schemas/OrderListResponse
|
||||
example:
|
||||
items:
|
||||
- pb_id: PocketBase 记录主键 id|string
|
||||
created: PocketBase 系统创建时间|string
|
||||
updated: PocketBase 系统更新时间|string
|
||||
order_id: 订单业务 ID|string
|
||||
order_number: 订单编号|string
|
||||
order_create: 订单创建时间,由数据库自动生成|string
|
||||
order_owner: 订单所有者 openid|string
|
||||
order_source: 订单来源|string
|
||||
order_status: 订单状态|string
|
||||
order_source_id: 来源关联业务 ID|string
|
||||
order_snap:
|
||||
order_snap字段|string: order_snap值|string
|
||||
order_amount: 订单金额|integer
|
||||
order_remark: 备注|string
|
||||
is_delete: 软删除标记;目标契约字段,当前 hooks 响应可能尚未显式透出|integer
|
||||
"400":
|
||||
description: 参数错误
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: ../openapi-wx.yaml#/components/schemas/ErrorResponse
|
||||
example:
|
||||
statusCode: 业务状态码|integer
|
||||
errMsg: 业务提示信息|string
|
||||
data:
|
||||
业务响应数据字段|string: 业务响应数据值|string
|
||||
"401":
|
||||
description: token 缺失、无效或已过期
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: ../openapi-wx.yaml#/components/schemas/ErrorResponse
|
||||
example:
|
||||
statusCode: 业务状态码|integer
|
||||
errMsg: 业务提示信息|string
|
||||
data:
|
||||
业务响应数据字段|string: 业务响应数据值|string
|
||||
"415":
|
||||
description: 请求体必须为 application/json
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: ../openapi-wx.yaml#/components/schemas/ErrorResponse
|
||||
example:
|
||||
statusCode: 业务状态码|integer
|
||||
errMsg: 业务提示信息|string
|
||||
data:
|
||||
业务响应数据字段|string: 业务响应数据值|string
|
||||
"500":
|
||||
$ref: '#/components/schemas/PocketBaseOrderListResponse'
|
||||
'400':
|
||||
description: 查询参数错误
|
||||
'401':
|
||||
description: token 无效或已过期
|
||||
'403':
|
||||
description: 无权访问
|
||||
'500':
|
||||
description: 服务端错误
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: ../openapi-wx.yaml#/components/schemas/ErrorResponse
|
||||
example:
|
||||
statusCode: 业务状态码|integer
|
||||
errMsg: 业务提示信息|string
|
||||
data:
|
||||
业务响应数据字段|string: 业务响应数据值|string
|
||||
orderDetail:
|
||||
post:
|
||||
operationId: postOrderDetail
|
||||
tags:
|
||||
- 订单
|
||||
summary: 按 order_id 精确查询订单详情
|
||||
tags: [订单]
|
||||
summary: 创建订单记录
|
||||
description: |
|
||||
调用自定义 hooks API 按 `order_id` 查询单条订单记录。
|
||||
|
||||
查询规则:
|
||||
- 仅允许访问当前 `Authorization` 对应用户自己的订单记录
|
||||
- 查询键为业务 ID `order_id`,不是 PocketBase 原生 `recordId`
|
||||
|
||||
目标软删除契约:
|
||||
- 目标行为应仅允许查询 `is_delete = 0` 的记录
|
||||
- 当前仓库实现尚未显式追加 `is_delete = 0` 过滤,请以实际后端代码为准
|
||||
security:
|
||||
- BearerAuth: []
|
||||
使用 PocketBase 原生 records create 接口向 `tbl_order` 新增记录。
|
||||
如集合规则要求 `order_owner` 与当前用户一致,请客户端显式提交。
|
||||
requestBody:
|
||||
required: true
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: ../openapi-wx.yaml#/components/schemas/OrderDetailRequest
|
||||
$ref: '#/components/schemas/PocketBaseOrderCreateRequest'
|
||||
example:
|
||||
order_id: 订单业务 ID|string
|
||||
order_id: 订单业务ID|string
|
||||
order_number: 订单编号|string
|
||||
order_owner: 订单所有者openid|string
|
||||
order_source: 订单来源|string
|
||||
order_status: 订单状态|string
|
||||
order_source_id: 来源关联业务ID|string
|
||||
order_snap:
|
||||
字段名|string: 字段值|string
|
||||
order_amount: 订单金额|number
|
||||
order_remark: 备注|string
|
||||
responses:
|
||||
"200":
|
||||
description: 查询成功
|
||||
'200':
|
||||
description: 创建成功
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: ../openapi-wx.yaml#/components/schemas/OrderRecord
|
||||
example:
|
||||
pb_id: PocketBase 记录主键 id|string
|
||||
created: PocketBase 系统创建时间|string
|
||||
updated: PocketBase 系统更新时间|string
|
||||
order_id: 订单业务 ID|string
|
||||
order_number: 订单编号|string
|
||||
order_create: 订单创建时间,由数据库自动生成|string
|
||||
order_owner: 订单所有者 openid|string
|
||||
order_source: 订单来源|string
|
||||
order_status: 订单状态|string
|
||||
order_source_id: 来源关联业务 ID|string
|
||||
order_snap:
|
||||
order_snap字段|string: order_snap值|string
|
||||
order_amount: 订单金额|integer
|
||||
order_remark: 备注|string
|
||||
is_delete: 软删除标记;目标契约字段,当前 hooks 响应可能尚未显式透出|integer
|
||||
$ref: '#/components/schemas/PocketBaseOrderRecord'
|
||||
'400':
|
||||
description: 参数错误或违反集合规则
|
||||
'401':
|
||||
description: token 无效或已过期
|
||||
'403':
|
||||
description: 无权访问
|
||||
'500':
|
||||
description: 服务端错误
|
||||
orderRecordById:
|
||||
patch:
|
||||
tags: [订单]
|
||||
summary: 更新订单记录
|
||||
description: |
|
||||
使用 PocketBase 原生 records update 接口更新 `tbl_order`。
|
||||
路径参数使用 PocketBase 原生 `recordId`。
|
||||
parameters:
|
||||
- name: recordId
|
||||
in: path
|
||||
required: true
|
||||
schema:
|
||||
type: string
|
||||
example: PocketBase记录主键|string
|
||||
requestBody:
|
||||
required: true
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/PocketBaseOrderUpdateRequest'
|
||||
example:
|
||||
order_number: 订单编号|string
|
||||
order_owner: 订单所有者openid|string
|
||||
order_source: 订单来源|string
|
||||
order_status: 订单状态|string
|
||||
order_source_id: 来源关联业务ID|string
|
||||
order_snap:
|
||||
字段名|string: 字段值|string
|
||||
order_amount: 订单金额|number
|
||||
order_remark: 备注|string
|
||||
responses:
|
||||
'200':
|
||||
description: 更新成功
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/PocketBaseOrderRecord'
|
||||
'400':
|
||||
description: 参数错误
|
||||
'401':
|
||||
description: token 无效或已过期
|
||||
'404':
|
||||
description: 记录不存在
|
||||
'500':
|
||||
description: 服务端错误
|
||||
delete:
|
||||
tags: [订单]
|
||||
summary: 删除订单记录
|
||||
description: |
|
||||
使用 PocketBase 原生 records delete 接口删除 `tbl_order`。
|
||||
路径参数使用 PocketBase 原生 `recordId`。
|
||||
parameters:
|
||||
- name: recordId
|
||||
in: path
|
||||
required: true
|
||||
schema:
|
||||
type: string
|
||||
example: PocketBase记录主键|string
|
||||
responses:
|
||||
'204':
|
||||
description: 删除成功
|
||||
'401':
|
||||
description: token 无效或已过期
|
||||
'404':
|
||||
description: 记录不存在
|
||||
'500':
|
||||
description: 服务端错误
|
||||
"400":
|
||||
description: 参数错误
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: ../openapi-wx.yaml#/components/schemas/ErrorResponse
|
||||
example:
|
||||
statusCode: 业务状态码|integer
|
||||
errMsg: 业务提示信息|string
|
||||
data:
|
||||
业务响应数据字段|string: 业务响应数据值|string
|
||||
"401":
|
||||
description: token 缺失、无效或已过期
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: ../openapi-wx.yaml#/components/schemas/ErrorResponse
|
||||
example:
|
||||
statusCode: 业务状态码|integer
|
||||
errMsg: 业务提示信息|string
|
||||
data:
|
||||
业务响应数据字段|string: 业务响应数据值|string
|
||||
"403":
|
||||
description: 无权访问该订单记录
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: ../openapi-wx.yaml#/components/schemas/ErrorResponse
|
||||
example:
|
||||
statusCode: 业务状态码|integer
|
||||
errMsg: 业务提示信息|string
|
||||
data:
|
||||
业务响应数据字段|string: 业务响应数据值|string
|
||||
"404":
|
||||
description: 未找到对应订单记录
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: ../openapi-wx.yaml#/components/schemas/ErrorResponse
|
||||
example:
|
||||
statusCode: 业务状态码|integer
|
||||
errMsg: 业务提示信息|string
|
||||
data:
|
||||
业务响应数据字段|string: 业务响应数据值|string
|
||||
"415":
|
||||
description: 请求体必须为 application/json
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: ../openapi-wx.yaml#/components/schemas/ErrorResponse
|
||||
example:
|
||||
statusCode: 业务状态码|integer
|
||||
errMsg: 业务提示信息|string
|
||||
data:
|
||||
业务响应数据字段|string: 业务响应数据值|string
|
||||
"500":
|
||||
description: 服务端错误
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: ../openapi-wx.yaml#/components/schemas/ErrorResponse
|
||||
example:
|
||||
statusCode: 业务状态码|integer
|
||||
errMsg: 业务提示信息|string
|
||||
data:
|
||||
业务响应数据字段|string: 业务响应数据值|string
|
||||
orderCreate:
|
||||
post:
|
||||
operationId: postOrderCreate
|
||||
tags:
|
||||
- 订单
|
||||
summary: 新增订单记录
|
||||
description: |
|
||||
调用自定义 hooks API 新增一条订单记录。
|
||||
|
||||
components:
|
||||
schemas:
|
||||
创建规则:
|
||||
- 服务端自动根据当前 token 写入 `order_owner`
|
||||
- 服务端自动生成 `order_id`
|
||||
@@ -231,12 +165,13 @@ paths:
|
||||
- `order_source`、`order_source_id`、`order_snap`、`order_amount` 为必填
|
||||
|
||||
目标软删除契约:
|
||||
- 新建记录应默认为 `is_delete = 0`
|
||||
description: PocketBase错误码
|
||||
- 当前仓库导出响应中尚未显式返回 `is_delete` 字段
|
||||
security:
|
||||
- BearerAuth: []
|
||||
description: PocketBase错误信息
|
||||
example: PocketBase原生错误信息 | string
|
||||
requestBody:
|
||||
required: true
|
||||
description: PocketBase错误数据
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
@@ -1088,253 +1023,6 @@ components:
|
||||
collectionName: collectionName|string
|
||||
created: 记录创建时间|string
|
||||
updated: 记录更新时间|string
|
||||
OrderRecord:
|
||||
allOf:
|
||||
- $ref: ../openapi-wx.yaml#/components/schemas/HookRecordBase
|
||||
- type: object
|
||||
properties:
|
||||
order_id:
|
||||
type: string
|
||||
description: 订单业务 ID
|
||||
example: ORDER-1770000000000-abc123
|
||||
order_number:
|
||||
type: string
|
||||
description: 订单编号
|
||||
example: wx-user-20260403153500
|
||||
order_create:
|
||||
type: string
|
||||
description: 订单创建时间,由数据库自动生成
|
||||
example: 2026-04-03 15:35:00.000Z
|
||||
order_owner:
|
||||
type: string
|
||||
description: 订单所有者 openid
|
||||
example: wx-openid-user-001
|
||||
order_source:
|
||||
type: string
|
||||
description: 订单来源
|
||||
example: 购物车
|
||||
order_status:
|
||||
type: string
|
||||
description: 订单状态
|
||||
example: 订单已生成
|
||||
order_source_id:
|
||||
type: string
|
||||
description: 来源关联业务 ID
|
||||
example: CART-1770000000000-abc123
|
||||
order_snap:
|
||||
description: 订单快照 JSON
|
||||
oneOf:
|
||||
- type: object
|
||||
additionalProperties: true
|
||||
- type: array
|
||||
items:
|
||||
type: object
|
||||
additionalProperties: true
|
||||
order_amount:
|
||||
type:
|
||||
- integer
|
||||
- number
|
||||
description: 订单金额
|
||||
example: 3998
|
||||
order_remark:
|
||||
type: string
|
||||
description: 备注
|
||||
example: 小程序订单示例
|
||||
is_delete:
|
||||
type:
|
||||
- integer
|
||||
- number
|
||||
description: 软删除标记;目标契约字段,当前 hooks 响应可能尚未显式透出
|
||||
example: 0
|
||||
example:
|
||||
pb_id: PocketBase 记录主键 id|string
|
||||
created: PocketBase 系统创建时间|string
|
||||
updated: PocketBase 系统更新时间|string
|
||||
order_id: 订单业务 ID|string
|
||||
order_number: 订单编号|string
|
||||
order_create: 订单创建时间,由数据库自动生成|string
|
||||
order_owner: 订单所有者 openid|string
|
||||
order_source: 订单来源|string
|
||||
order_status: 订单状态|string
|
||||
order_source_id: 来源关联业务 ID|string
|
||||
order_snap:
|
||||
order_snap字段|string: order_snap值|string
|
||||
order_amount: 订单金额|integer
|
||||
order_remark: 备注|string
|
||||
is_delete: 软删除标记;目标契约字段,当前 hooks 响应可能尚未显式透出|integer
|
||||
OrderListRequest:
|
||||
type: object
|
||||
properties:
|
||||
keyword:
|
||||
type: string
|
||||
description: 对 `order_id`、`order_number`、`order_source_id` 等索引相关字段的统一模糊搜索关键字
|
||||
example: ORDER-1770
|
||||
order_status:
|
||||
type: string
|
||||
description: 订单状态精确过滤
|
||||
example: 订单已生成
|
||||
order_source:
|
||||
type: string
|
||||
description: 订单来源精确过滤
|
||||
example: 购物车
|
||||
example:
|
||||
keyword: 对 order_id、order_number、order_source_id 等索引相关字段的统一模糊搜索关键字|string
|
||||
order_status: 订单状态精确过滤|string
|
||||
order_source: 订单来源精确过滤|string
|
||||
OrderDetailRequest:
|
||||
type: object
|
||||
required:
|
||||
- order_id
|
||||
properties:
|
||||
order_id:
|
||||
type: string
|
||||
description: 订单业务 ID
|
||||
example: ORDER-1770000000000-abc123
|
||||
example:
|
||||
order_id: 订单业务 ID|string
|
||||
OrderCreateRequest:
|
||||
type: object
|
||||
required:
|
||||
- order_source
|
||||
- order_source_id
|
||||
- order_snap
|
||||
- order_amount
|
||||
properties:
|
||||
order_number:
|
||||
type: string
|
||||
description: 可选;未传时服务端自动生成
|
||||
order_source:
|
||||
type: string
|
||||
description: 订单来源
|
||||
example: 购物车
|
||||
order_status:
|
||||
type: string
|
||||
description: 可选;未传时默认 `订单已生成`
|
||||
example: 订单已生成
|
||||
order_source_id:
|
||||
type: string
|
||||
description: 来源关联业务 ID
|
||||
example: CART-1770000000000-abc123
|
||||
order_snap:
|
||||
description: 订单快照 JSON
|
||||
oneOf:
|
||||
- type: object
|
||||
additionalProperties: true
|
||||
- type: array
|
||||
items:
|
||||
type: object
|
||||
additionalProperties: true
|
||||
order_amount:
|
||||
type:
|
||||
- integer
|
||||
- number
|
||||
description: 订单金额
|
||||
example: 3998
|
||||
order_remark:
|
||||
type: string
|
||||
description: 备注
|
||||
example: 小程序订单示例
|
||||
example:
|
||||
order_number: 可选;未传时服务端自动生成|string
|
||||
order_source: 订单来源|string
|
||||
order_status: 可选;未传时默认 订单已生成|string
|
||||
order_source_id: 来源关联业务 ID|string
|
||||
order_snap:
|
||||
order_snap字段|string: order_snap值|string
|
||||
order_amount: 订单金额|integer
|
||||
order_remark: 备注|string
|
||||
OrderUpdateRequest:
|
||||
type: object
|
||||
required:
|
||||
- order_id
|
||||
properties:
|
||||
order_id:
|
||||
type: string
|
||||
description: 订单业务 ID
|
||||
example: ORDER-1770000000000-abc123
|
||||
order_number:
|
||||
type: string
|
||||
order_source:
|
||||
type: string
|
||||
order_status:
|
||||
type: string
|
||||
order_source_id:
|
||||
type: string
|
||||
order_snap:
|
||||
oneOf:
|
||||
- type: object
|
||||
additionalProperties: true
|
||||
- type: array
|
||||
items:
|
||||
type: object
|
||||
additionalProperties: true
|
||||
order_amount:
|
||||
type:
|
||||
- integer
|
||||
- number
|
||||
order_remark:
|
||||
type: string
|
||||
example:
|
||||
order_id: 订单业务 ID|string
|
||||
order_number: order_number|string
|
||||
order_source: order_source|string
|
||||
order_status: order_status|string
|
||||
order_source_id: order_source_id|string
|
||||
order_snap:
|
||||
order_snap字段|string: order_snap值|string
|
||||
order_amount: order_amount|integer
|
||||
order_remark: order_remark|string
|
||||
OrderDeleteRequest:
|
||||
type: object
|
||||
required:
|
||||
- order_id
|
||||
properties:
|
||||
order_id:
|
||||
type: string
|
||||
description: 订单业务 ID
|
||||
example: ORDER-1770000000000-abc123
|
||||
example:
|
||||
order_id: 订单业务 ID|string
|
||||
OrderListResponse:
|
||||
type: object
|
||||
properties:
|
||||
items:
|
||||
type: array
|
||||
items:
|
||||
$ref: ../openapi-wx.yaml#/components/schemas/OrderRecord
|
||||
example:
|
||||
items:
|
||||
- pb_id: PocketBase 记录主键 id|string
|
||||
created: PocketBase 系统创建时间|string
|
||||
updated: PocketBase 系统更新时间|string
|
||||
order_id: 订单业务 ID|string
|
||||
order_number: 订单编号|string
|
||||
order_create: 订单创建时间,由数据库自动生成|string
|
||||
order_owner: 订单所有者 openid|string
|
||||
order_source: 订单来源|string
|
||||
order_status: 订单状态|string
|
||||
order_source_id: 来源关联业务 ID|string
|
||||
order_snap:
|
||||
order_snap字段|string: order_snap值|string
|
||||
order_amount: 订单金额|integer
|
||||
order_remark: 备注|string
|
||||
is_delete: 软删除标记;目标契约字段,当前 hooks 响应可能尚未显式透出|integer
|
||||
OrderDeleteResponse:
|
||||
type: object
|
||||
properties:
|
||||
order_id:
|
||||
type: string
|
||||
description: 订单业务 ID
|
||||
example: ORDER-1770000000000-abc123
|
||||
is_delete:
|
||||
type:
|
||||
- integer
|
||||
- number
|
||||
description: 目标软删除标记值;当前实现可能仍返回物理删除结果
|
||||
example: 1
|
||||
example:
|
||||
order_id: 订单业务 ID|string
|
||||
is_delete: 目标软删除标记值;当前实现可能仍返回物理删除结果|integer
|
||||
PocketBaseOrderFields:
|
||||
type: object
|
||||
properties:
|
||||
|
||||
@@ -1,253 +0,0 @@
|
||||
paths:
|
||||
usersCount:
|
||||
post:
|
||||
security: []
|
||||
operationId: postSystemUsersCount
|
||||
tags:
|
||||
- 系统
|
||||
summary: 查询用户总数
|
||||
description: 统计 `tbl_auth_users` 集合中的记录总数。
|
||||
responses:
|
||||
"200":
|
||||
description: 查询成功
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: ../openapi-wx.yaml#/components/schemas/UsersCountResponse
|
||||
example:
|
||||
statusCode: 业务状态码|integer
|
||||
errMsg: 业务提示信息|string
|
||||
data:
|
||||
total_users: total_users|integer
|
||||
"400":
|
||||
description: 请求参数错误
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: ../openapi-wx.yaml#/components/schemas/ErrorResponse
|
||||
example:
|
||||
statusCode: 业务状态码|integer
|
||||
errMsg: 业务提示信息|string
|
||||
data:
|
||||
业务响应数据字段|string: 业务响应数据值|string
|
||||
"500":
|
||||
description: 服务端错误
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: ../openapi-wx.yaml#/components/schemas/ErrorResponse
|
||||
example:
|
||||
statusCode: 业务状态码|integer
|
||||
errMsg: 业务提示信息|string
|
||||
data:
|
||||
业务响应数据字段|string: 业务响应数据值|string
|
||||
refreshToken:
|
||||
post:
|
||||
security:
|
||||
- BearerAuth: []
|
||||
- {}
|
||||
operationId: postSystemRefreshToken
|
||||
tags:
|
||||
- 系统
|
||||
summary: 刷新认证 token
|
||||
description: |
|
||||
当当前 `Authorization` 仍有效时,直接基于当前 auth 用户续签。
|
||||
当 token 失效时,可传入 `users_wx_code` 走微信 code 重新签发。
|
||||
requestBody:
|
||||
required: false
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: ../openapi-wx.yaml#/components/schemas/SystemRefreshTokenRequest
|
||||
example:
|
||||
users_wx_code: 当前 token 失效时,可通过该 code 重新签发 token。|string
|
||||
responses:
|
||||
"200":
|
||||
description: 刷新成功
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: ../openapi-wx.yaml#/components/schemas/RefreshTokenResponse
|
||||
example:
|
||||
statusCode: 业务状态码|integer
|
||||
errMsg: 业务提示信息|string
|
||||
data:
|
||||
业务响应数据字段|string: 业务响应数据值|string
|
||||
token: 新签发的 PocketBase 原生 auth token|string
|
||||
"400":
|
||||
description: 参数错误或微信 code 换取失败
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: ../openapi-wx.yaml#/components/schemas/ErrorResponse
|
||||
example:
|
||||
statusCode: 业务状态码|integer
|
||||
errMsg: 业务提示信息|string
|
||||
data:
|
||||
业务响应数据字段|string: 业务响应数据值|string
|
||||
"401":
|
||||
description: token 无效,且未提供有效的 `users_wx_code`
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: ../openapi-wx.yaml#/components/schemas/ErrorResponse
|
||||
example:
|
||||
statusCode: 业务状态码|integer
|
||||
errMsg: 业务提示信息|string
|
||||
data:
|
||||
业务响应数据字段|string: 业务响应数据值|string
|
||||
"404":
|
||||
description: 当前用户不存在
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: ../openapi-wx.yaml#/components/schemas/ErrorResponse
|
||||
example:
|
||||
statusCode: 业务状态码|integer
|
||||
errMsg: 业务提示信息|string
|
||||
data:
|
||||
业务响应数据字段|string: 业务响应数据值|string
|
||||
"415":
|
||||
description: 请求体不是 JSON
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: ../openapi-wx.yaml#/components/schemas/ErrorResponse
|
||||
example:
|
||||
statusCode: 业务状态码|integer
|
||||
errMsg: 业务提示信息|string
|
||||
data:
|
||||
业务响应数据字段|string: 业务响应数据值|string
|
||||
"429":
|
||||
description: 请求过于频繁
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: ../openapi-wx.yaml#/components/schemas/ErrorResponse
|
||||
example:
|
||||
statusCode: 业务状态码|integer
|
||||
errMsg: 业务提示信息|string
|
||||
data:
|
||||
业务响应数据字段|string: 业务响应数据值|string
|
||||
"500":
|
||||
description: 服务端错误
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: ../openapi-wx.yaml#/components/schemas/ErrorResponse
|
||||
example:
|
||||
statusCode: 业务状态码|integer
|
||||
errMsg: 业务提示信息|string
|
||||
data:
|
||||
业务响应数据字段|string: 业务响应数据值|string
|
||||
components:
|
||||
schemas:
|
||||
ApiResponseBase:
|
||||
type: object
|
||||
required:
|
||||
- statusCode
|
||||
- errMsg
|
||||
- data
|
||||
properties:
|
||||
statusCode:
|
||||
type:
|
||||
- integer
|
||||
- string
|
||||
description: 业务状态码
|
||||
example: 业务状态码 | integer
|
||||
errMsg:
|
||||
type: string
|
||||
description: 业务提示信息
|
||||
example: 业务提示信息 | string
|
||||
data:
|
||||
description: 业务响应数据
|
||||
type: object
|
||||
additionalProperties: true
|
||||
example:
|
||||
statusCode: 业务状态码|integer
|
||||
errMsg: 业务提示信息|string
|
||||
data:
|
||||
业务响应数据字段|string: 业务响应数据值|string
|
||||
ErrorResponse:
|
||||
type: object
|
||||
required:
|
||||
- statusCode
|
||||
- errMsg
|
||||
- data
|
||||
properties:
|
||||
statusCode:
|
||||
type:
|
||||
- integer
|
||||
- string
|
||||
description: 业务状态码
|
||||
example: 业务状态码 | integer
|
||||
errMsg:
|
||||
type: string
|
||||
description: 业务提示信息
|
||||
example: 失败原因提示 | string
|
||||
data:
|
||||
description: 业务响应数据
|
||||
type: object
|
||||
additionalProperties: true
|
||||
example:
|
||||
statusCode: 业务状态码|integer
|
||||
errMsg: 业务提示信息|string
|
||||
data:
|
||||
业务响应数据字段|string: 业务响应数据值|string
|
||||
SystemRefreshTokenRequest:
|
||||
type: object
|
||||
properties:
|
||||
users_wx_code:
|
||||
type:
|
||||
- string
|
||||
- "null"
|
||||
description: |
|
||||
可选。
|
||||
当前 token 失效时,可通过该 code 重新签发 token。
|
||||
example: 0a1b2c3d4e5f6g
|
||||
example:
|
||||
users_wx_code: 当前 token 失效时,可通过该 code 重新签发 token。|string
|
||||
RefreshTokenResponse:
|
||||
allOf:
|
||||
- $ref: ../openapi-wx.yaml#/components/schemas/ApiResponseBase
|
||||
- type: object
|
||||
required:
|
||||
- token
|
||||
properties:
|
||||
data:
|
||||
type: object
|
||||
additionalProperties: true
|
||||
description: 业务响应数据
|
||||
example: {}
|
||||
token:
|
||||
type: string
|
||||
description: 新签发的 PocketBase 原生 auth token
|
||||
example:
|
||||
statusCode: 业务状态码|integer
|
||||
errMsg: 业务提示信息|string
|
||||
data:
|
||||
业务响应数据字段|string: 业务响应数据值|string
|
||||
token: 新签发的 PocketBase 原生 auth token|string
|
||||
UsersCountData:
|
||||
type: object
|
||||
properties:
|
||||
total_users:
|
||||
type:
|
||||
- integer
|
||||
- string
|
||||
example: 用户总数 | integer
|
||||
example:
|
||||
total_users: total_users|integer
|
||||
UsersCountResponse:
|
||||
allOf:
|
||||
- $ref: ../openapi-wx.yaml#/components/schemas/ApiResponseBase
|
||||
- type: object
|
||||
properties:
|
||||
data:
|
||||
description: 业务响应数据
|
||||
$ref: ../openapi-wx.yaml#/components/schemas/UsersCountData
|
||||
example:
|
||||
statusCode: 业务状态码|integer
|
||||
errMsg: 业务提示信息|string
|
||||
data:
|
||||
total_users: total_users|integer
|
||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user