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-07 20:02:10 +08:00
|
|
|
|
$ref: './openapi-wx/paths/system.yaml#/usersCount'
|
2026-03-27 19:26:25 +08:00
|
|
|
|
/pb/api/system/refresh-token:
|
2026-04-07 20:02:10 +08:00
|
|
|
|
$ref: './openapi-wx/paths/system.yaml#/refreshToken'
|
2026-03-27 19:26:25 +08:00
|
|
|
|
/pb/api/wechat/login:
|
2026-04-07 20:02:10 +08:00
|
|
|
|
$ref: './openapi-wx/paths/wechat-auth.yaml#/wechatLogin'
|
2026-03-27 19:26:25 +08:00
|
|
|
|
/pb/api/wechat/profile:
|
2026-04-07 20:02:10 +08:00
|
|
|
|
$ref: './openapi-wx/paths/wechat-auth.yaml#/wechatProfile'
|
2026-03-29 16:21:34 +08:00
|
|
|
|
/pb/api/collections/tbl_company/records:
|
2026-04-07 20:02:10 +08:00
|
|
|
|
$ref: './openapi-wx/paths/company.yaml#/companyRecords'
|
2026-03-29 16:21:34 +08:00
|
|
|
|
/pb/api/collections/tbl_company/records/{recordId}:
|
2026-04-07 20:02:10 +08:00
|
|
|
|
$ref: './openapi-wx/paths/company.yaml#/companyRecordById'
|
2026-03-29 16:21:34 +08:00
|
|
|
|
/pb/api/collections/tbl_attachments/records:
|
2026-04-07 20:02:10 +08:00
|
|
|
|
$ref: './openapi-wx/paths/attachments.yaml#/attachmentRecords'
|
2026-04-01 11:59:58 +08:00
|
|
|
|
/pb/api/collections/tbl_product_list/records:
|
2026-04-07 20:02:10 +08:00
|
|
|
|
$ref: './openapi-wx/paths/products.yaml#/productRecords'
|
2026-03-29 16:21:34 +08:00
|
|
|
|
/pb/api/collections/tbl_document/records:
|
2026-04-07 20:02:10 +08:00
|
|
|
|
$ref: './openapi-wx/paths/documents.yaml#/documentRecords'
|
|
|
|
|
|
/pb/api/cart/list:
|
|
|
|
|
|
$ref: './openapi-wx/paths/cart-hooks.yaml#/cartList'
|
|
|
|
|
|
/pb/api/cart/detail:
|
|
|
|
|
|
$ref: './openapi-wx/paths/cart-hooks.yaml#/cartDetail'
|
|
|
|
|
|
/pb/api/cart/create:
|
|
|
|
|
|
$ref: './openapi-wx/paths/cart-hooks.yaml#/cartCreate'
|
|
|
|
|
|
/pb/api/cart/update:
|
|
|
|
|
|
$ref: './openapi-wx/paths/cart-hooks.yaml#/cartUpdate'
|
|
|
|
|
|
/pb/api/cart/delete:
|
|
|
|
|
|
$ref: './openapi-wx/paths/cart-hooks.yaml#/cartDelete'
|
|
|
|
|
|
/pb/api/order/list:
|
|
|
|
|
|
$ref: './openapi-wx/paths/order-hooks.yaml#/orderList'
|
|
|
|
|
|
/pb/api/order/detail:
|
|
|
|
|
|
$ref: './openapi-wx/paths/order-hooks.yaml#/orderDetail'
|
|
|
|
|
|
/pb/api/order/create:
|
|
|
|
|
|
$ref: './openapi-wx/paths/order-hooks.yaml#/orderCreate'
|
|
|
|
|
|
/pb/api/order/update:
|
|
|
|
|
|
$ref: './openapi-wx/paths/order-hooks.yaml#/orderUpdate'
|
|
|
|
|
|
/pb/api/order/delete:
|
|
|
|
|
|
$ref: './openapi-wx/paths/order-hooks.yaml#/orderDelete'
|
2026-04-03 18:35:50 +08:00
|
|
|
|
/pb/api/collections/tbl_cart/records:
|
2026-04-07 20:02:10 +08:00
|
|
|
|
$ref: './openapi-wx/paths/cart-native.yaml#/cartRecords'
|
2026-04-03 18:35:50 +08:00
|
|
|
|
/pb/api/collections/tbl_cart/records/{recordId}:
|
2026-04-07 20:02:10 +08:00
|
|
|
|
$ref: './openapi-wx/paths/cart-native.yaml#/cartRecordById'
|
2026-04-03 18:35:50 +08:00
|
|
|
|
/pb/api/collections/tbl_order/records:
|
2026-04-07 20:02:10 +08:00
|
|
|
|
$ref: './openapi-wx/paths/order-native.yaml#/orderRecords'
|
2026-04-03 18:35:50 +08:00
|
|
|
|
/pb/api/collections/tbl_order/records/{recordId}:
|
2026-04-07 20:02:10 +08:00
|
|
|
|
$ref: './openapi-wx/paths/order-native.yaml#/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-07 20:02:10 +08:00
|
|
|
|
$ref: './openapi-wx/schemas/common.yaml#/ApiResponseBase'
|
2026-03-27 19:26:25 +08:00
|
|
|
|
ErrorResponse:
|
2026-04-07 20:02:10 +08:00
|
|
|
|
$ref: './openapi-wx/schemas/common.yaml#/ErrorResponse'
|
|
|
|
|
|
HookRecordBase:
|
|
|
|
|
|
$ref: './openapi-wx/schemas/common.yaml#/HookRecordBase'
|
|
|
|
|
|
PocketBaseNativeError:
|
|
|
|
|
|
$ref: './openapi-wx/schemas/common.yaml#/PocketBaseNativeError'
|
2026-03-29 16:21:34 +08:00
|
|
|
|
PocketBaseRecordBase:
|
2026-04-07 20:02:10 +08:00
|
|
|
|
$ref: './openapi-wx/schemas/common.yaml#/PocketBaseRecordBase'
|
|
|
|
|
|
SystemRefreshTokenRequest:
|
|
|
|
|
|
$ref: './openapi-wx/schemas/system.yaml#/SystemRefreshTokenRequest'
|
|
|
|
|
|
RefreshTokenResponse:
|
|
|
|
|
|
$ref: './openapi-wx/schemas/system.yaml#/RefreshTokenResponse'
|
|
|
|
|
|
UsersCountData:
|
|
|
|
|
|
$ref: './openapi-wx/schemas/system.yaml#/UsersCountData'
|
|
|
|
|
|
UsersCountResponse:
|
|
|
|
|
|
$ref: './openapi-wx/schemas/system.yaml#/UsersCountResponse'
|
|
|
|
|
|
UserInfo:
|
|
|
|
|
|
$ref: './openapi-wx/schemas/wechat-auth.yaml#/UserInfo'
|
|
|
|
|
|
WechatLoginRequest:
|
|
|
|
|
|
$ref: './openapi-wx/schemas/wechat-auth.yaml#/WechatLoginRequest'
|
|
|
|
|
|
WechatProfileRequest:
|
|
|
|
|
|
$ref: './openapi-wx/schemas/wechat-auth.yaml#/WechatProfileRequest'
|
|
|
|
|
|
AuthSuccessData:
|
|
|
|
|
|
$ref: './openapi-wx/schemas/wechat-auth.yaml#/AuthSuccessData'
|
|
|
|
|
|
AuthSuccessResponse:
|
|
|
|
|
|
$ref: './openapi-wx/schemas/wechat-auth.yaml#/AuthSuccessResponse'
|
|
|
|
|
|
WechatProfileResponseData:
|
|
|
|
|
|
$ref: './openapi-wx/schemas/wechat-auth.yaml#/WechatProfileResponseData'
|
|
|
|
|
|
WechatProfileResponse:
|
|
|
|
|
|
$ref: './openapi-wx/schemas/wechat-auth.yaml#/WechatProfileResponse'
|
|
|
|
|
|
CompanyInfo:
|
|
|
|
|
|
$ref: './openapi-wx/schemas/company.yaml#/CompanyInfo'
|
2026-03-29 16:21:34 +08:00
|
|
|
|
PocketBaseCompanyFields:
|
2026-04-07 20:02:10 +08:00
|
|
|
|
$ref: './openapi-wx/schemas/company.yaml#/PocketBaseCompanyFields'
|
2026-03-29 16:21:34 +08:00
|
|
|
|
PocketBaseCompanyRecord:
|
2026-04-07 20:02:10 +08:00
|
|
|
|
$ref: './openapi-wx/schemas/company.yaml#/PocketBaseCompanyRecord'
|
2026-03-29 16:21:34 +08:00
|
|
|
|
PocketBaseCompanyCreateRequest:
|
2026-04-07 20:02:10 +08:00
|
|
|
|
$ref: './openapi-wx/schemas/company.yaml#/PocketBaseCompanyCreateRequest'
|
2026-03-29 16:21:34 +08:00
|
|
|
|
PocketBaseCompanyUpdateRequest:
|
2026-04-07 20:02:10 +08:00
|
|
|
|
$ref: './openapi-wx/schemas/company.yaml#/PocketBaseCompanyUpdateRequest'
|
2026-03-29 16:21:34 +08:00
|
|
|
|
PocketBaseCompanyListResponse:
|
2026-04-07 20:02:10 +08:00
|
|
|
|
$ref: './openapi-wx/schemas/company.yaml#/PocketBaseCompanyListResponse'
|
2026-03-29 16:21:34 +08:00
|
|
|
|
PocketBaseAttachmentRecord:
|
2026-04-07 20:02:10 +08:00
|
|
|
|
$ref: './openapi-wx/schemas/attachments.yaml#/PocketBaseAttachmentRecord'
|
2026-03-29 16:21:34 +08:00
|
|
|
|
PocketBaseAttachmentListResponse:
|
2026-04-07 20:02:10 +08:00
|
|
|
|
$ref: './openapi-wx/schemas/attachments.yaml#/PocketBaseAttachmentListResponse'
|
2026-04-01 11:59:58 +08:00
|
|
|
|
PocketBaseProductListFields:
|
2026-04-07 20:02:10 +08:00
|
|
|
|
$ref: './openapi-wx/schemas/products.yaml#/PocketBaseProductListFields'
|
2026-04-01 11:59:58 +08:00
|
|
|
|
PocketBaseProductListRecord:
|
2026-04-07 20:02:10 +08:00
|
|
|
|
$ref: './openapi-wx/schemas/products.yaml#/PocketBaseProductListRecord'
|
2026-04-01 11:59:58 +08:00
|
|
|
|
PocketBaseProductListListResponse:
|
2026-04-07 20:02:10 +08:00
|
|
|
|
$ref: './openapi-wx/schemas/products.yaml#/PocketBaseProductListListResponse'
|
2026-03-29 16:21:34 +08:00
|
|
|
|
PocketBaseDocumentFields:
|
2026-04-07 20:02:10 +08:00
|
|
|
|
$ref: './openapi-wx/schemas/documents.yaml#/PocketBaseDocumentFields'
|
2026-03-29 16:21:34 +08:00
|
|
|
|
PocketBaseDocumentRecord:
|
2026-04-07 20:02:10 +08:00
|
|
|
|
$ref: './openapi-wx/schemas/documents.yaml#/PocketBaseDocumentRecord'
|
2026-03-29 16:21:34 +08:00
|
|
|
|
PocketBaseDocumentListResponse:
|
2026-04-07 20:02:10 +08:00
|
|
|
|
$ref: './openapi-wx/schemas/documents.yaml#/PocketBaseDocumentListResponse'
|
|
|
|
|
|
CartRecord:
|
|
|
|
|
|
$ref: './openapi-wx/schemas/cart-hooks.yaml#/CartRecord'
|
|
|
|
|
|
CartListRequest:
|
|
|
|
|
|
$ref: './openapi-wx/schemas/cart-hooks.yaml#/CartListRequest'
|
|
|
|
|
|
CartDetailRequest:
|
|
|
|
|
|
$ref: './openapi-wx/schemas/cart-hooks.yaml#/CartDetailRequest'
|
|
|
|
|
|
CartCreateRequest:
|
|
|
|
|
|
$ref: './openapi-wx/schemas/cart-hooks.yaml#/CartCreateRequest'
|
|
|
|
|
|
CartUpdateRequest:
|
|
|
|
|
|
$ref: './openapi-wx/schemas/cart-hooks.yaml#/CartUpdateRequest'
|
|
|
|
|
|
CartDeleteRequest:
|
|
|
|
|
|
$ref: './openapi-wx/schemas/cart-hooks.yaml#/CartDeleteRequest'
|
|
|
|
|
|
CartListResponse:
|
|
|
|
|
|
$ref: './openapi-wx/schemas/cart-hooks.yaml#/CartListResponse'
|
|
|
|
|
|
CartDeleteResponse:
|
|
|
|
|
|
$ref: './openapi-wx/schemas/cart-hooks.yaml#/CartDeleteResponse'
|
|
|
|
|
|
OrderRecord:
|
|
|
|
|
|
$ref: './openapi-wx/schemas/order-hooks.yaml#/OrderRecord'
|
|
|
|
|
|
OrderListRequest:
|
|
|
|
|
|
$ref: './openapi-wx/schemas/order-hooks.yaml#/OrderListRequest'
|
|
|
|
|
|
OrderDetailRequest:
|
|
|
|
|
|
$ref: './openapi-wx/schemas/order-hooks.yaml#/OrderDetailRequest'
|
|
|
|
|
|
OrderCreateRequest:
|
|
|
|
|
|
$ref: './openapi-wx/schemas/order-hooks.yaml#/OrderCreateRequest'
|
|
|
|
|
|
OrderUpdateRequest:
|
|
|
|
|
|
$ref: './openapi-wx/schemas/order-hooks.yaml#/OrderUpdateRequest'
|
|
|
|
|
|
OrderDeleteRequest:
|
|
|
|
|
|
$ref: './openapi-wx/schemas/order-hooks.yaml#/OrderDeleteRequest'
|
|
|
|
|
|
OrderListResponse:
|
|
|
|
|
|
$ref: './openapi-wx/schemas/order-hooks.yaml#/OrderListResponse'
|
|
|
|
|
|
OrderDeleteResponse:
|
|
|
|
|
|
$ref: './openapi-wx/schemas/order-hooks.yaml#/OrderDeleteResponse'
|
|
|
|
|
|
PocketBaseCartFields:
|
|
|
|
|
|
$ref: './openapi-wx/schemas/cart-native.yaml#/PocketBaseCartFields'
|
|
|
|
|
|
PocketBaseCartRecord:
|
|
|
|
|
|
$ref: './openapi-wx/schemas/cart-native.yaml#/PocketBaseCartRecord'
|
|
|
|
|
|
PocketBaseCartCreateRequest:
|
|
|
|
|
|
$ref: './openapi-wx/schemas/cart-native.yaml#/PocketBaseCartCreateRequest'
|
|
|
|
|
|
PocketBaseCartUpdateRequest:
|
|
|
|
|
|
$ref: './openapi-wx/schemas/cart-native.yaml#/PocketBaseCartUpdateRequest'
|
|
|
|
|
|
PocketBaseCartListResponse:
|
|
|
|
|
|
$ref: './openapi-wx/schemas/cart-native.yaml#/PocketBaseCartListResponse'
|
|
|
|
|
|
PocketBaseOrderFields:
|
|
|
|
|
|
$ref: './openapi-wx/schemas/order-native.yaml#/PocketBaseOrderFields'
|
|
|
|
|
|
PocketBaseOrderRecord:
|
|
|
|
|
|
$ref: './openapi-wx/schemas/order-native.yaml#/PocketBaseOrderRecord'
|
|
|
|
|
|
PocketBaseOrderCreateRequest:
|
|
|
|
|
|
$ref: './openapi-wx/schemas/order-native.yaml#/PocketBaseOrderCreateRequest'
|
|
|
|
|
|
PocketBaseOrderUpdateRequest:
|
|
|
|
|
|
$ref: './openapi-wx/schemas/order-native.yaml#/PocketBaseOrderUpdateRequest'
|
|
|
|
|
|
PocketBaseOrderListResponse:
|
|
|
|
|
|
$ref: './openapi-wx/schemas/order-native.yaml#/PocketBaseOrderListResponse'
|