- 在应用中注册支付蓝图(payment_bp)以支持支付接口 - 配置支付宝相关秘钥、回调地址及环境选项 - 新增订单模型(Order),支持订单数据存储与管理 - 管理后台接口添加订单列表查询功能,支持超级管理员访问 - 购买页面与表单修改,支持不同套餐的购买提交 - 支付成功页面提示,显示订单编号及积分到账信息 - 移除买积分按钮禁用逻辑,开放购买功能
32 lines
813 B
Python
32 lines
813 B
Python
from __future__ import annotations
|
|
|
|
import os
|
|
from typing import Any, NoReturn
|
|
|
|
from ._typing import StrOrBytesPath, TypeGuard
|
|
|
|
|
|
def is_path(f: Any) -> TypeGuard[StrOrBytesPath]:
|
|
return isinstance(f, (bytes, str, os.PathLike))
|
|
|
|
|
|
def is_directory(f: Any) -> TypeGuard[StrOrBytesPath]:
|
|
"""Checks if an object is a string, and that it points to a directory."""
|
|
return is_path(f) and os.path.isdir(f)
|
|
|
|
|
|
class DeferredError:
|
|
def __init__(self, ex: BaseException):
|
|
self.ex = ex
|
|
|
|
def __getattr__(self, elt: str) -> NoReturn:
|
|
raise self.ex
|
|
|
|
@staticmethod
|
|
def new(ex: BaseException) -> Any:
|
|
"""
|
|
Creates an object that raises the wrapped exception ``ex`` when used,
|
|
and casts it to :py:obj:`~typing.Any` type.
|
|
"""
|
|
return DeferredError(ex)
|