新增异常产品管理功能
- 新增 abnormal_products 数据库表 - 内容库和互联网均无搜索结果时存入异常库 - 新增异常产品 API: - GET /api/products/abnormal - 获取异常产品列表 - GET /api/products/abnormal/<product_name> - 获取异常产品详情 - POST /api/products/abnormal/<product_name>/resolve - 解决异常产品 - DELETE /api/products/abnormal/<product_name> - 删除异常产品记录 - POST /api/products/abnormal/<product_name>/retry - 重试处理 - 更新 README 文档
This commit is contained in:
@@ -84,9 +84,38 @@ class DataProcessService:
|
||||
)
|
||||
|
||||
if search_results['total'] == 0:
|
||||
# 没有找到数据,发送通知
|
||||
paramhub_client.send_notification(f"未找到产品 '{product_name}' 的相关数据")
|
||||
result['message'] = '未找到相关数据'
|
||||
# 没有找到数据,存入异常产品库
|
||||
print(f"[异常] 未找到产品 '{product_name}' 的相关数据,存入异常库")
|
||||
|
||||
# 添加到异常产品库
|
||||
db.add_abnormal_product(
|
||||
product_name=product_name,
|
||||
category=category,
|
||||
subcategory=subcategory,
|
||||
abnormal_type='no_search_results',
|
||||
abnormal_reason='内容库和互联网均未搜索到相关数据',
|
||||
search_results=search_results
|
||||
)
|
||||
|
||||
# 发送通知
|
||||
paramhub_client.send_notification(
|
||||
f"⚠️ 产品 '{product_name}' 未找到相关数据\n"
|
||||
f"已存入异常产品库,请人工排查"
|
||||
)
|
||||
|
||||
# 记录处理历史
|
||||
db.add_process_history(
|
||||
product_name=product_name,
|
||||
category=category,
|
||||
subcategory=subcategory,
|
||||
status='abnormal',
|
||||
details={
|
||||
'reason': 'no_search_results',
|
||||
'message': '内容库和互联网均未搜索到相关数据'
|
||||
}
|
||||
)
|
||||
|
||||
result['message'] = f"产品 '{product_name}' 未找到相关数据,已存入异常库"
|
||||
return result
|
||||
|
||||
# 2. 提取对应产品的具体内容(排除无关产品)
|
||||
|
||||
Reference in New Issue
Block a user