fix(api): ETC 发票 INSERT 中 URL 签名 %3D 在参数化 SQL 下按 %% 转义

pymysql 执行 sql % params 时把字面量 %3D 当作格式符,抛
unsupported format character 'D' (index 906)。参数化模板中的字面量
百分号必须写成 %%,渲染后仍为 %3D,与旧工具 f-string 产出的 SQL 一致。
已用 pymysql 同款插值离线验证全部 7 类模板渲染通过。
This commit is contained in:
xst
2026-09-08 11:53:22 +08:00
parent 52b73f456c
commit 26b6fa9c1a
2 changed files with 5 additions and 2 deletions
+4 -1
View File
@@ -56,7 +56,10 @@ ETC_INVOICE_INSERT_SQL = (
"%s, %s, "
"%s, %s, %s, 0.03, 0.03, "
"'征税发票', '*', %s, '2026-05-13 15:35:38', '2026-05-15 13:35:43', "
"'https://hdfs.txffp.com/e/1102e1en66nPPP1ChAeC161e1C6Pei16.zip?Expires=1812122633&OSSAccessKeyId=LTAIYAJbICRhyCD8&Signature=TLjlHgKtCxwWpPliPRQ0xQ6HdKY%3D', "
# 注意: URL 签名中的 % 必须写成 %%(参数化 SQL 里 % 是格式转义符),
# 经 pymysql 渲染后仍为 %3D;写成单个 % 会在 execute 时抛
# "unsupported format character 'D'"
"'https://hdfs.txffp.com/e/1102e1en66nPPP1ChAeC161e1C6Pei16.zip?Expires=1812122633&OSSAccessKeyId=LTAIYAJbICRhyCD8&Signature=TLjlHgKtCxwWpPliPRQ0xQ6HdKY%%3D', "
"'https://gateway.txffp.com/alle/common/htmlurl/getinvoice/41012526221804003093/1102e1en66nPPP1ChAeC161e1C6Pei16', "
"%s, %s, %s, "
"0, 'etc开票申请2026070604', '冀D8E016', 3, 0, "