Files
Web_BAI_Manage_ApiServer/pocket-base/spec/openapi-wx.yaml

209 lines
9.9 KiB
YAML
Raw Normal View History

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>`
- `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/paths/system.yaml#/usersCount'
/pb/api/system/refresh-token:
$ref: './openapi-wx/paths/system.yaml#/refreshToken'
/pb/api/wechat/login:
$ref: './openapi-wx/paths/wechat-auth.yaml#/wechatLogin'
/pb/api/wechat/profile:
$ref: './openapi-wx/paths/wechat-auth.yaml#/wechatProfile'
/pb/api/collections/tbl_company/records:
$ref: './openapi-wx/paths/company.yaml#/companyRecords'
/pb/api/collections/tbl_company/records/{recordId}:
$ref: './openapi-wx/paths/company.yaml#/companyRecordById'
/pb/api/collections/tbl_attachments/records:
$ref: './openapi-wx/paths/attachments.yaml#/attachmentRecords'
/pb/api/collections/tbl_product_list/records:
$ref: './openapi-wx/paths/products.yaml#/productRecords'
/pb/api/collections/tbl_document/records:
$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'
/pb/api/collections/tbl_cart/records:
$ref: './openapi-wx/paths/cart-native.yaml#/cartRecords'
/pb/api/collections/tbl_cart/records/{recordId}:
$ref: './openapi-wx/paths/cart-native.yaml#/cartRecordById'
/pb/api/collections/tbl_order/records:
$ref: './openapi-wx/paths/order-native.yaml#/orderRecords'
/pb/api/collections/tbl_order/records/{recordId}:
$ref: './openapi-wx/paths/order-native.yaml#/orderRecordById'
components:
securitySchemes:
BearerAuth:
type: http
scheme: bearer
bearerFormat: JWT
schemas:
ApiResponseBase:
$ref: './openapi-wx/schemas/common.yaml#/ApiResponseBase'
ErrorResponse:
$ref: './openapi-wx/schemas/common.yaml#/ErrorResponse'
HookRecordBase:
$ref: './openapi-wx/schemas/common.yaml#/HookRecordBase'
PocketBaseNativeError:
$ref: './openapi-wx/schemas/common.yaml#/PocketBaseNativeError'
PocketBaseRecordBase:
$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'
PocketBaseCompanyFields:
$ref: './openapi-wx/schemas/company.yaml#/PocketBaseCompanyFields'
PocketBaseCompanyRecord:
$ref: './openapi-wx/schemas/company.yaml#/PocketBaseCompanyRecord'
PocketBaseCompanyCreateRequest:
$ref: './openapi-wx/schemas/company.yaml#/PocketBaseCompanyCreateRequest'
PocketBaseCompanyUpdateRequest:
$ref: './openapi-wx/schemas/company.yaml#/PocketBaseCompanyUpdateRequest'
PocketBaseCompanyListResponse:
$ref: './openapi-wx/schemas/company.yaml#/PocketBaseCompanyListResponse'
PocketBaseAttachmentRecord:
$ref: './openapi-wx/schemas/attachments.yaml#/PocketBaseAttachmentRecord'
PocketBaseAttachmentListResponse:
$ref: './openapi-wx/schemas/attachments.yaml#/PocketBaseAttachmentListResponse'
PocketBaseProductListFields:
$ref: './openapi-wx/schemas/products.yaml#/PocketBaseProductListFields'
PocketBaseProductListRecord:
$ref: './openapi-wx/schemas/products.yaml#/PocketBaseProductListRecord'
PocketBaseProductListListResponse:
$ref: './openapi-wx/schemas/products.yaml#/PocketBaseProductListListResponse'
PocketBaseDocumentFields:
$ref: './openapi-wx/schemas/documents.yaml#/PocketBaseDocumentFields'
PocketBaseDocumentRecord:
$ref: './openapi-wx/schemas/documents.yaml#/PocketBaseDocumentRecord'
PocketBaseDocumentListResponse:
$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'