ODF/app/services.py

32 lines
706 B
Python
Raw Permalink Normal View History

2026-05-19 03:01:30 +00:00
"""服务层模块,提供核心业务逻辑。"""
2026-05-14 08:04:47 +00:00
from datetime import datetime
2026-05-19 03:01:30 +00:00
from typing import Dict, Any
2026-05-14 08:04:47 +00:00
2026-05-19 03:01:30 +00:00
def get_greeting(name: str = "World") -> str:
"""生成个性化问候语。
2026-05-14 08:04:47 +00:00
2026-05-19 03:01:30 +00:00
Args:
name: 被问候者的名字默认为 "World"
2026-05-14 08:04:47 +00:00
2026-05-19 03:01:30 +00:00
Returns:
包含问候语的字符串
2026-05-14 08:04:47 +00:00
"""
2026-05-19 03:01:30 +00:00
return f"Hello, {name}!"
2026-05-14 08:04:47 +00:00
2026-05-19 03:01:30 +00:00
def get_system_info() -> Dict[str, Any]:
"""获取当前系统信息(使用假数据模拟)。
2026-05-14 08:04:47 +00:00
2026-05-19 03:01:30 +00:00
Returns:
包含系统信息的字典
"""
now = datetime.now()
return {
"message": "Hello, World!",
"timestamp": now.isoformat(),
"service": "Simple Hello API",
"version": "1.0.0",
}