nomadro/apps/api/services/pay_svc/services/pb.py
eric 3e5b7c2098 Monorepo super-optimize: src layout, workspace scripts, docs.
Collapse portal under src/, unify pnpm workspace/scripts, thin VIP topic re-exports, drop orphan vip scaffolds and one-shot scripts, ignore xhs/release, document root commands.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-10-01 00:34:04 +08:00

23 lines
625 B
Python
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

"""PocketBase 客户端(基于 SDK)"""
from pay_svc.config import PB_URL, PB_ADMIN_EMAIL, PB_ADMIN_PASSWORD
from pay_svc.sdk.pocketbase import PocketBaseSDK
_pb_sdk: PocketBaseSDK | None = None
def _get_pb_sdk() -> PocketBaseSDK:
global _pb_sdk
if _pb_sdk is None:
_pb_sdk = PocketBaseSDK(
url=PB_URL,
admin_email=PB_ADMIN_EMAIL,
admin_password=PB_ADMIN_PASSWORD,
)
return _pb_sdk
def get_pb_client():
"""获取已认证的 PocketBase 客户端(复用已登录实例,不重复打日志)"""
sdk = _get_pb_sdk()
return sdk.get_client()