feat(shipping-notice): 新增临时库存管理功能,支持创建会话、获取分析结果及字段映射建议
This commit is contained in:
1 parent
46eb63f5bb
commit
e9bdd81f1a
320 files changed
+28361
-10487
No files matched your search
@@ -44,6 +44,26 @@ def cfg_int(key: str, default: int = 0, *, min_value: int | None = None) -> int:
|
||||
return parsed
|
||||
|
||||
|
||||
def cfg_float(
|
||||
key: str,
|
||||
default: float = 0.0,
|
||||
*,
|
||||
min_value: float | None = None,
|
||||
max_value: float | None = None,
|
||||
) -> float:
|
||||
"""读取 Flask config 浮点值,并在异常配置时回退到安全默认值。"""
|
||||
val = current_app.config.get(key)
|
||||
try:
|
||||
parsed = float(default if val is None else val)
|
||||
except (TypeError, ValueError):
|
||||
parsed = default
|
||||
if min_value is not None:
|
||||
parsed = max(parsed, min_value)
|
||||
if max_value is not None:
|
||||
parsed = min(parsed, max_value)
|
||||
return parsed
|
||||
|
||||
|
||||
def auto_progress_enabled() -> bool:
|
||||
"""是否启用 auto_progress 自动推进(SHIPPING_NOTICE_AUTO_PROGRESS_ENABLED)。"""
|
||||
return cfg_bool("SHIPPING_NOTICE_AUTO_PROGRESS_ENABLED", False)
|
||||
|
||||
Reference in new issue
Block a user