2026-03-27 19:26:25 +08:00
|
|
|
|
openapi: 3.1.0
|
|
|
|
|
|
info:
|
|
|
|
|
|
title: BAI PocketBase WeChat API
|
|
|
|
|
|
version: 1.0.0-wx
|
|
|
|
|
|
description: |
|
|
|
|
|
|
面向微信端的小程序接口文档。
|
2026-04-03 10:50:31 +08:00
|
|
|
|
本文档包含微信登录、微信资料完善,以及微信小程序侧会直接调用的业务接口。
|
|
|
|
|
|
|
|
|
|
|
|
微信小程序调用适配说明:
|
2026-04-03 18:35:50 +08:00
|
|
|
|
- 除 `/pb/api/wechat/login` 外,调用购物车 / 订单的 PocketBase 原生 records API 时都需要在请求头中携带 `Authorization: Bearer <token>`
|
2026-04-03 10:50:31 +08:00
|
|
|
|
- `token` 取自 `/pb/api/wechat/login` 成功返回的认证 token
|
2026-04-03 18:35:50 +08:00
|
|
|
|
- 小程序端应统一使用 HTTPS,不依赖 Cookie / Session
|
2026-04-07 20:02:10 +08:00
|
|
|
|
- 购物车与订单同时提供两套调用说明:`/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` 过滤;若要完全满足软删除检索约束,需同步调整后端服务实现
|
2026-03-27 19:26:25 +08:00
|
|
|
|
license:
|
|
|
|
|
|
name: Proprietary
|
|
|
|
|
|
identifier: LicenseRef-Proprietary
|
|
|
|
|
|
servers:
|
|
|
|
|
|
- url: https://bai-api.blv-oa.com
|
|
|
|
|
|
description: 生产环境
|
2026-04-07 20:02:10 +08:00
|
|
|
|
- url: http://127.0.0.1:8090
|
2026-03-27 19:26:25 +08:00
|
|
|
|
description: PocketBase 本地环境
|
|
|
|
|
|
tags:
|
|
|
|
|
|
- name: 系统
|
|
|
|
|
|
description: 微信端共用系统接口
|
|
|
|
|
|
- name: 微信认证
|
|
|
|
|
|
description: 微信登录、资料完善与 token 刷新接口
|
2026-03-29 16:21:34 +08:00
|
|
|
|
- name: 企业信息
|
|
|
|
|
|
description: 通过 PocketBase 原生 records API 访问 `tbl_company`
|
|
|
|
|
|
- name: 附件信息
|
|
|
|
|
|
description: 通过 PocketBase 原生 records API 访问 `tbl_attachments`
|
2026-04-01 11:59:58 +08:00
|
|
|
|
- name: 产品信息
|
|
|
|
|
|
description: 通过 PocketBase 原生 records API 访问 `tbl_product_list`
|
2026-03-29 16:21:34 +08:00
|
|
|
|
- name: 文档信息
|
|
|
|
|
|
description: 通过 PocketBase 原生 records API 访问 `tbl_document`
|
2026-04-03 10:50:31 +08:00
|
|
|
|
- name: 购物车
|
|
|
|
|
|
description: 微信小程序侧购物车 CRUD 接口
|
|
|
|
|
|
- name: 订单
|
|
|
|
|
|
description: 微信小程序侧订单 CRUD 接口
|
|
|
|
|
|
security: []
|
2026-03-27 19:26:25 +08:00
|
|
|
|
paths:
|
|
|
|
|
|
/pb/api/system/users-count:
|
2026-04-08 09:04:36 +08:00
|
|
|
|
$ref: './openapi-wx/system.yaml#/paths/usersCount'
|
2026-03-27 19:26:25 +08:00
|
|
|
|
/pb/api/system/refresh-token:
|
2026-04-08 09:04:36 +08:00
|
|
|
|
$ref: './openapi-wx/system.yaml#/paths/refreshToken'
|
2026-03-27 19:26:25 +08:00
|
|
|
|
/pb/api/wechat/login:
|
2026-04-08 09:04:36 +08:00
|
|
|
|
$ref: './openapi-wx/wechat-auth.yaml#/paths/wechatLogin'
|
2026-03-27 19:26:25 +08:00
|
|
|
|
/pb/api/wechat/profile:
|
2026-04-08 09:04:36 +08:00
|
|
|
|
$ref: './openapi-wx/wechat-auth.yaml#/paths/wechatProfile'
|
2026-03-29 16:21:34 +08:00
|
|
|
|
/pb/api/collections/tbl_company/records:
|
2026-04-08 09:04:36 +08:00
|
|
|
|
$ref: './openapi-wx/company.yaml#/paths/companyRecords'
|
2026-03-29 16:21:34 +08:00
|
|
|
|
/pb/api/collections/tbl_company/records/{recordId}:
|
2026-04-08 09:04:36 +08:00
|
|
|
|
$ref: './openapi-wx/company.yaml#/paths/companyRecordById'
|
2026-03-29 16:21:34 +08:00
|
|
|
|
/pb/api/collections/tbl_attachments/records:
|
2026-04-08 09:04:36 +08:00
|
|
|
|
$ref: './openapi-wx/attachments.yaml#/paths/attachmentRecords'
|
2026-04-01 11:59:58 +08:00
|
|
|
|
/pb/api/collections/tbl_product_list/records:
|
2026-04-08 09:04:36 +08:00
|
|
|
|
$ref: './openapi-wx/products.yaml#/paths/productRecords'
|
2026-03-29 16:21:34 +08:00
|
|
|
|
/pb/api/collections/tbl_document/records:
|
2026-04-08 09:04:36 +08:00
|
|
|
|
$ref: './openapi-wx/documents.yaml#/paths/documentRecords'
|
2026-04-07 20:02:10 +08:00
|
|
|
|
/pb/api/cart/list:
|
2026-04-08 09:04:36 +08:00
|
|
|
|
$ref: './openapi-wx/cart.yaml#/paths/cartList'
|
2026-04-07 20:02:10 +08:00
|
|
|
|
/pb/api/cart/detail:
|
2026-04-08 09:04:36 +08:00
|
|
|
|
$ref: './openapi-wx/cart.yaml#/paths/cartDetail'
|
2026-04-07 20:02:10 +08:00
|
|
|
|
/pb/api/cart/create:
|
2026-04-08 09:04:36 +08:00
|
|
|
|
$ref: './openapi-wx/cart.yaml#/paths/cartCreate'
|
2026-04-07 20:02:10 +08:00
|
|
|
|
/pb/api/cart/update:
|
2026-04-08 09:04:36 +08:00
|
|
|
|
$ref: './openapi-wx/cart.yaml#/paths/cartUpdate'
|
2026-04-07 20:02:10 +08:00
|
|
|
|
/pb/api/cart/delete:
|
2026-04-08 09:04:36 +08:00
|
|
|
|
$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'
|
2026-04-07 20:02:10 +08:00
|
|
|
|
/pb/api/order/list:
|
2026-04-08 09:04:36 +08:00
|
|
|
|
$ref: './openapi-wx/order.yaml#/paths/orderList'
|
2026-04-07 20:02:10 +08:00
|
|
|
|
/pb/api/order/detail:
|
2026-04-08 09:04:36 +08:00
|
|
|
|
$ref: './openapi-wx/order.yaml#/paths/orderDetail'
|
2026-04-07 20:02:10 +08:00
|
|
|
|
/pb/api/order/create:
|
2026-04-08 09:04:36 +08:00
|
|
|
|
$ref: './openapi-wx/order.yaml#/paths/orderCreate'
|
2026-04-07 20:02:10 +08:00
|
|
|
|
/pb/api/order/update:
|
2026-04-08 09:04:36 +08:00
|
|
|
|
$ref: './openapi-wx/order.yaml#/paths/orderUpdate'
|
2026-04-07 20:02:10 +08:00
|
|
|
|
/pb/api/order/delete:
|
2026-04-08 09:04:36 +08:00
|
|
|
|
$ref: './openapi-wx/order.yaml#/paths/orderDelete'
|
2026-04-03 18:35:50 +08:00
|
|
|
|
/pb/api/collections/tbl_order/records:
|
2026-04-08 09:04:36 +08:00
|
|
|
|
$ref: './openapi-wx/order.yaml#/paths/orderRecords'
|
2026-04-03 18:35:50 +08:00
|
|
|
|
/pb/api/collections/tbl_order/records/{recordId}:
|
2026-04-08 09:04:36 +08:00
|
|
|
|
$ref: './openapi-wx/order.yaml#/paths/orderRecordById'
|
2026-03-27 19:26:25 +08:00
|
|
|
|
components:
|
2026-04-03 10:50:31 +08:00
|
|
|
|
securitySchemes:
|
|
|
|
|
|
BearerAuth:
|
|
|
|
|
|
type: http
|
|
|
|
|
|
scheme: bearer
|
|
|
|
|
|
bearerFormat: JWT
|
2026-03-27 19:26:25 +08:00
|
|
|
|
schemas:
|
|
|
|
|
|
ApiResponseBase:
|
2026-04-08 09:04:36 +08:00
|
|
|
|
$ref: './openapi-wx/system.yaml#/components/schemas/ApiResponseBase'
|
2026-03-27 19:26:25 +08:00
|
|
|
|
ErrorResponse:
|
2026-04-08 09:04:36 +08:00
|
|
|
|
$ref: './openapi-wx/system.yaml#/components/schemas/ErrorResponse'
|
2026-04-07 20:02:10 +08:00
|
|
|
|
SystemRefreshTokenRequest:
|
2026-04-08 09:04:36 +08:00
|
|
|
|
$ref: './openapi-wx/system.yaml#/components/schemas/SystemRefreshTokenRequest'
|
2026-04-07 20:02:10 +08:00
|
|
|
|
RefreshTokenResponse:
|
2026-04-08 09:04:36 +08:00
|
|
|
|
$ref: './openapi-wx/system.yaml#/components/schemas/RefreshTokenResponse'
|
2026-04-07 20:02:10 +08:00
|
|
|
|
UsersCountData:
|
2026-04-08 09:04:36 +08:00
|
|
|
|
$ref: './openapi-wx/system.yaml#/components/schemas/UsersCountData'
|
2026-04-07 20:02:10 +08:00
|
|
|
|
UsersCountResponse:
|
2026-04-08 09:04:36 +08:00
|
|
|
|
$ref: './openapi-wx/system.yaml#/components/schemas/UsersCountResponse'
|
2026-04-07 20:02:10 +08:00
|
|
|
|
UserInfo:
|
2026-04-08 09:04:36 +08:00
|
|
|
|
$ref: './openapi-wx/wechat-auth.yaml#/components/schemas/UserInfo'
|
2026-04-07 20:02:10 +08:00
|
|
|
|
WechatLoginRequest:
|
2026-04-08 09:04:36 +08:00
|
|
|
|
$ref: './openapi-wx/wechat-auth.yaml#/components/schemas/WechatLoginRequest'
|
2026-04-07 20:02:10 +08:00
|
|
|
|
WechatProfileRequest:
|
2026-04-08 09:04:36 +08:00
|
|
|
|
$ref: './openapi-wx/wechat-auth.yaml#/components/schemas/WechatProfileRequest'
|
2026-04-07 20:02:10 +08:00
|
|
|
|
AuthSuccessData:
|
2026-04-08 09:04:36 +08:00
|
|
|
|
$ref: './openapi-wx/wechat-auth.yaml#/components/schemas/AuthSuccessData'
|
2026-04-07 20:02:10 +08:00
|
|
|
|
AuthSuccessResponse:
|
2026-04-08 09:04:36 +08:00
|
|
|
|
$ref: './openapi-wx/wechat-auth.yaml#/components/schemas/AuthSuccessResponse'
|
2026-04-07 20:02:10 +08:00
|
|
|
|
WechatProfileResponseData:
|
2026-04-08 09:04:36 +08:00
|
|
|
|
$ref: './openapi-wx/wechat-auth.yaml#/components/schemas/WechatProfileResponseData'
|
2026-04-07 20:02:10 +08:00
|
|
|
|
WechatProfileResponse:
|
2026-04-08 09:04:36 +08:00
|
|
|
|
$ref: './openapi-wx/wechat-auth.yaml#/components/schemas/WechatProfileResponse'
|
2026-04-07 20:02:10 +08:00
|
|
|
|
CompanyInfo:
|
2026-04-08 09:04:36 +08:00
|
|
|
|
$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'
|
2026-03-29 16:21:34 +08:00
|
|
|
|
PocketBaseCompanyFields:
|
2026-04-08 09:04:36 +08:00
|
|
|
|
$ref: './openapi-wx/company.yaml#/components/schemas/PocketBaseCompanyFields'
|
2026-03-29 16:21:34 +08:00
|
|
|
|
PocketBaseCompanyRecord:
|
2026-04-08 09:04:36 +08:00
|
|
|
|
$ref: './openapi-wx/company.yaml#/components/schemas/PocketBaseCompanyRecord'
|
2026-03-29 16:21:34 +08:00
|
|
|
|
PocketBaseCompanyCreateRequest:
|
2026-04-08 09:04:36 +08:00
|
|
|
|
$ref: './openapi-wx/company.yaml#/components/schemas/PocketBaseCompanyCreateRequest'
|
2026-03-29 16:21:34 +08:00
|
|
|
|
PocketBaseCompanyUpdateRequest:
|
2026-04-08 09:04:36 +08:00
|
|
|
|
$ref: './openapi-wx/company.yaml#/components/schemas/PocketBaseCompanyUpdateRequest'
|
2026-03-29 16:21:34 +08:00
|
|
|
|
PocketBaseCompanyListResponse:
|
2026-04-08 09:04:36 +08:00
|
|
|
|
$ref: './openapi-wx/company.yaml#/components/schemas/PocketBaseCompanyListResponse'
|
2026-03-29 16:21:34 +08:00
|
|
|
|
PocketBaseAttachmentRecord:
|
2026-04-08 09:04:36 +08:00
|
|
|
|
$ref: './openapi-wx/attachments.yaml#/components/schemas/PocketBaseAttachmentRecord'
|
2026-03-29 16:21:34 +08:00
|
|
|
|
PocketBaseAttachmentListResponse:
|
2026-04-08 09:04:36 +08:00
|
|
|
|
$ref: './openapi-wx/attachments.yaml#/components/schemas/PocketBaseAttachmentListResponse'
|
2026-04-01 11:59:58 +08:00
|
|
|
|
PocketBaseProductListFields:
|
2026-04-08 09:04:36 +08:00
|
|
|
|
$ref: './openapi-wx/products.yaml#/components/schemas/PocketBaseProductListFields'
|
2026-04-01 11:59:58 +08:00
|
|
|
|
PocketBaseProductListRecord:
|
2026-04-08 09:04:36 +08:00
|
|
|
|
$ref: './openapi-wx/products.yaml#/components/schemas/PocketBaseProductListRecord'
|
2026-04-01 11:59:58 +08:00
|
|
|
|
PocketBaseProductListListResponse:
|
2026-04-08 09:04:36 +08:00
|
|
|
|
$ref: './openapi-wx/products.yaml#/components/schemas/PocketBaseProductListListResponse'
|
2026-03-29 16:21:34 +08:00
|
|
|
|
PocketBaseDocumentFields:
|
2026-04-08 09:04:36 +08:00
|
|
|
|
$ref: './openapi-wx/documents.yaml#/components/schemas/PocketBaseDocumentFields'
|
2026-03-29 16:21:34 +08:00
|
|
|
|
PocketBaseDocumentRecord:
|
2026-04-08 09:04:36 +08:00
|
|
|
|
$ref: './openapi-wx/documents.yaml#/components/schemas/PocketBaseDocumentRecord'
|
2026-03-29 16:21:34 +08:00
|
|
|
|
PocketBaseDocumentListResponse:
|
2026-04-08 09:04:36 +08:00
|
|
|
|
$ref: './openapi-wx/documents.yaml#/components/schemas/PocketBaseDocumentListResponse'
|
|
|
|
|
|
HookRecordBase:
|
|
|
|
|
|
$ref: './openapi-wx/cart.yaml#/components/schemas/HookRecordBase'
|
2026-04-07 20:02:10 +08:00
|
|
|
|
CartRecord:
|
2026-04-08 09:04:36 +08:00
|
|
|
|
$ref: './openapi-wx/cart.yaml#/components/schemas/CartRecord'
|
2026-04-07 20:02:10 +08:00
|
|
|
|
CartListRequest:
|
2026-04-08 09:04:36 +08:00
|
|
|
|
$ref: './openapi-wx/cart.yaml#/components/schemas/CartListRequest'
|
2026-04-07 20:02:10 +08:00
|
|
|
|
CartDetailRequest:
|
2026-04-08 09:04:36 +08:00
|
|
|
|
$ref: './openapi-wx/cart.yaml#/components/schemas/CartDetailRequest'
|
2026-04-07 20:02:10 +08:00
|
|
|
|
CartCreateRequest:
|
2026-04-08 09:04:36 +08:00
|
|
|
|
$ref: './openapi-wx/cart.yaml#/components/schemas/CartCreateRequest'
|
2026-04-07 20:02:10 +08:00
|
|
|
|
CartUpdateRequest:
|
2026-04-08 09:04:36 +08:00
|
|
|
|
$ref: './openapi-wx/cart.yaml#/components/schemas/CartUpdateRequest'
|
2026-04-07 20:02:10 +08:00
|
|
|
|
CartDeleteRequest:
|
2026-04-08 09:04:36 +08:00
|
|
|
|
$ref: './openapi-wx/cart.yaml#/components/schemas/CartDeleteRequest'
|
2026-04-07 20:02:10 +08:00
|
|
|
|
CartListResponse:
|
2026-04-08 09:04:36 +08:00
|
|
|
|
$ref: './openapi-wx/cart.yaml#/components/schemas/CartListResponse'
|
2026-04-07 20:02:10 +08:00
|
|
|
|
CartDeleteResponse:
|
2026-04-08 09:04:36 +08:00
|
|
|
|
$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'
|
2026-04-07 20:02:10 +08:00
|
|
|
|
OrderRecord:
|
2026-04-08 09:04:36 +08:00
|
|
|
|
$ref: './openapi-wx/order.yaml#/components/schemas/OrderRecord'
|
2026-04-07 20:02:10 +08:00
|
|
|
|
OrderListRequest:
|
2026-04-08 09:04:36 +08:00
|
|
|
|
$ref: './openapi-wx/order.yaml#/components/schemas/OrderListRequest'
|
2026-04-07 20:02:10 +08:00
|
|
|
|
OrderDetailRequest:
|
2026-04-08 09:04:36 +08:00
|
|
|
|
$ref: './openapi-wx/order.yaml#/components/schemas/OrderDetailRequest'
|
2026-04-07 20:02:10 +08:00
|
|
|
|
OrderCreateRequest:
|
2026-04-08 09:04:36 +08:00
|
|
|
|
$ref: './openapi-wx/order.yaml#/components/schemas/OrderCreateRequest'
|
2026-04-07 20:02:10 +08:00
|
|
|
|
OrderUpdateRequest:
|
2026-04-08 09:04:36 +08:00
|
|
|
|
$ref: './openapi-wx/order.yaml#/components/schemas/OrderUpdateRequest'
|
2026-04-07 20:02:10 +08:00
|
|
|
|
OrderDeleteRequest:
|
2026-04-08 09:04:36 +08:00
|
|
|
|
$ref: './openapi-wx/order.yaml#/components/schemas/OrderDeleteRequest'
|
2026-04-07 20:02:10 +08:00
|
|
|
|
OrderListResponse:
|
2026-04-08 09:04:36 +08:00
|
|
|
|
$ref: './openapi-wx/order.yaml#/components/schemas/OrderListResponse'
|
2026-04-07 20:02:10 +08:00
|
|
|
|
OrderDeleteResponse:
|
2026-04-08 09:04:36 +08:00
|
|
|
|
$ref: './openapi-wx/order.yaml#/components/schemas/OrderDeleteResponse'
|
2026-04-07 20:02:10 +08:00
|
|
|
|
PocketBaseOrderFields:
|
2026-04-08 09:04:36 +08:00
|
|
|
|
$ref: './openapi-wx/order.yaml#/components/schemas/PocketBaseOrderFields'
|
2026-04-07 20:02:10 +08:00
|
|
|
|
PocketBaseOrderRecord:
|
2026-04-08 09:04:36 +08:00
|
|
|
|
$ref: './openapi-wx/order.yaml#/components/schemas/PocketBaseOrderRecord'
|
2026-04-07 20:02:10 +08:00
|
|
|
|
PocketBaseOrderCreateRequest:
|
2026-04-08 09:04:36 +08:00
|
|
|
|
$ref: './openapi-wx/order.yaml#/components/schemas/PocketBaseOrderCreateRequest'
|
2026-04-07 20:02:10 +08:00
|
|
|
|
PocketBaseOrderUpdateRequest:
|
2026-04-08 09:04:36 +08:00
|
|
|
|
$ref: './openapi-wx/order.yaml#/components/schemas/PocketBaseOrderUpdateRequest'
|
2026-04-07 20:02:10 +08:00
|
|
|
|
PocketBaseOrderListResponse:
|
2026-04-08 09:04:36 +08:00
|
|
|
|
$ref: './openapi-wx/order.yaml#/components/schemas/PocketBaseOrderListResponse'
|