Skip to content

Commit 73be737

Browse files
committed
feat(ticket): 优化票务 ID 解析逻辑,增加类型检查和错误提示
1 parent 674cc07 commit 73be737

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

tab/settings.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -389,9 +389,12 @@ def on_submit_all(
389389

390390
ticket_cur: dict[str, Any] = ticket_value[ticket_info]
391391
people_cur = [buyer_value[item] for item in people_indices]
392-
ticket_id = extract_id_from_url(ticket_id)
393-
if ticket_id is None:
394-
raise gr.Error("未能从当前链接中解析出票务 ID,请重新获取票务信息。")
392+
if isinstance(ticket_id, str) and ticket_id.isdigit():
393+
pass
394+
else:
395+
ticket_id = extract_id_from_url(ticket_id)
396+
if ticket_id is None:
397+
raise gr.Error("未能从当前链接中解析出票务 ID,请重新获取票务信息。")
395398

396399
ConfigDB.insert("people_buyer_name", people_buyer_name)
397400
ConfigDB.insert("people_buyer_phone", people_buyer_phone)

0 commit comments

Comments
 (0)