- 重命名apps/app_b为apps/apple,调整项目结构 - 新增apps.apple.clients.itunes模块,实现iTunes API客户端功能 - 实现iTunes登录、兑换和查询接口,支持错误重试和状态处理 - 设计解析Apple XML响应的工具函数,提升数据处理能力 - 定义iTunes登录和兑换相关数据模型,基于Pydantic提升数据校验 - 新增apps.apple.clients.june模块,实现June API客户端功能 - 实现六月客户端登录、状态检测、签名获取及远程账户登录 - 设计June客户端请求加密与签名机制,保障接口安全通信 - 增加六月客户端配置、加密工具和辅助函数支持 - 完善模块__init__.py文件,明确导出API客户端类
46 lines
1.2 KiB
Python
46 lines
1.2 KiB
Python
"""
|
|
App B Models - Database models for products.
|
|
"""
|
|
|
|
from typing import Optional
|
|
from datetime import datetime
|
|
from decimal import Decimal
|
|
from sqlmodel import SQLModel, Field
|
|
|
|
|
|
class ProductBase(SQLModel):
|
|
"""Base product model with shared fields."""
|
|
|
|
name: str = Field(index=True, max_length=100)
|
|
description: Optional[str] = Field(default=None, max_length=500)
|
|
price: Decimal = Field(decimal_places=2)
|
|
stock: int = Field(default=0, ge=0)
|
|
is_available: bool = Field(default=True)
|
|
|
|
|
|
class Product(ProductBase, table=True):
|
|
"""
|
|
Product table model.
|
|
|
|
Represents products in the system.
|
|
"""
|
|
|
|
__tablename__ = "products"
|
|
|
|
id: Optional[int] = Field(default=None, primary_key=True)
|
|
sku: str = Field(unique=True, index=True, max_length=50)
|
|
created_at: datetime = Field(default_factory=datetime.utcnow)
|
|
updated_at: datetime = Field(default_factory=datetime.utcnow)
|
|
|
|
class Config:
|
|
json_schema_extra = {
|
|
"example": {
|
|
"name": "Laptop",
|
|
"description": "High-performance laptop",
|
|
"price": "999.99",
|
|
"stock": 10,
|
|
"sku": "LAP-001",
|
|
"is_available": True,
|
|
}
|
|
}
|