更新 app/api/v1/app_valuations/app_valuations.py

This commit is contained in:
dubingyan666 2025-11-26 20:49:49 +08:00
parent 3328439241
commit b0c80c500f

View File

@ -70,15 +70,19 @@ async def _perform_valuation_calculation(user_id: int, data: UserValuationCreate
except Exception as e:
logger.warning("valuation.policy_fetch_timeout industry={} err={}", data.industry, repr(e))
policy_match_score = getattr(policy_obj, 'score', 0.0) or 0.0
# 提取 经济价值B1 计算参数
input_data_by_b1 = await _extract_calculation_params_b1(data)
# ESG关联价值 ESG分 (0-10分)
input_data_by_b1["esg_score"] = esg_score
# 行业修正系数I
input_data_by_b1["industry_coefficient"] = fix_num_score
# 政策匹配度
input_data_by_b1["policy_match_score"] = policy_match_score
# 提取 经济价值B1 计算参数
input_data_by_b1 = await _extract_calculation_params_b1(
data, esg_score=esg_score, industry_coefficient=fix_num_score, policy_match_score=policy_match_score
)
# 侵权分 默认 6
try:
@ -342,7 +346,12 @@ async def calculate_valuation(
raise HTTPException(status_code=500, detail=f"任务提交失败: {str(e)}")
async def _extract_calculation_params_b1(data: UserValuationCreate) -> Dict[str, Any]:
async def _extract_calculation_params_b1(
data: UserValuationCreate,
esg_score: float = 0.0,
industry_coefficient: float = 0.0,
policy_match_score: float = 0.0,
) -> Dict[str, Any]:
"""
从用户提交的数据中提取计算所需的参数
@ -442,7 +451,10 @@ async def _extract_calculation_params_b1(data: UserValuationCreate) -> Dict[str,
'link_views': safe_float(data.link_views),
# 政策乘数B13相关参数
'implementation_stage': implementation_stage,
'funding_support': funding_support
'funding_support': funding_support,
'esg_score': safe_float(esg_score),
'industry_coefficient': safe_float(industry_coefficient),
'policy_match_score': safe_float(policy_match_score),
}