add ali captcha

This commit is contained in:
2026-02-24 16:47:46 +08:00
parent 86bda66271
commit 2d7e241b76
16 changed files with 354 additions and 17 deletions

View File

@@ -0,0 +1,17 @@
package captcha
import (
"net/http"
"tyc-server/app/main/api/internal/logic/captcha"
"tyc-server/app/main/api/internal/svc"
"tyc-server/common/result"
)
func GetEncryptedSceneIdHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
l := captcha.NewGetEncryptedSceneIdLogic(r.Context(), svcCtx)
resp, err := l.GetEncryptedSceneId()
result.HttpResult(r, w, resp, err)
}
}

View File

@@ -22,6 +22,7 @@ import (
app "tyc-server/app/main/api/internal/handler/app"
auth "tyc-server/app/main/api/internal/handler/auth"
authorization "tyc-server/app/main/api/internal/handler/authorization"
captcha "tyc-server/app/main/api/internal/handler/captcha"
notification "tyc-server/app/main/api/internal/handler/notification"
pay "tyc-server/app/main/api/internal/handler/pay"
product "tyc-server/app/main/api/internal/handler/product"
@@ -954,6 +955,18 @@ func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) {
rest.WithPrefix("/api/v1"),
)
server.AddRoutes(
[]rest.Route{
{
// get encrypted scene id for aliyun captcha
Method: http.MethodPost,
Path: "/captcha/encryptedSceneId",
Handler: captcha.GetEncryptedSceneIdHandler(serverCtx),
},
},
rest.WithPrefix("/api/v1"),
)
server.AddRoutes(
[]rest.Route{
{