nomadro/apps/api/services/pay_svc/services/memos.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

22 lines
624 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.

"""Memos 用户创建(基于 SDK,仅 nomadvip 使用)"""
from pay_svc.config import MEMOS_API, MEMOS_TOKEN
from pay_svc.sdk.memos import MemosSDK
_memos_sdk: MemosSDK | None = None
def _get_memos_sdk() -> MemosSDK:
global _memos_sdk
if _memos_sdk is None:
_memos_sdk = MemosSDK(
api_url=MEMOS_API,
token=MEMOS_TOKEN,
enabled=bool(MEMOS_API and MEMOS_TOKEN),
)
return _memos_sdk
def create_memos_user(user_id: str, password: str = "12345678"):
"""创建 Memos 用户"""
return _get_memos_sdk().create_user(user_id=user_id, password=password)