fix(todos): 标书md与docx同名产物都给出——交付确认待办按basename派生.md/.docx两候选,实际存在的才出行(md在线查看+docx下载);原单向md→docx补全在file_path已指向docx时漏掉md行

This commit is contained in:
ymq 2026-09-16 14:57:39 +08:00
parent 488cf8a30b
commit 28a26dc01f

View File

@ -546,11 +546,15 @@ async with DBPools().sqlorContext(dbname) as sor:
md.append('')
_bf = _s(getattr(b0, 'file_path', ''))
if _bf:
_file_rows.append(_file_link_row(os.path.basename(_bf), project_id, _bf))
# 2026-09-16md 有 docx 同名产物时一并给出(标书最终交付 docx
_bf_docx = os.path.splitext(_bf)[0] + '.docx'
if _bf_docx != _bf:
_file_rows.append(_file_link_row(os.path.basename(_bf_docx), project_id, _bf_docx))
# 2026-09-16标书 md可在线查看与 docx最终交付同名产物
# 都给出——file_path 可能指向其中任一,按 basename 派生两个候选,
# 实际存在的才出行md 走在线查看、docx 走下载)。
_base, _ext = os.path.splitext(_bf)
for _cand in (_base + '.md', _base + '.docx'):
if _cand and os.path.isfile(_cand):
_file_rows.append(_file_link_row(os.path.basename(_cand), project_id, _cand))
if not any(os.path.isfile(c) for c in (_base + '.md', _base + '.docx')):
_file_rows.append(_file_link_row(os.path.basename(_bf), project_id, _bf))
else:
md.append('## 待确认标书')
md.append('')