DeepLearning101 commited on
Commit
a2dbef0
·
verified ·
1 Parent(s): 5dfbc08

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -8
app.py CHANGED
@@ -141,12 +141,10 @@ def handle_booking(name, tel, email, date_str, time, pax, remarks, line_id):
141
  )
142
  requests.post("https://api.line.me/v2/bot/message/push", headers={"Authorization": f"Bearer {LINE_ACCESS_TOKEN}", "Content-Type": "application/json"}, json={"to": LINE_ADMIN_ID, "messages": [{"type": "text", "text": msg}]})
143
 
144
- html_response = """<div style='text-align: center; color: #fff; padding: 20px; border: 1px solid #d4af37; border-radius: 8px; background: #222;'><h2 style='color: #d4af37; margin: 0;'>Request Received</h2><p style='margin: 10px 0;'>🥂 預約申請已提交</p><p style='font-size: 0.9em; color: #aaa;'>請留意 Email 確認信 或 Line 訊息。</p></div>"""
145
 
146
  # 👇 成功時,第二個參數回傳 "success"
147
- return html_response, "success"
148
-
149
- # return """<div style='text-align: center; color: #fff; padding: 20px; border: 1px solid #d4af37; border-radius: 8px; background: #222;'><h2 style='color: #d4af37; margin: 0;'>Request Received</h2><p style='margin: 10px 0;'>🥂 預約申請已提交</p><p style='font-size: 0.9em; color: #aaa;'>請留意 Email 確認信 或 Line 訊息。</p></div>"""
150
 
151
  except Exception as e: return f"❌ 系統錯誤: {str(e)}", ""
152
 
@@ -222,10 +220,10 @@ with gr.Blocks(theme=theme, css=custom_css, title="Booking") as demo:
222
  demo.load(check_confirmation, None, redirect_url_box)
223
 
224
  ga4_trigger_box.change(
225
-         fn=None,
226
-         inputs=ga4_trigger_box,
227
-         outputs=None,
228
-         js="(val) => { if(val === 'success' && window.parent) { window.parent.postMessage('booking_success', '*'); } }"
229
  )
230
 
231
  redirect_url_box.change(
 
141
  )
142
  requests.post("https://api.line.me/v2/bot/message/push", headers={"Authorization": f"Bearer {LINE_ACCESS_TOKEN}", "Content-Type": "application/json"}, json={"to": LINE_ADMIN_ID, "messages": [{"type": "text", "text": msg}]})
143
 
144
+ html_response = """<div style='text-align: center; color: #fff; padding: 20px; border: 1px solid #d4af37; border-radius: 8px; background: #222;'><h2 style='color: #d4af37; margin: 0;'>Request Received</h2><p style='margin: 10px 0;'>🥂 預約申請已提交</p><p style='font-size: 0.9em; color: #aaa;'>請留意 Email 確認信 或 Line 訊息。</p></div>"""
145
 
146
  # 👇 成功時,第二個參數回傳 "success"
147
+ return html_response, "success"
 
 
148
 
149
  except Exception as e: return f"❌ 系統錯誤: {str(e)}", ""
150
 
 
220
  demo.load(check_confirmation, None, redirect_url_box)
221
 
222
  ga4_trigger_box.change(
223
+ fn=None,
224
+ inputs=ga4_trigger_box,
225
+ outputs=None,
226
+ js="(val) => { if(val === 'success' && window.parent) { window.parent.postMessage('booking_success', '*'); } }"
227
  )
228
 
229
  redirect_url_box.change(