POST /quote_feedback_comments/save/{feedback_id}.json

最後更新:2026-07-31
環境:Staging
進度:0 / 2

前端如何觸發

這是「專家回覆消費者案件評價」,不是消費者撰寫評價。

路徑 A:案件聊天室(建議)

  1. 用收到該評價的專家帳號登入 Staging。
  2. 進入「案件」,打開已收到消費者評價的案件;可直接使用 https://staging.pro360.com.tw/dashboard/works/{bid_id}
  3. 在聊天室找到「消費者對您的第一次評價/消費者更新評價」卡片。
  4. 點卡片下方「回覆評價 >」;已有回覆時會顯示「修改回覆 >」。
  5. 輸入文字後點「送出回應」。
  6. DevTools Network 應出現 POST /quote_feedback_comments/save/{feedback_id}.json

按鈕出現條件:案件已有 consumer QuoteFeedback,而 response 也有 QuoteFeedbackComment array。沒有評價卡片時無法由這個頁面觸發。

程式路徑:

  • route:web-app/modules/routes.js:669-674
  • 評價卡片與按鈕:web-app/modules/components/dashboard/works/ChatRoomVendor.js:345-355web-app/modules/components/dashboard/ChatComponents.js:640-677
  • 開啟 popup:web-app/modules/components/dashboard/works/RequestDetail.js:887-897,943-945
  • 送出:web-app/modules/components/dashboard/Review.js:204-213web-app/modules/utils/api-manager.js:2172-2180

路徑 B:專家服務評價頁

  1. 開啟 https://staging.pro360.com.tw/dashboard/profiles/{service_id}/0,捲到「服務評價」,點標題旁鉛筆或「查看全部」。
  2. 頁面會進入 https://staging.pro360.com.tw/dashboard/services/{service_id}/reviews
  3. 留在「案件評價」;找一筆尚未回覆的評價,點「回覆評價」→「送出回應」。

限制:已有 comment 時此頁不顯示回覆按鈕;「商品評價」會呼叫 /new/v1/nshop_order_feedbacks/add_comment,不是本 API。

目前 web caller 只送 feedback_id + comment,沒有送 comment id。所以 UI 可驗證 create;下方 update branch 必須用 curl 驗證。

1. 新增臨時 comment

curl -i -X POST \
  -H "X-PRO360-Rest-Api-Key: ${STAGING_API_KEY}" \
  -H "X-PRO360-User-Session-Token: ${STAGING_SESSION_TOKEN}" \
  -F 'comment=php82-staging-smoke-create' \
  "https://api-staging.pro360.com.tw/quote_feedback_comments/save/${FEEDBACK_ID}.json"

預期:HTTP 200、JSON、x-php-env: php82-staging-*,body 為:

{"error":0,"status":"Success"}

DB 應新增一筆,comment 保留原值;customer 回覆時 is_customer="1",provider 回覆時為 "0"

2. 更新同一筆 comment(curl only)

先以唯一文字從 Staging DB 取得 COMMENT_ID

SELECT id, quote_feedback_id, comment_user_id, comment, is_customer, created, modified
FROM quote_feedback_comments
WHERE quote_feedback_id = :feedback_id
  AND comment_user_id = :session_user_id
  AND comment = 'php82-staging-smoke-create'
ORDER BY id DESC
LIMIT 1;
curl -i -X POST \
  -H "X-PRO360-Rest-Api-Key: ${STAGING_API_KEY}" \
  -H "X-PRO360-User-Session-Token: ${STAGING_SESSION_TOKEN}" \
  -F "id=${COMMENT_ID}" \
  -F 'comment=php82-staging-smoke-update' \
  "https://api-staging.pro360.com.tw/quote_feedback_comments/save/${FEEDBACK_ID}.json"

預期:HTTP 200、同一 success body;原 row 的 commentmodified 更新,idcreated 不變,也不可新增第二筆。

完成後接著執行 delete.md 清除臨時資料。