2026-05-19 11:00:28 +00:00
|
|
|
|
// Code generated by goctl. DO NOT EDIT.
|
|
|
|
|
|
// goctl 1.10.1
|
|
|
|
|
|
|
|
|
|
|
|
package handler
|
|
|
|
|
|
|
|
|
|
|
|
import (
|
|
|
|
|
|
"net/http"
|
|
|
|
|
|
"time"
|
|
|
|
|
|
|
2026-05-20 23:51:22 +00:00
|
|
|
|
member "gateway/internal/handler/member"
|
2026-05-19 11:00:28 +00:00
|
|
|
|
normal "gateway/internal/handler/normal"
|
|
|
|
|
|
"gateway/internal/svc"
|
|
|
|
|
|
|
|
|
|
|
|
"github.com/zeromicro/go-zero/rest"
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) {
|
2026-05-20 23:51:22 +00:00
|
|
|
|
server.AddRoutes(
|
|
|
|
|
|
[]rest.Route{
|
|
|
|
|
|
{
|
|
|
|
|
|
// 取得當前會員 profile(dev:Header X-Tenant-ID + X-UID)
|
|
|
|
|
|
Method: http.MethodGet,
|
|
|
|
|
|
Path: "/me",
|
|
|
|
|
|
Handler: member.GetMemberMeHandler(serverCtx),
|
|
|
|
|
|
},
|
|
|
|
|
|
{
|
|
|
|
|
|
// 更新當前會員 profile
|
|
|
|
|
|
Method: http.MethodPatch,
|
|
|
|
|
|
Path: "/me",
|
|
|
|
|
|
Handler: member.UpdateMemberMeHandler(serverCtx),
|
|
|
|
|
|
},
|
|
|
|
|
|
{
|
|
|
|
|
|
// TOTP 狀態
|
|
|
|
|
|
Method: http.MethodGet,
|
|
|
|
|
|
Path: "/me/totp",
|
|
|
|
|
|
Handler: member.GetTOTPStatusHandler(serverCtx),
|
|
|
|
|
|
},
|
|
|
|
|
|
{
|
|
|
|
|
|
// 解除 TOTP 綁定
|
|
|
|
|
|
Method: http.MethodDelete,
|
|
|
|
|
|
Path: "/me/totp",
|
|
|
|
|
|
Handler: member.DisableTOTPHandler(serverCtx),
|
|
|
|
|
|
},
|
|
|
|
|
|
{
|
|
|
|
|
|
// 重產 TOTP 備援碼
|
|
|
|
|
|
Method: http.MethodPost,
|
|
|
|
|
|
Path: "/me/totp/backup-codes",
|
|
|
|
|
|
Handler: member.RegenerateTOTPBackupCodesHandler(serverCtx),
|
|
|
|
|
|
},
|
|
|
|
|
|
{
|
|
|
|
|
|
// 確認 TOTP 綁定
|
|
|
|
|
|
Method: http.MethodPost,
|
|
|
|
|
|
Path: "/me/totp/enroll-confirm",
|
|
|
|
|
|
Handler: member.ConfirmTOTPEnrollHandler(serverCtx),
|
|
|
|
|
|
},
|
|
|
|
|
|
{
|
|
|
|
|
|
// 開始 TOTP 綁定
|
|
|
|
|
|
Method: http.MethodPost,
|
|
|
|
|
|
Path: "/me/totp/enroll-start",
|
|
|
|
|
|
Handler: member.StartTOTPEnrollHandler(serverCtx),
|
|
|
|
|
|
},
|
|
|
|
|
|
{
|
|
|
|
|
|
// 驗證 TOTP(step-up 測試)
|
|
|
|
|
|
Method: http.MethodPost,
|
|
|
|
|
|
Path: "/me/totp/verify",
|
|
|
|
|
|
Handler: member.VerifyTOTPHandler(serverCtx),
|
|
|
|
|
|
},
|
|
|
|
|
|
{
|
|
|
|
|
|
// 確認業務 email 驗證
|
|
|
|
|
|
Method: http.MethodPost,
|
|
|
|
|
|
Path: "/me/verifications/email/confirm",
|
|
|
|
|
|
Handler: member.ConfirmEmailVerificationHandler(serverCtx),
|
|
|
|
|
|
},
|
|
|
|
|
|
{
|
|
|
|
|
|
// 開始業務 email 驗證
|
|
|
|
|
|
Method: http.MethodPost,
|
|
|
|
|
|
Path: "/me/verifications/email/start",
|
|
|
|
|
|
Handler: member.StartEmailVerificationHandler(serverCtx),
|
|
|
|
|
|
},
|
|
|
|
|
|
{
|
|
|
|
|
|
// 確認業務 phone 驗證
|
|
|
|
|
|
Method: http.MethodPost,
|
|
|
|
|
|
Path: "/me/verifications/phone/confirm",
|
|
|
|
|
|
Handler: member.ConfirmPhoneVerificationHandler(serverCtx),
|
|
|
|
|
|
},
|
|
|
|
|
|
{
|
|
|
|
|
|
// 開始業務 phone 驗證
|
|
|
|
|
|
Method: http.MethodPost,
|
|
|
|
|
|
Path: "/me/verifications/phone/start",
|
|
|
|
|
|
Handler: member.StartPhoneVerificationHandler(serverCtx),
|
|
|
|
|
|
},
|
|
|
|
|
|
},
|
|
|
|
|
|
rest.WithPrefix("/api/v1/members"),
|
|
|
|
|
|
)
|
|
|
|
|
|
|
2026-05-19 11:00:28 +00:00
|
|
|
|
server.AddRoutes(
|
|
|
|
|
|
[]rest.Route{
|
|
|
|
|
|
{
|
|
|
|
|
|
// Ping
|
|
|
|
|
|
Method: http.MethodGet,
|
|
|
|
|
|
Path: "/health",
|
|
|
|
|
|
Handler: normal.PingHandler(serverCtx),
|
|
|
|
|
|
},
|
|
|
|
|
|
},
|
|
|
|
|
|
rest.WithPrefix("/api/v1"),
|
|
|
|
|
|
rest.WithTimeout(3000*time.Millisecond),
|
|
|
|
|
|
)
|
|
|
|
|
|
}
|