feat: 添加微信认证相关接口,包括微信登录和用户资料更新功能

- 新增 wechatLogin 接口,支持使用微信临时凭证 code 登录或注册用户,返回用户信息和 auth token。
- 新增 wechatProfile 接口,支持更新微信用户资料,支持非空字段增量更新。
- 定义相关请求和响应的 schema,包括 WechatLoginRequest、WechatProfileRequest、AuthSuccessResponse 和 WechatProfileResponse。
- 处理不同的响应状态码,包括成功、参数错误、认证失败等。
This commit is contained in:
2026-04-08 09:04:36 +08:00
parent 614c0147e5
commit e47060f54f
32 changed files with 6982 additions and 4468 deletions

View File

@@ -42,51 +42,51 @@ tags:
security: []
paths:
/pb/api/system/users-count:
$ref: './openapi-wx/paths/system.yaml#/usersCount'
$ref: './openapi-wx/system.yaml#/paths/usersCount'
/pb/api/system/refresh-token:
$ref: './openapi-wx/paths/system.yaml#/refreshToken'
$ref: './openapi-wx/system.yaml#/paths/refreshToken'
/pb/api/wechat/login:
$ref: './openapi-wx/paths/wechat-auth.yaml#/wechatLogin'
$ref: './openapi-wx/wechat-auth.yaml#/paths/wechatLogin'
/pb/api/wechat/profile:
$ref: './openapi-wx/paths/wechat-auth.yaml#/wechatProfile'
$ref: './openapi-wx/wechat-auth.yaml#/paths/wechatProfile'
/pb/api/collections/tbl_company/records:
$ref: './openapi-wx/paths/company.yaml#/companyRecords'
$ref: './openapi-wx/company.yaml#/paths/companyRecords'
/pb/api/collections/tbl_company/records/{recordId}:
$ref: './openapi-wx/paths/company.yaml#/companyRecordById'
$ref: './openapi-wx/company.yaml#/paths/companyRecordById'
/pb/api/collections/tbl_attachments/records:
$ref: './openapi-wx/paths/attachments.yaml#/attachmentRecords'
$ref: './openapi-wx/attachments.yaml#/paths/attachmentRecords'
/pb/api/collections/tbl_product_list/records:
$ref: './openapi-wx/paths/products.yaml#/productRecords'
$ref: './openapi-wx/products.yaml#/paths/productRecords'
/pb/api/collections/tbl_document/records:
$ref: './openapi-wx/paths/documents.yaml#/documentRecords'
$ref: './openapi-wx/documents.yaml#/paths/documentRecords'
/pb/api/cart/list:
$ref: './openapi-wx/paths/cart-hooks.yaml#/cartList'
$ref: './openapi-wx/cart.yaml#/paths/cartList'
/pb/api/cart/detail:
$ref: './openapi-wx/paths/cart-hooks.yaml#/cartDetail'
$ref: './openapi-wx/cart.yaml#/paths/cartDetail'
/pb/api/cart/create:
$ref: './openapi-wx/paths/cart-hooks.yaml#/cartCreate'
$ref: './openapi-wx/cart.yaml#/paths/cartCreate'
/pb/api/cart/update:
$ref: './openapi-wx/paths/cart-hooks.yaml#/cartUpdate'
$ref: './openapi-wx/cart.yaml#/paths/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'
$ref: './openapi-wx/cart.yaml#/paths/cartDelete'
/pb/api/collections/tbl_cart/records:
$ref: './openapi-wx/paths/cart-native.yaml#/cartRecords'
$ref: './openapi-wx/cart.yaml#/paths/cartRecords'
/pb/api/collections/tbl_cart/records/{recordId}:
$ref: './openapi-wx/paths/cart-native.yaml#/cartRecordById'
$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/paths/order-native.yaml#/orderRecords'
$ref: './openapi-wx/order.yaml#/paths/orderRecords'
/pb/api/collections/tbl_order/records/{recordId}:
$ref: './openapi-wx/paths/order-native.yaml#/orderRecordById'
$ref: './openapi-wx/order.yaml#/paths/orderRecordById'
components:
securitySchemes:
BearerAuth:
@@ -95,114 +95,114 @@ components:
bearerFormat: JWT
schemas:
ApiResponseBase:
$ref: './openapi-wx/schemas/common.yaml#/ApiResponseBase'
$ref: './openapi-wx/system.yaml#/components/schemas/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'
$ref: './openapi-wx/system.yaml#/components/schemas/ErrorResponse'
SystemRefreshTokenRequest:
$ref: './openapi-wx/schemas/system.yaml#/SystemRefreshTokenRequest'
$ref: './openapi-wx/system.yaml#/components/schemas/SystemRefreshTokenRequest'
RefreshTokenResponse:
$ref: './openapi-wx/schemas/system.yaml#/RefreshTokenResponse'
$ref: './openapi-wx/system.yaml#/components/schemas/RefreshTokenResponse'
UsersCountData:
$ref: './openapi-wx/schemas/system.yaml#/UsersCountData'
$ref: './openapi-wx/system.yaml#/components/schemas/UsersCountData'
UsersCountResponse:
$ref: './openapi-wx/schemas/system.yaml#/UsersCountResponse'
$ref: './openapi-wx/system.yaml#/components/schemas/UsersCountResponse'
UserInfo:
$ref: './openapi-wx/schemas/wechat-auth.yaml#/UserInfo'
$ref: './openapi-wx/wechat-auth.yaml#/components/schemas/UserInfo'
WechatLoginRequest:
$ref: './openapi-wx/schemas/wechat-auth.yaml#/WechatLoginRequest'
$ref: './openapi-wx/wechat-auth.yaml#/components/schemas/WechatLoginRequest'
WechatProfileRequest:
$ref: './openapi-wx/schemas/wechat-auth.yaml#/WechatProfileRequest'
$ref: './openapi-wx/wechat-auth.yaml#/components/schemas/WechatProfileRequest'
AuthSuccessData:
$ref: './openapi-wx/schemas/wechat-auth.yaml#/AuthSuccessData'
$ref: './openapi-wx/wechat-auth.yaml#/components/schemas/AuthSuccessData'
AuthSuccessResponse:
$ref: './openapi-wx/schemas/wechat-auth.yaml#/AuthSuccessResponse'
$ref: './openapi-wx/wechat-auth.yaml#/components/schemas/AuthSuccessResponse'
WechatProfileResponseData:
$ref: './openapi-wx/schemas/wechat-auth.yaml#/WechatProfileResponseData'
$ref: './openapi-wx/wechat-auth.yaml#/components/schemas/WechatProfileResponseData'
WechatProfileResponse:
$ref: './openapi-wx/schemas/wechat-auth.yaml#/WechatProfileResponse'
$ref: './openapi-wx/wechat-auth.yaml#/components/schemas/WechatProfileResponse'
CompanyInfo:
$ref: './openapi-wx/schemas/company.yaml#/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/schemas/company.yaml#/PocketBaseCompanyFields'
$ref: './openapi-wx/company.yaml#/components/schemas/PocketBaseCompanyFields'
PocketBaseCompanyRecord:
$ref: './openapi-wx/schemas/company.yaml#/PocketBaseCompanyRecord'
$ref: './openapi-wx/company.yaml#/components/schemas/PocketBaseCompanyRecord'
PocketBaseCompanyCreateRequest:
$ref: './openapi-wx/schemas/company.yaml#/PocketBaseCompanyCreateRequest'
$ref: './openapi-wx/company.yaml#/components/schemas/PocketBaseCompanyCreateRequest'
PocketBaseCompanyUpdateRequest:
$ref: './openapi-wx/schemas/company.yaml#/PocketBaseCompanyUpdateRequest'
$ref: './openapi-wx/company.yaml#/components/schemas/PocketBaseCompanyUpdateRequest'
PocketBaseCompanyListResponse:
$ref: './openapi-wx/schemas/company.yaml#/PocketBaseCompanyListResponse'
$ref: './openapi-wx/company.yaml#/components/schemas/PocketBaseCompanyListResponse'
PocketBaseAttachmentRecord:
$ref: './openapi-wx/schemas/attachments.yaml#/PocketBaseAttachmentRecord'
$ref: './openapi-wx/attachments.yaml#/components/schemas/PocketBaseAttachmentRecord'
PocketBaseAttachmentListResponse:
$ref: './openapi-wx/schemas/attachments.yaml#/PocketBaseAttachmentListResponse'
$ref: './openapi-wx/attachments.yaml#/components/schemas/PocketBaseAttachmentListResponse'
PocketBaseProductListFields:
$ref: './openapi-wx/schemas/products.yaml#/PocketBaseProductListFields'
$ref: './openapi-wx/products.yaml#/components/schemas/PocketBaseProductListFields'
PocketBaseProductListRecord:
$ref: './openapi-wx/schemas/products.yaml#/PocketBaseProductListRecord'
$ref: './openapi-wx/products.yaml#/components/schemas/PocketBaseProductListRecord'
PocketBaseProductListListResponse:
$ref: './openapi-wx/schemas/products.yaml#/PocketBaseProductListListResponse'
$ref: './openapi-wx/products.yaml#/components/schemas/PocketBaseProductListListResponse'
PocketBaseDocumentFields:
$ref: './openapi-wx/schemas/documents.yaml#/PocketBaseDocumentFields'
$ref: './openapi-wx/documents.yaml#/components/schemas/PocketBaseDocumentFields'
PocketBaseDocumentRecord:
$ref: './openapi-wx/schemas/documents.yaml#/PocketBaseDocumentRecord'
$ref: './openapi-wx/documents.yaml#/components/schemas/PocketBaseDocumentRecord'
PocketBaseDocumentListResponse:
$ref: './openapi-wx/schemas/documents.yaml#/PocketBaseDocumentListResponse'
$ref: './openapi-wx/documents.yaml#/components/schemas/PocketBaseDocumentListResponse'
HookRecordBase:
$ref: './openapi-wx/cart.yaml#/components/schemas/HookRecordBase'
CartRecord:
$ref: './openapi-wx/schemas/cart-hooks.yaml#/CartRecord'
$ref: './openapi-wx/cart.yaml#/components/schemas/CartRecord'
CartListRequest:
$ref: './openapi-wx/schemas/cart-hooks.yaml#/CartListRequest'
$ref: './openapi-wx/cart.yaml#/components/schemas/CartListRequest'
CartDetailRequest:
$ref: './openapi-wx/schemas/cart-hooks.yaml#/CartDetailRequest'
$ref: './openapi-wx/cart.yaml#/components/schemas/CartDetailRequest'
CartCreateRequest:
$ref: './openapi-wx/schemas/cart-hooks.yaml#/CartCreateRequest'
$ref: './openapi-wx/cart.yaml#/components/schemas/CartCreateRequest'
CartUpdateRequest:
$ref: './openapi-wx/schemas/cart-hooks.yaml#/CartUpdateRequest'
$ref: './openapi-wx/cart.yaml#/components/schemas/CartUpdateRequest'
CartDeleteRequest:
$ref: './openapi-wx/schemas/cart-hooks.yaml#/CartDeleteRequest'
$ref: './openapi-wx/cart.yaml#/components/schemas/CartDeleteRequest'
CartListResponse:
$ref: './openapi-wx/schemas/cart-hooks.yaml#/CartListResponse'
$ref: './openapi-wx/cart.yaml#/components/schemas/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'
$ref: './openapi-wx/cart.yaml#/components/schemas/CartDeleteResponse'
PocketBaseCartFields:
$ref: './openapi-wx/schemas/cart-native.yaml#/PocketBaseCartFields'
$ref: './openapi-wx/cart.yaml#/components/schemas/PocketBaseCartFields'
PocketBaseCartRecord:
$ref: './openapi-wx/schemas/cart-native.yaml#/PocketBaseCartRecord'
$ref: './openapi-wx/cart.yaml#/components/schemas/PocketBaseCartRecord'
PocketBaseCartCreateRequest:
$ref: './openapi-wx/schemas/cart-native.yaml#/PocketBaseCartCreateRequest'
$ref: './openapi-wx/cart.yaml#/components/schemas/PocketBaseCartCreateRequest'
PocketBaseCartUpdateRequest:
$ref: './openapi-wx/schemas/cart-native.yaml#/PocketBaseCartUpdateRequest'
$ref: './openapi-wx/cart.yaml#/components/schemas/PocketBaseCartUpdateRequest'
PocketBaseCartListResponse:
$ref: './openapi-wx/schemas/cart-native.yaml#/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/schemas/order-native.yaml#/PocketBaseOrderFields'
$ref: './openapi-wx/order.yaml#/components/schemas/PocketBaseOrderFields'
PocketBaseOrderRecord:
$ref: './openapi-wx/schemas/order-native.yaml#/PocketBaseOrderRecord'
$ref: './openapi-wx/order.yaml#/components/schemas/PocketBaseOrderRecord'
PocketBaseOrderCreateRequest:
$ref: './openapi-wx/schemas/order-native.yaml#/PocketBaseOrderCreateRequest'
$ref: './openapi-wx/order.yaml#/components/schemas/PocketBaseOrderCreateRequest'
PocketBaseOrderUpdateRequest:
$ref: './openapi-wx/schemas/order-native.yaml#/PocketBaseOrderUpdateRequest'
$ref: './openapi-wx/order.yaml#/components/schemas/PocketBaseOrderUpdateRequest'
PocketBaseOrderListResponse:
$ref: './openapi-wx/schemas/order-native.yaml#/PocketBaseOrderListResponse'
$ref: './openapi-wx/order.yaml#/components/schemas/PocketBaseOrderListResponse'