Users Verify

Legacy umbrella endpoint:

POST /users/verify/{type}/{action}.json

實際 routing key 要分開調查與搬移,不把 phone/preauthphone/authvoice/preauth 混成一支 generic verify API。

Routing Key Index

APILegacyNew狀態
POST /users/verify/phone/preauth.jsonUsersController::verify('phone', 'preauth')phone/preauth已補;new staging Infobip delivery 已驗證
POST /users/verify/phone/auth.jsonUsersController::verify('phone', 'auth')phone/auth已補;new staging logged-in auth / ownership reset 已驗證
POST /users/verify/voice/preauth.jsonUsersController::verify('voice', 'preauth')voice/preauth已補;真實 voice provider 實測待補
POST /users/verify/email/preauth.json同一 umbrella actionnew web caller 已改走 EmailVerifications::preauth*()legacy 只見 2 筆,先確認 replacement,不列第一批

Legacy controller 主流程:/Users/mattsu/Documents/Site/get-lancer-php56/app/Controller/UsersController.php:5804-6044

正式機 log 位置、rotation 命名、可重複使用的查詢語法與本次流量結果,統一記錄在 migration 共用的 _meta/access_log.md

搬移前固定檢查

  • preauthauth 是同一條 OTP lifecycle,hash、OTP、log 與重複限制要一起對表。
  • session 是 optional;有 valid session 時會補 user_id / user email,不能自行改成強制登入。
  • 需追 PhoneVerificationPhoneVerificationLogPhoneDeliveryBlockedPhoneDeviceIdLimitIpUtilPhoneUtilFactory、SMS / voice provider、referral 與 AbnormalConfig side effect。
  • new 已有部分同名 model / util,但都是 shared method;使用前先查 caller,差異用 wrapper / option / 專用 method 處理。
  • area 遵守 repo 特例:台灣環境不可補 area=tw
  • 每個 routing key 各自建立 detail doc;本頁只維護索引與跨路徑結論。

2026-07-16 實作與驗證結果

  • new action:Endpoint/V1/Users.php:1125-1407
  • explicit routing:Lib/Common/RouterRule/Mapping.php:108-111
  • OTP model:Lib/Model/PhoneVerification.php:27-134
  • verify delivery wrapper:Lib/Model/PhoneDelivery.php:27-45
  • verified phone ownership / notification:Lib/Model/User.php:718-848
  • PHPUnit:tests/UsersVerifyTest.php9 tests / 85 assertions
  • 已測既有案例、TW/HK/SG delivery MSISDN 與 legacy IP-limit 403 response;每個案例用 DB transaction rollback,避免清除 concurrent staging rows。
  • new staging 已驗證 Infobip SMS、delivery callback、logged-in auth 與 phone ownership reset;voice provider、referral / wallet、worker downstream 與完整 legacy/new diff 待補。