openapi: 3.1.0 info: title: BAI PocketBase WeChat API version: 1.0.0-wx description: | 面向微信端的小程序接口文档。 本文档包含微信登录、微信资料完善,以及微信小程序侧会直接调用的业务接口。 微信小程序调用适配说明: - 除 `/pb/api/wechat/login` 外,调用购物车 / 订单的 PocketBase 原生 records API 时都需要在请求头中携带 `Authorization: Bearer ` - `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 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` - name: 附件信息 description: 通过 PocketBase 原生 records API 访问 `tbl_attachments` - name: 产品信息 description: 通过 PocketBase 原生 records API 访问 `tbl_product_list` - name: 文档信息 description: 通过 PocketBase 原生 records API 访问 `tbl_document` - name: 购物车 description: 微信小程序侧购物车 CRUD 接口 - name: 订单 description: 微信小程序侧订单 CRUD 接口 security: [] 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}: $ref: './openapi-wx/company.yaml#/paths/companyRecordById' /pb/api/collections/tbl_attachments/records: $ref: './openapi-wx/attachments.yaml#/paths/attachmentRecords' /pb/api/collections/tbl_product_list/records: $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'