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