From 322f9da188d988b9bbbad6d6cbbaf3c27fe08691 Mon Sep 17 00:00:00 2001 From: 91771 Date: Wed, 17 Sep 2025 15:19:32 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=8A=E5=82=B3=E6=AA=94=E6=A1=88=E5=88=B0?= =?UTF-8?q?=E3=80=8C/=E3=80=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- PromptRecord.txt | 12 ++ index.html | 289 +++++++++++++++++++++++++++++++++++++++++++++++ main_Prompt.txt | 23 ++++ maintenance.html | Bin 0 -> 1024 bytes requirements.txt | 3 + 5 files changed, 327 insertions(+) create mode 100644 PromptRecord.txt create mode 100644 index.html create mode 100644 main_Prompt.txt create mode 100644 maintenance.html create mode 100644 requirements.txt diff --git a/PromptRecord.txt b/PromptRecord.txt new file mode 100644 index 0000000..7054f72 --- /dev/null +++ b/PromptRecord.txt @@ -0,0 +1,12 @@ +[2024-09-08] 新增 employee_votes API 需求 +- ✅ 產生 Flask API 伺服器 +- ✅ 使用 DB_connection.txt 連線到 employee_votes 資料表 +- ✅ 實作 GET /v1/employee_votes (支援過濾) +- ✅ 實作 GET /v1/employee_votes/ (找不到回 404) +- ✅ 實作 POST /v1/employee_votes (JSON 接收, 欄位驗證, 成功回 201) +- ✅ 實作 PATCH /v1/employee_votes/ (更新 menu_item_id/is_active, 成功回 200) +- ✅ 實作 DELETE /v1/employee_votes/ (成功回 204) +- ✅ 所有寫入使用參數化查詢避免 SQL 注入 +- ✅ 統一回應格式 { status, code, message, data } +- ✅ 統一錯誤格式 {status:"error", code, message} +- ✅ 啟用 CORS (允許本機前端) \ No newline at end of file diff --git a/index.html b/index.html new file mode 100644 index 0000000..5839aa9 --- /dev/null +++ b/index.html @@ -0,0 +1,289 @@ + + + + + + 公司內部訂餐系統 + + + + + + + +
+
+

+ + 今日菜單 +

+

選擇您喜愛的餐點,享受美味時光

+
+ + {% if menu_items %} + {% set categories = menu_items|map(attribute='category')|unique|list %} + + {% for category in categories %} +
+

+ + {{ category }} +

+
+ +
+ {% for item in menu_items if item.category == category %} +
+
+ {{ item.name }} +
+
{{ item.name }}
+

{{ item.description }}

+
+ ${{ "%0.2f"|format(item.price) }} + +
+
+
+
+ {% endfor %} +
+ {% endfor %} + {% else %} +
+ +

暫無菜單資料

+

請聯繫管理員更新菜單

+ + + 初始化菜單 + +
+ {% endif %} +
+ + + + + +
+ +
+ + + + + \ No newline at end of file diff --git a/main_Prompt.txt b/main_Prompt.txt new file mode 100644 index 0000000..c0e82d8 --- /dev/null +++ b/main_Prompt.txt @@ -0,0 +1,23 @@ +你是一個很有設計品味的網頁設計全端大師,且設計過多個餐廳用的系統;同時你也非常瞭解資料庫的運用及管理,現在我請想你幫助我設計一個公司內部用的訂餐系統,我會逐步告訴你需求 +1.請先將每次我們的對話記錄在資料夾下的PromptRecord.txt,每一次都要記錄,之後我不會在每一步逐一提醒 +2.請先連結到資料庫,連結方式請見資料夾下的DB_connection.txt +3.請抓取網址https://club.panjit.com.tw/back/menu/menu.php?1672970133&indexselectid=1中的菜單資訊,並將內容建立於DB內的menu_items資料表中,建立後將建立的資料呈現在畫面上 + + + +4.請產生一支可直接執行的 Flask API 伺服器,需求: +- 使用資料夾下的DB_connection.txt連線到menu_items資料表 + +- 路由: + - GET /v1/menu_items資料表:支援 ?main_course、?side_dish、?addon、?Order_Date、?is_active,要多回傳 {meta} + - GET /v1/menu_items資料表/:找不到回 404 + - POST /v1/menu_items資料表:接收 JSON {name,email,age},欄位驗證,成功回 201 並回新資料 + - PATCH /v1/menu_items資料表/:可更新任一欄位(main_course/side_dish/addon/Order_Date/is_active),成功回 200 回更新後資料 + - DELETE /v1/menu_items資料表/:成功回 204 + +- 所有寫入請用參數化查詢避免 SQL 注入 +- 統一格式 { status,code,message,data } +- 統一錯誤格式 {status:"error", code, message} +- 啟用 CORS(允許本機前端) + +5.請製作一網頁功能,可以對menu_items資料表做維護,功能為第4點的API為主,當USER送出後透過呼叫API去執行維護的功能 \ No newline at end of file diff --git a/maintenance.html b/maintenance.html new file mode 100644 index 0000000000000000000000000000000000000000..06d7405020018ddf3cacee90fd4af10487da3d20 GIT binary patch literal 1024 ScmZQz7zLvtFd70QH3R?z00031 literal 0 HcmV?d00001 diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..f180403 --- /dev/null +++ b/requirements.txt @@ -0,0 +1,3 @@ +Flask +Flask-Cors +mysql-connector-python \ No newline at end of file