diff --git a/backend/app/models/models.py b/backend/app/models/models.py index e857f99..5f9df82 100644 --- a/backend/app/models/models.py +++ b/backend/app/models/models.py @@ -55,6 +55,7 @@ class Collection(Base): f02_11_version = Column(String(100), nullable=True, index=True) f02_12_packaging = Column(String(100), nullable=True, index=True) f02_13_rarity = Column(String(50), nullable=True, index=True) # 珍惜度 + f02_14_number_category = Column(String(20), nullable=True, index=True) # 号码分类 # f03 评级信息 f03_20_is_graded = Column(Boolean, default=False, index=True) diff --git a/backend/app/routers/collections.py b/backend/app/routers/collections.py index 7e1b4e2..5d91468 100644 --- a/backend/app/routers/collections.py +++ b/backend/app/routers/collections.py @@ -38,6 +38,7 @@ def to_camel_case(data: dict) -> dict: 'f02_11_version': 'version', 'f02_12_packaging': 'packaging', 'f02_13_rarity': 'rarity', + 'f02_14_number_category': 'numberCategory', 'f03_20_is_graded': 'isGraded', 'f03_21_grading_company': 'gradingCompany', 'f03_22_grading_score': 'gradingScore', @@ -73,8 +74,8 @@ def generate_code(version: str, user_id: str, db: Session) -> str: max_num = 0 for (code,) in user_codes: - # 只处理纯数字或 4 位数字编码(忽略 TEST001 等特殊编码) - if re.match(r'^\d{4}$', code): + # 处理纯数字编码(支持4位和5位) + if re.match(r'^\d{4,5}$', code): try: num = int(code) if num > max_num: @@ -84,7 +85,12 @@ def generate_code(version: str, user_id: str, db: Session) -> str: # 当前用户最大号 +1 next_num = max_num + 1 - return str(next_num).zfill(4) + + # 如果超过9999,使用5位;否则使用4位 + if next_num > 9999: + return str(next_num).zfill(5) + else: + return str(next_num).zfill(4) @router.get("/next-code") @@ -164,6 +170,7 @@ def get_collections( 'f02_11_version': collection_item.f02_11_version, 'f02_12_packaging': collection_item.f02_12_packaging, 'f02_13_rarity': collection_item.f02_13_rarity, + 'f02_14_number_category': collection_item.f02_14_number_category, 'f03_20_is_graded': collection_item.f03_20_is_graded, 'f03_21_grading_company': collection_item.f03_21_grading_company, 'f03_22_grading_score': collection_item.f03_22_grading_score, @@ -247,6 +254,7 @@ def get_stats( by_grading_company = Counter(c.f03_21_grading_company for c in all_collections if c.f03_20_is_graded and c.f03_21_grading_company).items() by_grading_score = Counter(c.f03_22_grading_score for c in all_collections if c.f03_20_is_graded and c.f03_22_grading_score).items() by_special_mark = Counter(c.f04_30_special_mark for c in all_collections if c.f04_30_special_mark).items() + by_number_category = Counter(c.f02_14_number_category for c in all_collections if c.f02_14_number_category).items() # 总成本: SUM(cost_price + repair_fee + grading_fee) for ALL collections total_cost = sum( @@ -291,6 +299,7 @@ def get_stats( "byGradingCompany": [{"company": c, "count": n} for c, n in by_grading_company], "byGradingScore": [{"score": s, "count": n} for s, n in by_grading_score], "bySpecialMark": [{"mark": m, "count": n} for m, n in by_special_mark], + "byNumberCategory": [{"numberCategory": n, "count": c} for n, c in by_number_category], # 盈亏统计(只统计已售且有价格的藏品) "byProfitLoss": [ {"type": "profit", "label": "盈利", "count": sum(1 for c in sold_collections if c.f05_42_goal_price and c.f05_40_cost_price and c.f05_42_goal_price > c.f05_40_cost_price)}, @@ -337,6 +346,7 @@ def get_collection( 'f02_11_version': collection.get('f02_11_version'), 'f02_12_packaging': collection.get('f02_12_packaging'), 'f02_13_rarity': collection.get('f02_13_rarity'), + 'f02_14_number_category': collection.get('f02_14_number_category'), 'f03_20_is_graded': collection.get('f03_20_is_graded'), 'f03_21_grading_company': collection.get('f03_21_grading_company'), 'f03_22_grading_score': collection.get('f03_22_grading_score'), @@ -446,6 +456,7 @@ def create_collection( f02_11_version=collection_data.f02_11_version, f02_12_packaging=collection_data.f02_12_packaging, f02_13_rarity=collection_data.f02_13_rarity, + f02_14_number_category=collection_data.f02_14_number_category, f03_20_is_graded=collection_data.f03_20_is_graded or False, f03_21_grading_company=collection_data.f03_21_grading_company, f03_22_grading_score=collection_data.f03_22_grading_score, diff --git a/backend/app/schemas/schemas.py b/backend/app/schemas/schemas.py index b843b8e..0ba1bae 100644 --- a/backend/app/schemas/schemas.py +++ b/backend/app/schemas/schemas.py @@ -58,6 +58,7 @@ class CollectionBase(BaseModel): f02_11_version: Optional[str] = Field(None, alias="version") f02_12_packaging: Optional[str] = Field(None, alias="packaging") f02_13_rarity: Optional[str] = Field(None, alias="rarity") + f02_14_number_category: Optional[str] = Field(None, alias="numberCategory") # f03 评级信息 f03_20_is_graded: Optional[bool] = Field(False, alias="isGraded") @@ -104,6 +105,7 @@ class CollectionUpdate(BaseModel): f02_11_version: Optional[str] = Field(None, alias="version") f02_12_packaging: Optional[str] = Field(None, alias="packaging") f02_13_rarity: Optional[str] = Field(None, alias="rarity") + f02_14_number_category: Optional[str] = Field(None, alias="numberCategory") # f03 评级信息 f03_20_is_graded: Optional[bool] = Field(None, alias="isGraded") diff --git a/config/VERSION b/config/VERSION index cfb0091..92448f4 100644 --- a/config/VERSION +++ b/config/VERSION @@ -1 +1 @@ -VERSION=1.2.5 +VERSION=1.2.6 diff --git a/docs/部署检查清单.md b/docs/部署检查清单.md index 4166ed4..2f7f656 100644 --- a/docs/部署检查清单.md +++ b/docs/部署检查清单.md @@ -58,3 +58,15 @@ curl -X POST http://localhost:3000/api/auth/send-verification-code \ | 验证码失败 | 检查SMS_*配置是否完整 | | 导入错误 | 使用python3.11启动 | | 404错误 | 重启后端服务 | + +### 7. 用户协议页面检查 + + +
+ + +确认返回HTML内容 + +### 8. 前端静态文件检查 + +确认用户协议文件存在 diff --git a/frontend/index.html b/frontend/index.html index 757b50b..0aeae80 100644 --- a/frontend/index.html +++ b/frontend/index.html @@ -4,7 +4,7 @@ -