QuoteServices Static Fields

API:

GET /quote_services/static_fields.json

功能說明

provider 建立 / 編輯服務資料時,前端會讀取這支 API。legacy 原本保留一段靜態欄位定義,但實際程式已全部註解,正式 response 固定回空陣列。

成功 response:

{"StaticFormField":[]}

快速結論

  • actor:只需有效 REST API key,不需要 session。
  • legacy API:QuoteServicesController::static_fields()
  • legacy path:/quote_services/static_fields.json
  • new API:已補 Endpoint/V1/QuoteServices.php::static_fields()
  • routing:已補 Mapping.php,支援 legacy path。
  • side effect:無;不讀 DB、不寫 DB、不送 queue / notification。
  • 正式機流量:2026-06-03 查 legacy access log,GET 200 有 7006 筆,OPTIONS 200 有 6632 筆。

正式機 Access Log

2026-06-03 查詢機器:ip-10-5-2-242

筆數method / pathstatus
7006GET /quote_services/static_fields.json200
6632OPTIONS /quote_services/static_fields.json200

caller 包含 web、mobile web、iOS / Android app webview。

Legacy Rule

legacy 檔案:

/Users/mattsu/Documents/Site/get-lancer-php56/app/Plugin/Quotes/Controller/QuoteServicesController.php:3117

legacy 實際規則:

  1. 只在 JSON request 下輸出。
  2. Configure::read('site.language'),但目前欄位定義整段被註解,不影響 response。
  3. 設定 $fields = []
  4. {"StaticFormField":[]}

Side Effect

不做:

  • 不讀 DB。
  • 不寫 quote_services / quote_service_categories
  • 不建立 activity。
  • 不送 event queue / task queue。
  • 不讀 mail / SMS / URL / icon / fee threshold config。

New PHP 8.2 對照

new 檔案對應 legacy職責狀態
Lib/Common/RouterRule/Mapping.phplegacy path/quote_services/static_fields.json route 到 QuoteServices::static_fields()已補
Endpoint/V1/QuoteServices.php::static_fields()QuoteServicesController::static_fields()API key guard 與固定 response。已補
tests/QuoteServicesStaticFieldsTest.phpsuccess response驗證 legacy 空欄位 response。已補

測試

docker exec -w /project-data cd63f9147e8d vendor/bin/phpunit tests/QuoteServicesStaticFieldsTest.php

測試覆蓋:

  • legacy path 可 route 到 new action。
  • 有效 API key 回 {"StaticFormField":[]}